示例#1
0
        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();
        }
示例#2
0
 public void Save()
 {
     DiskStorage.SaveToDisk(FilePath, this);
     if (OnPersisted != null)
     {
         OnPersisted(this, EventArgs.Empty);
     }
 }
示例#3
0
 private void SaveProjectFile()
 {
     if (string.IsNullOrWhiteSpace(CurrentProjectFile))
     {
         SaveAsProjectFile();
     }
     else
     {
         DiskStorage.SaveToDisk <ProjectConfiguration>(CurrentProjectFile, Project.GetConfiguration());
         Project.Levels.ForEach(l => l.Save());
     }
 }
示例#4
0
        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();
            }
        }
示例#5
0
        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();
        }
示例#6
0
 private void ux_SaveProjectMenu_Click(object sender, EventArgs e)
 {
     DiskStorage.SaveToDisk(CurrentProjectFile, Project.GetConfiguration());
     Project.Levels.ForEach(l => l.Save());
 }