Exemplo n.º 1
0
        // Token: 0x060038DA RID: 14554 RVA: 0x00100F68 File Offset: 0x000FF168
        private static void OnQueryStatusSpellingError(object target, CanExecuteRoutedEventArgs args)
        {
            TextEditor textEditor = TextEditor._GetTextEditor(target);

            if (textEditor == null)
            {
                return;
            }
            SpellingError spellingErrorAtSelection = TextEditorSpelling.GetSpellingErrorAtSelection(textEditor);

            args.CanExecute = (spellingErrorAtSelection != null);
        }
Exemplo n.º 2
0
        // Token: 0x060038D9 RID: 14553 RVA: 0x00100F3C File Offset: 0x000FF13C
        private static void OnIgnoreSpellingError(object target, ExecutedRoutedEventArgs args)
        {
            TextEditor textEditor = TextEditor._GetTextEditor(target);

            if (textEditor == null)
            {
                return;
            }
            SpellingError spellingErrorAtSelection = TextEditorSpelling.GetSpellingErrorAtSelection(textEditor);

            if (spellingErrorAtSelection == null)
            {
                return;
            }
            spellingErrorAtSelection.IgnoreAll();
        }
Exemplo n.º 3
0
        // Token: 0x060038D7 RID: 14551 RVA: 0x00100D38 File Offset: 0x000FEF38
        private static void OnCorrectSpellingError(object target, ExecutedRoutedEventArgs args)
        {
            TextEditor textEditor = TextEditor._GetTextEditor(target);

            if (textEditor == null)
            {
                return;
            }
            string text = args.Parameter as string;

            if (text == null)
            {
                return;
            }
            SpellingError spellingErrorAtSelection = TextEditorSpelling.GetSpellingErrorAtSelection(textEditor);

            if (spellingErrorAtSelection == null)
            {
                return;
            }
            using (textEditor.Selection.DeclareChangeBlock())
            {
                ITextPointer textPointer;
                ITextPointer position;
                bool         flag = TextEditorSpelling.IsErrorAtNonMergeableInlineEdge(spellingErrorAtSelection, out textPointer, out position);
                ITextPointer textPointer2;
                if (flag && textPointer is TextPointer)
                {
                    ((TextPointer)textPointer).DeleteTextInRun(textPointer.GetOffsetToPosition(position));
                    textPointer.InsertTextInRun(text);
                    textPointer2 = textPointer.CreatePointer(text.Length, LogicalDirection.Forward);
                }
                else
                {
                    textEditor.Selection.Select(spellingErrorAtSelection.Start, spellingErrorAtSelection.End);
                    if (textEditor.AcceptsRichContent)
                    {
                        ((TextSelection)textEditor.Selection).SpringloadCurrentFormatting();
                    }
                    XmlLanguage xmlLanguage = (XmlLanguage)spellingErrorAtSelection.Start.GetValue(FrameworkElement.LanguageProperty);
                    textEditor.SetSelectedText(text, xmlLanguage.GetSpecificCulture());
                    textPointer2 = textEditor.Selection.End;
                }
                textEditor.Selection.Select(textPointer2, textPointer2);
            }
        }