コード例 #1
0
        private void EditNetSpellLoad(object sender, EventArgs e)
        {
            MistakeFont = new Font(TextBox.Font, FontStyle.Underline);
            TextBoxFont = TextBox.Font;
            ShowWatermark();

            components = new Container();
            _spelling  =
                new Spelling(components)
            {
                ShowDialog            = false,
                IgnoreAllCapsWords    = true,
                IgnoreWordsWithDigits = true
            };

            _autoCompleteListTask.ContinueWith(
                w => _spelling.AddAutoCompleteWords(w.Result.Select(x => x.Word)),
                _autoCompleteCancellationTokenSource.Token,
                TaskContinuationOptions.NotOnCanceled,
                TaskScheduler.FromCurrentSynchronizationContext()
                );
            //
            // spelling
            //
            _spelling.ReplacedWord   += SpellingReplacedWord;
            _spelling.DeletedWord    += SpellingDeletedWord;
            _spelling.MisspelledWord += SpellingMisspelledWord;

            //
            // wordDictionary
            //
            LoadDictionary();
        }
コード例 #2
0
        protected override void OnRuntimeLoad(EventArgs e)
        {
            base.OnRuntimeLoad(e);

            _customUnderlines         = new SpellCheckEditControl(TextBox);
            TextBox.SelectionChanged += TextBox_SelectionChanged;
            TextBox.TextChanged      += TextBoxTextChanged;

            EnabledChanged += EditNetSpellEnabledChanged;

            ShowWatermark();

            components = new Container();
            _spelling  = new Spelling(components)
            {
                ShowDialog            = false,
                IgnoreAllCapsWords    = true,
                IgnoreWordsWithDigits = true
            };

            if (AppSettings.ProvideAutocompletion)
            {
                InitializeAutoCompleteWordsTask();
                _autoCompleteListTask.ContinueWith(
                    w =>
                {
                    _spelling.AddAutoCompleteWords(w.Result.Select(x => x.Word));
                    w.Dispose();
                },
                    _autoCompleteCancellationTokenSource.Token,
                    TaskContinuationOptions.NotOnCanceled,
                    TaskScheduler.FromCurrentSynchronizationContext());
            }

            //
            // spelling
            //
            _spelling.ReplacedWord   += SpellingReplacedWord;
            _spelling.DeletedWord    += SpellingDeletedWord;
            _spelling.MisspelledWord += SpellingMisspelledWord;

            //
            // wordDictionary
            //
            LoadDictionary();

            SpellCheckTimer.Enabled = true;
        }