Remove unnecessary RunTask calls

This commit is contained in:
Dean Herbert 2020-09-08 18:26:13 +09:00
parent 14bf2ab936
commit ad5d6117c7
2 changed files with 6 additions and 18 deletions

View File

@ -39,10 +39,7 @@ public bool OnPressed(GlobalAction action)
return true;
case GlobalAction.MusicNext:
musicController.NextTrack(() =>
{
onScreenDisplay?.Display(new MusicActionToast("Next track"));
}).RunTask();
musicController.NextTrack(() => onScreenDisplay?.Display(new MusicActionToast("Next track")));
return true;
@ -59,7 +56,7 @@ public bool OnPressed(GlobalAction action)
onScreenDisplay?.Display(new MusicActionToast("Previous track"));
break;
}
}).RunTask();
});
return true;
}

View File

@ -201,13 +201,8 @@ public bool TogglePause()
/// <summary>
/// Play the previous track or restart the current track if it's current time below <see cref="restart_cutoff_point"/>.
/// </summary>
/// <param name="onSuccess">
/// Invoked when the operation has been performed successfully.
/// The result isn't returned directly to the caller because
/// the operation is scheduled and isn't performed immediately.
/// </param>
/// <returns>A <see cref="ScheduledDelegate"/> of the operation.</returns>
public ScheduledDelegate PreviousTrack(Action<PreviousTrackResult> onSuccess = null) => Schedule(() =>
/// <param name="onSuccess">Invoked when the operation has been performed successfully.</param>
public void PreviousTrack(Action<PreviousTrackResult> onSuccess = null) => Schedule(() =>
{
PreviousTrackResult res = prev();
if (res != PreviousTrackResult.None)
@ -248,13 +243,9 @@ private PreviousTrackResult prev()
/// <summary>
/// Play the next random or playlist track.
/// </summary>
/// <param name="onSuccess">
/// Invoked when the operation has been performed successfully.
/// The result isn't returned directly to the caller because
/// the operation is scheduled and isn't performed immediately.
/// </param>
/// <param name="onSuccess">Invoked when the operation has been performed successfully.</param>
/// <returns>A <see cref="ScheduledDelegate"/> of the operation.</returns>
public ScheduledDelegate NextTrack(Action onSuccess = null) => Schedule(() =>
public void NextTrack(Action onSuccess = null) => Schedule(() =>
{
bool res = next();
if (res)