public void RunDebug() { if (FileManager.PendingChangesCount >= 1) { DialogResult result = MessageBox.Show(this, "您已经修改了本工程。在开始调试前是否需要保存呢?", this.Text, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); switch (result) { case DialogResult.Cancel: return; case DialogResult.No: break; case DialogResult.Yes: FileManager.ApplyPendingChanges(); break; } } System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(System.IO.Path.Combine(ProjectManager.ProjectDir, "Game.exe")); //System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo("cmd.exe"); info.UseShellExecute = false; info.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal; info.StandardOutputEncoding = Encoding.UTF8; info.StandardErrorEncoding = Encoding.UTF8; info.RedirectStandardError = true; info.RedirectStandardInput = true; info.RedirectStandardOutput = true; System.Diagnostics.Process proc = System.Diagnostics.Process.Start(info); AbstractFile file = (new Debugger.ProcessStandardStreamFile(proc, true)); file.ShowEditor(); try { //TODO: file.Editor.Show(NekoKun.Core.Application.Logger.Editor.Pane, NekoKun.Core.Application.Logger.Editor); } catch { } }
void Workbench_FormClosing(object sender, FormClosingEventArgs e) { if (FileManager.PendingChangesCount >= 1) { DialogResult result = MessageBox.Show(this, "您已经修改了本工程。在关闭编辑器前是否需要保存呢?", this.Text, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); switch (result) { case DialogResult.Cancel: break; case DialogResult.No: return; case DialogResult.Yes: FileManager.ApplyPendingChanges(); if (FileManager.PendingChangesCount == 0) { return; } break; } e.Cancel = true; } }
private void menuSave_Click(object sender, EventArgs e) { FileManager.ApplyPendingChanges(); }