private async void tsbtnCompile_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(currentWorkspace.SaveFilePath)) { MessageBox.Show(I18n.Translate("Msg.CompileNotSaved")); return; } if (ModifierKeys.HasFlag(Keys.Control) && ModifierKeys.HasFlag(Keys.Shift)) { Clipboard.SetText(await mainWebBrowser.BkyExportCSharp()); return; } tsbtnCompile.Enabled = tsbtnCompileRun.Enabled = tsbtnCompileSetting.Enabled = false; try { var buildResult = await buildAllPlatforms(); if (string.IsNullOrEmpty(buildResult)) { MessageBox.Show(I18n.Translate("Msg.CompileNoTarget")); } else { MessageBox.Show(I18n.Translate("Msg.CompileFinish") + buildResult); } } catch (CompilerFunction.CompileException ex) { var ced = new FormCompileError(ex); ced.ShowDialog(); } catch (Exception ex) { MessageBox.Show(I18n.Translate("Msg.CompileFail") + ex.Message); } tsbtnCompile.Enabled = tsbtnCompileRun.Enabled = tsbtnCompileSetting.Enabled = true; }
private async void tsbtnCompileRun_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(currentWorkspace.SaveFilePath)) { MessageBox.Show(I18n.Translate("Msg.CompileNotSaved")); return; } tsbtnCompile.Enabled = tsbtnCompileRun.Enabled = tsbtnCompileSetting.Enabled = false; try { var buildResult = await buildAllPlatforms(); if (string.IsNullOrEmpty(buildResult)) { MessageBox.Show(I18n.Translate("Msg.CompileNoTarget")); } else { var gameProcess = currentWorkspace.Config.GetGameProcess(); if (gameProcess == null) { MessageBox.Show(I18n.Translate("Msg.NoGameProgram")); } else { gameProcess.Start(); await gameProcess.WaitForExitAsync(); } } } catch (CompilerFunction.CompileException ex) { var ced = new FormCompileError(ex); ced.ShowDialog(); } catch (Exception ex) { MessageBox.Show(I18n.Translate("Msg.CompileFail") + ex.Message); } tsbtnCompile.Enabled = tsbtnCompileRun.Enabled = tsbtnCompileSetting.Enabled = true; }