/// <exception cref="ArgumentNullException"> /// <paramref name="project"/> is null. /// </exception> public bool SaveProjectAs(Project project) { if (project == null) throw new ArgumentNullException("project"); using (SaveFileDialog dialog = new SaveFileDialog()) { dialog.FileName = project.Name; dialog.InitialDirectory = project.GetProjectDirectory(); dialog.Filter = Strings.NClassProjectFiles + " (*.ncp)|*.ncp"; if (dialog.ShowDialog() == DialogResult.OK) { try { project.Save(dialog.FileName); Settings.Default.AddRecentFile(project.FilePath); return true; } catch (Exception ex) { MessageBox.Show(Strings.Error + ": " + ex.Message, Strings.SaveAs, MessageBoxButtons.OK, MessageBoxIcon.Error); } } return false; } }
/// <exception cref="ArgumentNullException"> /// <paramref name="project"/> is null. /// </exception> public bool SaveProject(Project project) { if (project == null) throw new ArgumentNullException("project"); if (project.FilePath == null || project.IsReadOnly) { return SaveProjectAs(project); } else { try { project.Save(); return true; } catch (Exception ex) { MessageBox.Show(Strings.Error + ": " + ex.Message, Strings.SaveAs, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } } }