private void menuItemNew_Click(object sender, System.EventArgs e) { #if DockSample // eucaly, 151205 DummyDoc dummyDoc = CreateNewDocument(); if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi) { dummyDoc.MdiParent = this; dummyDoc.Show(); } else { dummyDoc.Show(dockPanel); } #endif }
private DummyDoc NewDummyDoc() { DummyDoc DummyDoc = CreateNewDoc(); if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi) { DummyDoc.MdiParent = this; DummyDoc.Show(); } else { DummyDoc.Show(dockPanel); } return(DummyDoc); }
private void menuItemOpen_Click(object sender, System.EventArgs e) { OpenFileDialog openFile = new OpenFileDialog(); openFile.InitialDirectory = Application.ExecutablePath; openFile.Filter = "rtf files (*.rtf)|*.rtf|txt files (*.txt)|*.txt|All files (*.*)|*.*"; openFile.FilterIndex = 1; openFile.RestoreDirectory = true; if (openFile.ShowDialog() == DialogResult.OK) { string fullName = openFile.FileName; string fileName = Path.GetFileName(fullName); if (FindDocument(fileName) != null) { MessageBox.Show("The document: " + fileName + " has already opened!"); return; } DummyDoc dummyDoc = new DummyDoc(); dummyDoc.Text = fileName; if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi) { dummyDoc.MdiParent = this; dummyDoc.Show(); } else { dummyDoc.Show(dockPanel); } try { dummyDoc.FileName = fullName; } catch (Exception exception) { dummyDoc.Close(); MessageBox.Show(exception.Message); } } }
private DummyDoc NewDummyDoc(FileInfo info) { var doc = FindDoc(info) as DummyDoc; if (doc != null) { doc.Activate(); return(doc); } DummyDoc DummyDoc = CreateNewDoc(info); if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi) { DummyDoc.MdiParent = this; DummyDoc.Show(); } else { DummyDoc.Show(dockPanel); } return(DummyDoc); }
private void menuItemOpen_Click(object sender, System.EventArgs e) { OpenFileDialog openFile = new OpenFileDialog(); openFile.InitialDirectory = Application.ExecutablePath; openFile.Filter = "rtf files (*.rtf)|*.rtf|txt files (*.txt)|*.txt|All files (*.*)|*.*"; openFile.FilterIndex = 1; openFile.RestoreDirectory = true; if (openFile.ShowDialog() == DialogResult.OK) { string fullName = openFile.FileName; string fileName = Path.GetFileName(fullName); if (FindDocument(fileName) != null) { MessageBox.Show("The document: " + fileName + " has already opened!"); return; } DummyDoc dummyDoc = new DummyDoc(); dummyDoc.Text = fileName; if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi) { dummyDoc.MdiParent = this; dummyDoc.Show(); } else dummyDoc.Show(dockPanel); try { dummyDoc.FileName = fullName; } catch (Exception exception) { dummyDoc.Close(); MessageBox.Show(exception.Message); } } }