private void ux_NewProjectMenu_Click(object sender, EventArgs e) { if (Project != null) { var result = MessageBox.Show("Do you want to save changes to the current project?", "Save Changes?", MessageBoxButtons.YesNoCancel); if (result == DialogResult.Yes) { DiskStorage.SaveToDisk(CurrentProjectFile, Project); Project.Levels.ForEach(l => l.Save()); } if (result == DialogResult.Cancel) { return; } } // ask the user to pick a new project file var projectNameResult = ux_SaveProjectDialog.ShowDialog(); if (projectNameResult == DialogResult.OK) { CurrentProjectFile = ux_SaveProjectDialog.FileName; } Project = new Project(); }
public void Save() { DiskStorage.SaveToDisk(FilePath, this); if (OnPersisted != null) { OnPersisted(this, EventArgs.Empty); } }
private void SaveProjectFile() { if (string.IsNullOrWhiteSpace(CurrentProjectFile)) { SaveAsProjectFile(); } else { DiskStorage.SaveToDisk <ProjectConfiguration>(CurrentProjectFile, Project.GetConfiguration()); Project.Levels.ForEach(l => l.Save()); } }
private void SaveAsProjectFile() { var saveFileDialog = new SaveFileDialog(); saveFileDialog.InitialDirectory = _settings.OpenProjectLastDirectoryPath; saveFileDialog.Filter = "FragEd Project|*.fed|All Files (*.*)|*.*"; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { CurrentProjectFile = saveFileDialog.FileName; DiskStorage.SaveToDisk <ProjectConfiguration>(CurrentProjectFile, Project.GetConfiguration()); UpdateUserInterface(); } }
private void ux_OpenProjectMenu_Click(object sender, EventArgs e) { if (Project != null) { var result = MessageBox.Show("Do you want to save changes to the current project?", "Save Changes?", MessageBoxButtons.YesNoCancel); if (result == DialogResult.Yes) { DiskStorage.SaveToDisk(CurrentProjectFile, Project); Project.Levels.ForEach(l => l.Save()); } if (result == DialogResult.Cancel) { return; } } ux_OpenProjectDialog.ShowDialog(); }
private void ux_SaveProjectMenu_Click(object sender, EventArgs e) { DiskStorage.SaveToDisk(CurrentProjectFile, Project.GetConfiguration()); Project.Levels.ForEach(l => l.Save()); }