private void acceptButton_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(projectName.Text)) { using (SaveFileDialog sfd = new SaveFileDialog()) { sfd.Filter = "CHMDotNet Projektdatei (*.cdn)|*.cdn"; sfd.FileName = projectName.Text; if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { CHMProject project = ProjectManager.NewProject(projectName.Text, sfd.FileName); FileHistoryManager.AddFile(sfd.FileName); Form projectForm = new Form(); projectForm.ShowIcon = true; projectForm.Tag = projectName.Text; ProjectEditor editor = new ProjectEditor(); editor.Dock = DockStyle.Fill; editor.SetRootTreeNode(project, projectName.Text); projectForm.Controls.Add(editor); projectForm.ShowIcon = false; projectForm.Text = projectName.Text; projectForm.Icon = Resources.project; projectForm.MdiParent = this.mWindow; projectForm.Show(); projectForm.WindowState = FormWindowState.Maximized; this.Close(); } } } else { MessageBox.Show("Es muss ein Projektname festgelegt werden!", "CHMDotNet", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void OpenProject(string filename) { CHMProject chmProject = ProjectManager.OpenProject(filename); if (chmProject != null) { FileHistoryManager.AddFile(filename); Form projectForm = new Form(); projectForm.Tag = filename; ProjectEditor editor = new ProjectEditor(); editor.Dock = DockStyle.Fill; editor.OpenProject(chmProject); projectForm.Controls.Add(editor); projectForm.ShowIcon = true; projectForm.Icon = Resources.project; projectForm.Text = chmProject.Name; projectForm.MdiParent = this; projectForm.Show(); projectForm.WindowState = FormWindowState.Maximized; } }