private void ButtonPlay_Click(object sender, EventArgs e) { switch (CurrentState) { case State.Idle: CurrentState = State.RTPatch; _nextState = NextState.Play; RTPatcher.Run(ComboBoxLanguages.SelectedItem as Language); break; case State.WaitClient: ButtonPlay.Text = StringLoader.GetText("button_cancelling"); GameStarter.Cancel(); break; } }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason.In(CloseReason.ApplicationExitCall, CloseReason.WindowsShutDown)) { Logger.Info($"{Text} closing abnormally. Reason=[{e.CloseReason.ToString()}]"); CurrentState = State.Idle; RTPatcher.Cancel(); Downloader.Cancel(); Patcher.Cancel(); GameStarter.Cancel(); } else if (!CurrentState.In(State.Idle, State.RegionNotInstalled)) { MsgBox.Error(StringLoader.GetText("exception_cannot_close", AssemblyAccessor.Title)); e.Cancel = true; } else { Logger.Info($"{Text} closing. Reason=[{e.CloseReason.ToString()}]"); } }