コード例 #1
0
        /// <summary>
        /// This method is executed when action is selected in the context menu.
        /// </summary>
        public void Invoke()
        {
            bool succeeded;

            switch (action)
            {
            case DictionaryAction.IgnoreOnce:
                dictionary.IgnoreWordOnce(span);
                succeeded = true;
                break;

            case DictionaryAction.IgnoreAll:
                succeeded = dictionary.IgnoreWord(span.GetText(span.TextBuffer.CurrentSnapshot));
                break;

            default:
                succeeded = dictionary.AddWordToDictionary(span.GetText(span.TextBuffer.CurrentSnapshot));
                break;
            }

            Debug.Assert(succeeded, "Call to modify dictionary was unsuccessful");
        }
コード例 #2
0
        //=====================================================================

        /// <inheritdoc />
        public override void Invoke(CancellationToken cancellationToken)
        {
            bool succeeded;

            switch (action)
            {
            case DictionaryAction.IgnoreOnce:
                dictionary.IgnoreWordOnce(this.Span);
                succeeded = true;
                break;

            case DictionaryAction.IgnoreAll:
                succeeded = dictionary.IgnoreWord(this.Span.GetText(this.Span.TextBuffer.CurrentSnapshot));
                break;

            default:
                succeeded = dictionary.AddWordToDictionary(this.Span.GetText(
                                                               this.Span.TextBuffer.CurrentSnapshot), culture);
                break;
            }

            Debug.Assert(succeeded, "Call to modify dictionary was unsuccessful");
        }
コード例 #3
0
 /// <summary>
 /// Add the word to the dictionary
 /// </summary>
 /// <param name="culture">The culture of the dictionary to which the word is added</param>
 private void AddToDictionary(CultureInfo culture)
 {
     dictionary.AddWordToDictionary(selectedMisspelling.Word, culture);
     textBox.RaiseEvent(new TextChangedEventArgs(TextBox.TextChangedEvent, UndoAction.None));
 }