Fire initial APIStateChanged on local thread

This commit is contained in:
Dean Herbert 2019-03-08 12:00:38 +09:00
parent 272ebeb23d
commit 11e5c6a2a0
1 changed files with 7 additions and 5 deletions

View File

@ -70,13 +70,15 @@ public APIAccess(OsuConfigManager config)
internal new void Schedule(Action action) => base.Schedule(action);
/// <summary>
/// Register a component to receive API events.
/// Fires <see cref="IOnlineComponent.APIStateChanged"/> once immediately to ensure correct .
/// </summary>
/// <param name="component"></param>
public void Register(IOnlineComponent component)
{
Scheduler.Add(delegate
{
components.Add(component);
component.APIStateChanged(this, state);
});
Scheduler.Add(delegate { components.Add(component); });
component.APIStateChanged(this, state);
}
public void Unregister(IOnlineComponent component)