Esempio n. 1
0
        public bool ExecuteDialogKey(Keys keyData)
        {
            // try, if a dialog key processor was set to use this
            if (DoProcessDialogKey != null && DoProcessDialogKey(keyData))
            {
                return(true);
            }

            // if not (or the process was 'silent', use the standard edit actions
            IEditAction action = motherTextEditorControl.GetEditAction(keyData);

            AutoClearSelection = true;
            if (action != null)
            {
                motherTextEditorControl.BeginUpdate();
                try
                {
                    lock (Document)
                    {
                        action.Execute(this);
                        if (SelectionManager.HasSomethingSelected && AutoClearSelection /*&& caretchanged*/)
                        {
                            if (Document.TextEditorProperties.DocumentSelectionMode == DocumentSelectionMode.Normal)
                            {
                                SelectionManager.ClearSelection();
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Got Exception while executing action " + action + " : " + e.ToString());
                }
                finally
                {
                    motherTextEditorControl.EndUpdate();
                    Caret.UpdateCaretPosition();
                }
                return(true);
            }
            return(false);
        }