示例#1
0
        private bool ConfirmModelSaved()
        {
            bool cont = true;

            if (_model != null && _model.IsModified)
            {
                string text = "The current model has some unsaved changes." +
                              Environment.NewLine + Environment.NewLine +
                              "Do you wish to save the model before continuing ?";

                DialogResult dr = MessageBox.Show(text, "Unsaved changes",
                                                  MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

                if (dr.Equals(DialogResult.Yes))
                {
                    ICommand cmd = new CommandSave(_model);
                    cmd.Execute(null);
                }
                else if (dr.Equals(DialogResult.Cancel))
                {
                    cont = false;
                }
                // else No - cont  true;
            }

            return(cont);
        }
示例#2
0
        private static void SelectOwnerImpl(FlatDecoratorViewModel flatDecorator)
        {
            Window window = Extensions.WindowExtensions.CreateEmptyVerticalWindow();

            window.MakeSticky();

            AborigenDecoratorViewModel selectedDecorator = null;

            void SelectView_OntAborigenSelected(AborigenDecoratorViewModel decorator)
            {
                selectedDecorator   = decorator;
                window.DialogResult = true;
            }

            var selectView = new SelectAborigenView();

            selectView.EventAborigenSelected += SelectView_OntAborigenSelected;
            window.Title = Resources.AborigensSelection;
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            window.Owner   = Application.Current.MainWindow;
            window.Content = selectView;
            window.ShowDialog();

            selectView.EventAborigenSelected -= SelectView_OntAborigenSelected;
            if (selectedDecorator != null)
            {
                flatDecorator.SetOwner(selectedDecorator);
                CommandSave.RaiseCanExecuteChanged();
            }
        }
示例#3
0
        private void LoadCommands()
        {
            CommandOpen = ReactiveCommand.Create(Observable.Return(true));
            CommandOpen.Subscribe(_ => ExecuteOpen());

            CommandSave = ReactiveCommand.Create(Observable.Return(true));
            CommandSave.Subscribe(_ => ExecuteSave());

            CommandSaveAs = ReactiveCommand.Create(Observable.Return(true));
            CommandSaveAs.Subscribe(_ => ExecuteSaveAs());

            CommandExit = ReactiveCommand.Create(Observable.Return(true));
            CommandExit.Subscribe(_ => ExecuteExit());
        }
示例#4
0
        private void MainView_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (_model != null && _model.IsModified)
            {
                string text = "The current model has some unsaved changes." +
                              Environment.NewLine + Environment.NewLine +
                              "Do you wish to save your changes now ? " +
                              Environment.NewLine + Environment.NewLine +
                              "They will be lost if you click No";

                DialogResult dr = MessageBox.Show(text, "DSM - Saved changes ?",
                                                  MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (dr.Equals(DialogResult.Yes))
                {
                    ICommand cmd = new CommandSave(_model);
                    cmd.Execute(null);
                }
            }
        }
示例#5
0
        private void DoProjectSave()
        {
            ICommand cmd = new CommandSave(_model);

            CursorStateHelper csh = new CursorStateHelper(this, Cursors.WaitCursor);

            Refresh();

            try
            {
                cmd.Execute(null);
            }
            catch (Exception ex)
            {
                ErrorDialog.Show(ex.ToString());
            }
            finally
            {
                csh.Reset();
            }
        }
示例#6
0
        public void Save()
        {
            var cmd = new CommandSave();

            cmd.Execute();
        }