/// <summary> /// Handles the <see cref="DialogProject"/> form, checks all the directories and builds the <see cref="Project"/> object. /// </summary> public void NewProject() { using (var dialog = new DialogProject()) { var result = dialog.ShowDialog(); if (result != DialogResult.OK) return; if (Project != null) { var dialogResult = MessageBox.Show(@"Creating a new project will close the current one. Continue?", @"New Project", MessageBoxButtons.YesNo); if (dialogResult != DialogResult.Yes) return; CloseProject(); } var name = dialog.ProjectName; var author = dialog.Author; var description = dialog.Description; var path = dialog.FilePath; Project = new Project(name, author, description, path); if (ProjectLoaded != null) ProjectLoaded.Invoke(this, new ProjectLoadedEventArgs(Project)); Settings = new ProjectSettings(); if (SettingsLoaded != null) SettingsLoaded.Invoke(this, new SettingsLoadedEventArgs(Settings)); SaveProject(); Console.WriteLine(@"Project {0} created.", name); } }
/// <summary> /// Handles the <see cref="DialogProject"/> form and updates the <see cref="Project"/> object with the new data. /// </summary> public void EditProject() { if (Project == null) return; using (var dialog = new DialogProject(Project.Name, Project.Author, Project.Description, Project.FilePath)) { var result = dialog.ShowDialog(); if (result != DialogResult.OK) return; var name = dialog.ProjectName; var author = dialog.Author; var description = dialog.Description; UpdateProject(name, author, description); Console.WriteLine(@"Project {0} edited.", Project.Name); } }