private void ShowNewForm(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); string PrevFullFileName = loadConfiguration(); string prevPath; if (File.Exists(PrevFullFileName)) { prevPath = Path.GetFullPath(PrevFullFileName); saveFileDialog.InitialDirectory = prevPath; } else { saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); } saveFileDialog.FileName = "geom_model"; saveFileDialog.Filter = "Preprocessor Files (*.prp)|*.prp|All Files (*.*)|*.*"; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { ProjectForm childForm = new ProjectForm(); childForm.MdiParent = this; childForm.FormClosed += new FormClosedEventHandler(ChildClosed); childForm.WindowState = FormWindowState.Maximized; string FileName = saveFileDialog.FileName; if (MdiChildren.Any(p => p.Text == FileName)) { MdiChildren.First(p => p.Text == FileName).Close(); } Save(FileName); } }
private void openLast_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); string prevFileName = loadConfiguration(); if (File.Exists(prevFileName)) { string FileName = prevFileName; if (MdiChildren.Length == 0) { Open(FileName); } else { if (MdiChildren.Any(p => p.Text == FileName)) { MdiChildren.First(p => p.Text == FileName).Activate(); } else { Open(FileName); } } } else { MessageBox.Show("Файл с последним проектом не найден!"); } }
private void SaveAs() { SaveFileDialog saveFileDialog = new SaveFileDialog(); string PrevFileName = loadConfiguration(); string prevPath; if (File.Exists(PrevFileName)) { prevPath = Path.GetFullPath(PrevFileName); saveFileDialog.InitialDirectory = prevPath; } else { saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); } saveFileDialog.Filter = "Preprocessor Files (*.prp)|*.prp|All Files (*.*)|*.*"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { string FileName = saveFileDialog.FileName; if (MdiChildren.Any(p => p.Text == FileName)) { MdiChildren.First(p => p.Text == FileName).Close(); } SaveAs(FileName); } }
public void MostrarPanel() { try { m_ActiveForm = MdiChildren.First(a => a.Text.Equals(String.Format(":: {0} ::", m_ItemContenedor.Nombre))); m_ActiveForm.Activate(); } catch (Exception) { m_ActiveForm = new FrmDetails(m_Main, m_ItemContenedor); } }
public void OpenChildForm(Form formToOpen, Form callingForm = null) { if (callingForm != null) { _previousForm = callingForm; _previousForm.Hide(); } else { if (MdiChildren.Length > 0) { MdiChildren.First().Close(); } } formToOpen.MdiParent = this; formToOpen.Show(); }
private void nextChild_Click(object sender, EventArgs e) { if (MdiChildren.Length == 0) { return; } if (ActiveMdiChild == MdiChildren.Last()) { MdiChildren.First().Activate(); } else { int i = 0; while (MdiChildren[i] != ActiveMdiChild) { i++; } MdiChildren[i + 1].Activate(); } }
private void Open() { OpenFileDialog openFileDialog = new OpenFileDialog(); string PrevFileName = loadConfiguration(); string prevPath; if (File.Exists(PrevFileName)) { prevPath = Path.GetFullPath(PrevFileName); openFileDialog.InitialDirectory = prevPath; } else { openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); } openFileDialog.Filter = "Preprocessor Files (*.prp)|*.prp|All Files (*.*)|*.*"; if (openFileDialog.ShowDialog() == DialogResult.OK) { string FileName = openFileDialog.FileName; if (MdiChildren.Length == 0) { Open(FileName); } else { if (MdiChildren.Any(p => p.Text == FileName)) { MdiChildren.First(p => p.Text == FileName).Activate(); } else { Open(FileName); } } } }