/// <summary>
/// Starts the app, asynchronously.
/// </summary>
/// <returns>A task that will complete when the app exits</returns>
public override Task Start()
{
QueueAction(() =>
{
if (_current != null)
{
throw new NotSupportedException("An application is already running on this thread.");
}
// ensures that the current app is set on the message pump thread
_current = this;
});
if (SetFocusOnStart)
{
QueueAction(() =>
{
FocusManager.TryMoveFocus();
});
}
Paint();
Task pumpTask = base.Start();
var cleanupTask = pumpTask.ContinueWith((t) =>
{
ExitInternal();
});
return(cleanupTask);
}