Example #1
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="globalDictionary">The global dictionary</param>
        /// <param name="ignoredWords">An optional enumerable list of ignored words</param>
        public SpellingDictionary(GlobalDictionary globalDictionary, IEnumerable <string> ignoredWords)
        {
            this.globalDictionary = globalDictionary;
            this.ignoredWords     = (ignoredWords ?? Enumerable.Empty <string>());

            // Register to receive events when the global dictionary is updated
            globalDictionary.RegisterSpellingDictionaryService(this);
        }
Example #2
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="bufferSpecificDictionaries">A list of buffer-specific dictionaries</param>
        /// <param name="globalDictionary">The global dictionary</param>
        public SpellingDictionaryService(IList <ISpellingDictionary> bufferSpecificDictionaries,
                                         GlobalDictionary globalDictionary)
        {
            this.globalDictionary           = globalDictionary;
            this.bufferSpecificDictionaries = bufferSpecificDictionaries;

            // TODO: This never gets disconnected and would probably keep this instance alive, right?  Probably
            // should switch to something like RegisterSpellingDictionaryService used by global dictionary.
            // Perhaps make that method part of the ISpellingDictionary interface?  Need to test it once a
            // buffer-specific class is actually implemented.
            foreach (var dictionary in bufferSpecificDictionaries)
            {
                dictionary.DictionaryUpdated += this.BufferSpecificDictionaryUpdated;
            }

            // Register to receive events when the global dictionary is updated
            globalDictionary.RegisterSpellingDictionaryService(this);
        }