public async Task Process(PreGameLaunchCancelleableEvent message) { _event = message; if (!message.Cancel) { message.Cancel = await ShouldCancel().ConfigureAwait(false); } // TODO: The data to check should already be included, like Executable/Directory, etc? // Or even better; include a flag that says if there are already running instances of the game instead? if (!message.Cancel) { await CheckRunningProcesses(GetGameExeName()).ConfigureAwait(false); } }
async Task HandleUserLaunchChecks(IGameLauncher launcher) { if (Common.Flags.IgnoreErrorDialogs) { return; } var preLaunchCancellable = new PreGameLaunchCancelleableEvent(this, CalculatedSettings.Collection, CalculatedSettings.Mission, CalculatedSettings.Server); await launcher.Notify(preLaunchCancellable).ConfigureAwait(false); if (preLaunchCancellable.Cancel) { throw new OperationCanceledException("User Cancelled PreLaunch Checks"); } if (Common.AppCommon.IsBusy) { throw new BusyStateHandler.BusyException(); } }
// TODO: Async public async Task Handle(PreGameLaunchCancelleableEvent notification) { using (var handler = _pregameLaunchFactory.CreateExport()) await handler.Value.Process(notification); }