private void OpenScriptToolStripMenuItem_Click(object sender, EventArgs e) { openFileDialog1.Filter = SCRIPTFILEFILTER; openFileDialog1.FilterIndex = 0; openFileDialog1.Title = "Open Script File"; openFileDialog1.FileName = ""; if (openFileDialog1.ShowDialog(this) == DialogResult.OK) { if (IsFileLoaded(openFileDialog1.FileName)) { return; } frmDocument docNew = new frmDocument(openFileDialog1.FileName, null); docNew.ToolTipShown += Document_ToolTipShown; if (documents.Count < 1) { docNew.Show(dockPanel1, DockState.Document); } else { docNew.Show(documents[0].Pane, null); } documents.Add(docNew); } }
private void NewScriptToolStripMenuItem_Click(object sender, EventArgs e) { int maxNew = 0; foreach (frmDocument fDoc in documents) { if (fDoc.FileName.StartsWith(NEWSCRIPTFORMATSTRINGPREFIX)) { if (int.TryParse(fDoc.FileName.Substring(4), out int i)) { if (i > maxNew) { maxNew = i; } } } } frmDocument docNew = new frmDocument(string.Format(NEWSCRIPTFORMATSTRINGPREFIX + "{0}", maxNew + 1), ""); docNew.ToolTipShown += Document_ToolTipShown; if (documents.Count < 1) { docNew.Show(dockPanel1, DockState.Document); } else { docNew.Show(documents[0].Pane, null); } documents.Add(docNew); }
private void AddNewScriptIfNone() { if (documents.Count < 1) { frmDocument docNew = new frmDocument(string.Format(NEWSCRIPTFORMATSTRINGPREFIX + "{0}", 1), ""); docNew.ToolTipShown += Document_ToolTipShown; docNew.Show(dockPanel1, DockState.Document); documents.Add(docNew); } }