private void WindowLoadScript(Domain d, TreeViewFocus t) { switch (t) { case TreeViewFocus.Script_Preparation: this.syntaxDocumentWindow.Text = d.PreparationScript; this.syntaxDocumentWindow.Modified = false; break; case TreeViewFocus.Script_Parser: this.syntaxDocumentWindow.Text = d.ParserScript; this.syntaxDocumentWindow.Modified = false; break; case TreeViewFocus.Script_Storage: this.syntaxDocumentWindow.Text = d.StorageScript; this.syntaxDocumentWindow.Modified = false; break; } }
private bool JudgeAndSaveModifiedScript(Domain d, TreeViewFocus t) { if (this.syntaxDocumentWindow.Modified) { DialogResult r = MessageBox.Show("是否需要保存对该脚本的修改?", "保存确认", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (r == DialogResult.Yes) { switch (t) { case TreeViewFocus.Script_Preparation: d.PreparationScript = this.syntaxDocumentWindow.Text; break; case TreeViewFocus.Script_Parser: d.ParserScript = this.syntaxDocumentWindow.Text; break; case TreeViewFocus.Script_Storage: d.StorageScript = this.syntaxDocumentWindow.Text; break; } return true; } else { if (r == DialogResult.Cancel) { return false; } else return true; } } else return true; }