public int OnAfterDocumentWindowHide(uint docCookie, IVsWindowFrame pFrame)
 {
     if (IsVisible && _activeWpfTextView != null && pFrame.GetWpfTextView() == _activeWpfTextView)
     {
         Clear();
     }
     return(VSConstants.S_OK);
 }
 int IVsRunningDocTableEvents.OnBeforeDocumentWindowShow(uint docCookie, int fFirstShow, IVsWindowFrame pFrame)
 {
     if (IsVisible && fFirstShow == 0)
     {
         var wpfTextView = pFrame.GetWpfTextView();
         if (wpfTextView != null)
         {
             var contentType = wpfTextView.TextBuffer.ContentType;
             if (contentType.IsOfType(HlslConstants.ContentTypeName))
             {
                 Clear();
                 _activeWpfTextView = wpfTextView;
                 _activeWpfTextView.Selection.SelectionChanged += HandleSelectionChanged;
                 _activeWpfTextView.TextBuffer.Changed         += HandleTextBufferChanged;
                 _activeWpfTextView.LostAggregateFocus         += HandleTextViewLostFocus;
                 RefreshSyntaxVisualizer();
             }
         }
     }
     return(VSConstants.S_OK);
 }
 int IVsRunningDocTableEvents.OnBeforeDocumentWindowShow(uint docCookie, int fFirstShow, IVsWindowFrame pFrame)
 {
     if (IsVisible && fFirstShow == 0)
     {
         var wpfTextView = pFrame.GetWpfTextView();
         if (wpfTextView != null)
         {
             var contentType = wpfTextView.TextBuffer.ContentType;
             if (contentType.IsOfType(HlslConstants.ContentTypeName))
             {
                 Clear();
                 _activeWpfTextView = wpfTextView;
                 _activeWpfTextView.Selection.SelectionChanged += HandleSelectionChanged;
                 _activeWpfTextView.TextBuffer.Changed += HandleTextBufferChanged;
                 _activeWpfTextView.LostAggregateFocus += HandleTextViewLostFocus;
                 RefreshSyntaxVisualizer();
             }
         }
     }
     return VSConstants.S_OK;
 }
 public int OnAfterDocumentWindowHide(uint docCookie, IVsWindowFrame pFrame)
 {
     if (IsVisible && _activeWpfTextView != null && pFrame.GetWpfTextView() == _activeWpfTextView)
         Clear();
     return VSConstants.S_OK;
 }