Example #1
0
        private void MenuEditInvertSelection_Click(object sender, System.EventArgs e)
        {
            if (AppWorkspace.ActiveDocumentWorkspace != null &&
                !AppWorkspace.ActiveDocumentWorkspace.Selection.IsEmpty)
            {
                HistoryFunctionResult result = AppWorkspace.ActiveDocumentWorkspace.ExecuteFunction(new InvertSelectionFunction());

                // Make sure that the selection info shows up in the status bar, and not the tool's help text
                if (result == HistoryFunctionResult.Success)
                {
                    AppWorkspace.ActiveDocumentWorkspace.Selection.PerformChanging();
                    AppWorkspace.ActiveDocumentWorkspace.Selection.PerformChanged();
                }
            }
        }
Example #2
0
        public bool PerformAction()
        {
            HistoryFunctionResult hfr = this.documentWorkspace.ExecuteFunction(new AddNewBlankLayerFunction());

            if (hfr == HistoryFunctionResult.Success)
            {
                PasteAction pa     = new PasteAction(this.documentWorkspace);
                bool        result = pa.PerformAction();

                if (!result)
                {
                    using (new WaitCursorChanger(this.documentWorkspace))
                    {
                        this.documentWorkspace.History.StepBackward();
                    }
                }
                else
                {
                    return(true);
                }
            }

            return(false);
        }