Пример #1
0
        /// <summary>
        /// Add the given word to the dictionary so that it will no longer show up as an incorrect spelling
        /// </summary>
        /// <param name="word">The word to add to the dictionary.</param>
        /// <returns><c>true</c> if the word was successfully added to the dictionary, even if it was already in
        /// the dictionary.</returns>
        public bool AddWordToDictionary(string word)
        {
            if (String.IsNullOrWhiteSpace(word))
            {
                return(false);
            }

            return(this.ShouldIgnoreWord(word) || globalDictionary.AddWordToDictionary(word));
        }
Пример #2
0
        /// <inheritdoc />
        public bool AddWordToDictionary(string word)
        {
            if (String.IsNullOrWhiteSpace(word))
            {
                return(false);
            }

            foreach (var dictionary in bufferSpecificDictionaries)
            {
                if (dictionary.AddWordToDictionary(word))
                {
                    return(true);
                }
            }

            return(globalDictionary.AddWordToDictionary(word));
        }
Пример #3
0
        /// <summary>
        /// Add the given word to the dictionary so that it will no longer show up as an incorrect spelling
        /// </summary>
        /// <param name="word">The word to add to the dictionary.</param>
        /// <param name="culture">The culture of the dictionary to which the word is added or null to add it to
        /// the first dictionary.</param>
        /// <returns><c>true</c> if the word was successfully added to the dictionary, even if it was already in
        /// the dictionary.</returns>
        public bool AddWordToDictionary(string word, CultureInfo culture)
        {
            GlobalDictionary dictionary = null;

            if (String.IsNullOrWhiteSpace(word))
            {
                return(false);
            }

            if (culture != null)
            {
                dictionary = this.Dictionaries.FirstOrDefault(d => d.Culture == culture);
            }

            if (dictionary == null)
            {
                dictionary = this.Dictionaries.First();
            }

            return(this.ShouldIgnoreWord(word) || dictionary.AddWordToDictionary(word));
        }