コード例 #1
0
        private void SaveContext(string path)
        {
            // Check if already a path to save was set, otherwise request.
            if (string.IsNullOrEmpty(path))
            {
                // Configure save file dialog box
                SaveFileDialog dlg = new SaveFileDialog
                {
                    FileName   = this.Context.ProjectSettings.Name,
                    DefaultExt = EditorContext.ProjectExtension,
                    Filter     = string.Format("Blueprint Editor Projects|*.{0}", EditorContext.ProjectExtension)
                };

                // Show save file dialog box
                bool?result = dlg.ShowDialog();

                // Process save file dialog box results
                if (result == false)
                {
                    return;
                }

                // Save document
                path = dlg.FileName;
            }

            // Show progress bar.
            this.progressWindow = new ProgressWindow();
            this.progressWindow.Show("Saving project...");

            // Save context.
            this.Context.SerializationPath = path;

            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork             += this.BackgroundSaveContext;
            worker.RunWorkerCompleted += this.BackgroundSaveContextCompleted;
            worker.RunWorkerAsync(this.Context);
        }
コード例 #2
0
        private void SaveContext(string path)
        {
            // Check if already a path to save was set, otherwise request.
            if (string.IsNullOrEmpty(path))
            {
                // Configure save file dialog box
                SaveFileDialog dlg = new SaveFileDialog
                    {
                        FileName = this.Context.ProjectSettings.Name,
                        DefaultExt = EditorContext.ProjectExtension,
                        Filter = string.Format("Blueprint Editor Projects|*.{0}", EditorContext.ProjectExtension)
                    };

                // Show save file dialog box
                bool? result = dlg.ShowDialog();

                // Process save file dialog box results 
                if (result == false)
                {
                    return;
                }

                // Save document 
                path = dlg.FileName;
            }

            // Show progress bar.
            this.progressWindow = new ProgressWindow();
            this.progressWindow.Show("Saving project...");

            // Save context.
            this.Context.SerializationPath = path;

            BackgroundWorker worker = new BackgroundWorker();
            worker.DoWork += this.BackgroundSaveContext;
            worker.RunWorkerCompleted += this.BackgroundSaveContextCompleted;
            worker.RunWorkerAsync(this.Context);
        }
コード例 #3
0
        private void LoadProject(string filename)
        {
            // Show progress bar.
            this.progressWindow = new ProgressWindow();
            this.progressWindow.Show("Loading project...");

            // Load data.
            BackgroundWorker worker = new BackgroundWorker();
            worker.DoWork += this.BackgroundLoadContext;
            worker.RunWorkerCompleted += this.BackgroundLoadContextCompleted;
            worker.RunWorkerAsync(new BackgroundLoadContextData { Context = this.Context, Filename = filename });
        }