protected async Task PreLaunch(IGameLauncher launcher) { LaunchChecks(); await HandleUserLaunchChecks(launcher).ConfigureAwait(false); await launcher.Notify(new PreGameLaunchEvent(this)).ConfigureAwait(false); }
protected async Task <int> RegisterLaunchIf(Process p, IGameLauncher launcher) { if (p == null) { return(-1); } var id = p.Id; // TODO: better not to hold on to the process because of info going out of date / Id can't be called when the process is killed etc? RegisterRunning(p); await launcher.Notify(new GameLaunchedEvent(Running, CalculatedSettings.Server)).ConfigureAwait(false); return(id); }
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(); } }