Save() публичный Метод

/// Could not save the project. /// /// The project was not saved before by the method. ///
public Save ( ) : void
Результат void
Пример #1
0
		/// <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;
			}
		}
Пример #2
0
		/// <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;
				}
			}
		}