1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 14:25:05 +08:00

Expose API scheduling internally

This commit is contained in:
Dean Herbert 2018-03-14 11:37:50 +09:00
parent 07642546bb
commit ce2997419a
3 changed files with 5 additions and 3 deletions

View File

@ -65,6 +65,8 @@ namespace osu.Game.Online.API
private readonly List<IOnlineComponent> components = new List<IOnlineComponent>();
internal void Schedule(Action action) => base.Schedule(action);
public void Register(IOnlineComponent component)
{
Scheduler.Add(delegate

View File

@ -14,7 +14,7 @@ namespace osu.Game.Online.API
return request;
}
private void request_Progress(long current, long total) => Progress?.Invoke(current, total);
private void request_Progress(long current, long total) => API.Schedule(() => Progress?.Invoke(current, total));
protected APIDownloadRequest()
{

View File

@ -85,7 +85,7 @@ namespace osu.Game.Online.API
if (checkAndProcessFailure())
return;
api.Scheduler.Add(delegate { Success?.Invoke(); });
api.Schedule(delegate { Success?.Invoke(); });
}
public void Cancel() => Fail(new OperationCanceledException(@"Request cancelled"));
@ -108,7 +108,7 @@ namespace osu.Game.Online.API
{
if (API == null || pendingFailure == null) return cancelled;
API.Scheduler.Add(pendingFailure);
API.Schedule(pendingFailure);
pendingFailure = null;
return true;
}