public void ShowCancelButton(Action onCancel, string message)
        {
            var newWaitAdorner = new WaitAdorner(onCancel, message);

            CurrentWaitAdorner = newWaitAdorner;

            // Prevents flickering when decompiling small classes
            newWaitAdorner.BeginAnimation(OpacityProperty, new DoubleAnimation(0, 1, new Duration(TimeSpan.FromSeconds(0.5)), FillBehavior.Stop));

            newWaitAdorner.MouseDown += (s, e) => e.Handled = true;
            newWaitAdorner.MouseUp   += (s, e) => e.Handled = true;
            newWaitAdorner.button.IsVisibleChanged += (s, e) => {
                if (newWaitAdorner != CurrentWaitAdorner)
                {
                    return;
                }
                if (newWaitAdorner.button.IsVisible && IsKeyboardFocusWithin)
                {
                    newWaitAdorner.button.Focus();
                }
            };

            if (IsKeyboardFocusWithin)
            {
                newWaitAdorner.button.Focus();
            }
        }
 public void Clear()
 {
     CurrentWaitAdorner = null;
     cachedColorsList.Clear();
     currentContent          = new CurrentContent(emptyContent, defaultContentType);
     spanReferenceCollection = SpanDataCollection <ReferenceAndId> .Empty;
     wpfTextViewHost.TextView.TextBuffer.Replace(new Span(0, wpfTextViewHost.TextView.TextBuffer.CurrentSnapshot.Length), string.Empty);
 }
        public void HideCancelButton()
        {
            var  currentWaitAdorner  = CurrentWaitAdorner;
            bool waitAdornerHasFocus = currentWaitAdorner?.IsKeyboardFocusWithin ?? false;

            CurrentWaitAdorner = null;
            if (waitAdornerHasFocus)
            {
                textEditorHelper.SetFocus();
            }
        }