コード例 #1
0
ファイル: App.xaml.cs プロジェクト: DelBero/XnaScrapEdit
 public void newProject(NewProjectData data)
 {
     CurrentProject = new Project(data.Name);
     CurrentProject.ProjectDirectory = data.Directory;
     CurrentProject.ExportDirectory = data.ExportDirectory;
     CurrentProject.Exporter = data.Exporter;
     CurrentProject.ConfigFile = data.ConfigFile;
     Config.saveAs(CurrentProject.ConfigFile);
     Directory.SetCurrentDirectory(data.Directory);
     saveCurrentProject();
     ProjectChanged(this, new PropertyChangedEventArgs("CurrentProject"));
 }
コード例 #2
0
        private void New_Executed_Project(object sender, ExecutedRoutedEventArgs e)
        {
            App app = (App)App.Current;
            if (app.CurrentProject != null)
            {
                MessageBoxResult res = MessageBox.Show("Save Project?", "Close Project", MessageBoxButton.YesNoCancel);
                if (res == MessageBoxResult.Cancel)
                {
                    return;
                }
                app.closeProject(res == MessageBoxResult.OK);
            }

            NewProjectWindow ProjectWindow = NewProjectWindow.GetInstance();
            NewProjectData data = new NewProjectData(app);
            data.Name = "Project1";
            data.Directory = ".";
            ProjectWindow.DataContext = data;
            bool? result = ProjectWindow.ShowDialog();
            if (result.HasValue)
            {
                if (result.Value)
                {
                    app.newProject(data);
                }
            }
        }