protected override void OnClosed(WindowClosedEventArgs args)
        {
            base.OnClosed(args);

            this.spellCheckingUIManager = null;
            this.Owner = null;
        }
        private void ShowDialogInternal(SpellCheckingUIManager spellCheckingUIManager, RadRichTextBox owner)
        {
            this.spellCheckingUIManager = spellCheckingUIManager;
            this.SetOwner(owner);

            if (this.TryLoadIncorrectSentence())
            {
                this.buttonEditCustomDictionary.IsEnabled = spellCheckingUIManager.HasCustomDictionary();
                this.ShowDialog();
            }
        }
        private void ShowDialogInternal(SpellCheckingUIManager spellCheckingUIManager, RadRichTextBox owner)
        {
            this.spellCheckingUIManager = spellCheckingUIManager;
            this.SetOwner(owner);

            if (this.TryLoadIncorrectSentence())
            {
                this.buttonEditCustomDictionary.IsEnabled = spellCheckingUIManager.HasCustomDictionary();
                this.ShowDialog();
            }
        }
        /// <summary>
        /// Raises the <see cref="E:Closed"/> event.
        /// </summary>
        /// <param name="args">
        /// The <see cref="T:Telerik.Windows.Controls.WindowClosedEventArgs"/> instance containing the event data.
        /// </param>
        protected override void OnClosed(WindowClosedEventArgs args)
        {
            base.OnClosed(args);

            if (_richTextBox != null)
            {
                _richTextBox.Document.Selection.Clear();
            }

            _spellCheckingUIManager = null;
            _richTextBox = null;
            Owner = null;

            if (_tcs != null)
            {
                var isCanceled = DialogResult != true;
                _tcs.TrySetResult(new SpellCheckingResult(isCanceled));
            }
        }
        private Task<SpellCheckingResult> ShowDialogInternal(SpellCheckingUIManager spellCheckingUIManager, RadRichTextBox owner)
        {
            DialogResult = null;
            _tcs = new TaskCompletionSource<SpellCheckingResult>();
            _spellCheckingUIManager = spellCheckingUIManager;
            _richTextBox = owner;
            SetOwner(owner);
            
            if (TryLoadIncorrectSentence(true))
            {
                ButtonEditCustomDictionary.IsEnabled = spellCheckingUIManager.HasCustomDictionary();

                _selectedCulture = SpellCheck.GetCulture(_richTextBox);
                OnPropertyChanged("SelectedCulture");

                LoadAvailableCultures();

                ShowDialog();
            }
            else
            {
                _tcs.TrySetResult(new SpellCheckingResult(false));
            }

            return _tcs.Task;
        }
 /// <summary>
 /// Shows the dialog.
 /// </summary>
 /// <param name="spellCheckingUIManager">
 /// The spellchecking UI manager.
 /// </param>
 /// <param name="owner">
 /// The owner of the dialog.
 /// </param>
 /// <returns>
 /// A task that completes when the window is closed.
 /// </returns>
 public async Task<SpellCheckingResult> ShowDialog(SpellCheckingUIManager spellCheckingUIManager, RadRichTextBox owner)
 {
     return await ShowDialogInternal(spellCheckingUIManager, owner);
 }
        async void ISpellCheckingDialog.ShowDialog(SpellCheckingUIManager spellCheckingUIManager, RadRichTextBox owner)
        {
            var result = await ShowDialog(spellCheckingUIManager, owner);

            if (!result.IsCanceled)
                AlertForCompletion();
        }
        private void ButtonIgnore_Click(object sender, RoutedEventArgs e)
        {
            var spellCheckingManager = new SpellCheckingUIManager(RtbSpellCheckingContext);
            spellCheckingManager.IgnoreCurrentWord();

            TryLoadIncorrectSentence(true);
        }
 /// <summary>
 /// Shows the dialog.
 /// </summary>
 /// <param name="spellCheckingUIManager">The spellchecking UI manager.</param>
 /// <param name="owner">The owner of the dialog.</param>
 public void ShowDialog(SpellCheckingUIManager spellCheckingUIManager, RadRichTextBox owner)
 {
     this.ShowDialogInternal(spellCheckingUIManager, owner);
 }
 /// <summary>
 /// Shows the dialog.
 /// </summary>
 /// <param name="spellCheckingUIManager">The spellchecking UI manager.</param>
 /// <param name="owner">The owner of the dialog.</param>
 public void ShowDialog(SpellCheckingUIManager spellCheckingUIManager, RadRichTextBox owner)
 {
     this.ShowDialogInternal(spellCheckingUIManager, owner);
 }
        protected override void OnClosed(WindowClosedEventArgs args)
        {
            base.OnClosed(args);

            this.spellCheckingUIManager = null;
            this.Owner = null;
        }