예제 #1
0
        // Handle the case where the user opens a new code document / switches to a different code document.
        int IVsRunningDocTableEvents.OnBeforeDocumentWindowShow(uint docCookie, int isFirstShow, IVsWindowFrame vsWindowFrame)
        {
            if (IsVisible && isFirstShow == 0)
            {
                var wpfTextView = vsWindowFrame.ToWpfTextView();
                if (wpfTextView != null)
                {
                    var contentType = wpfTextView.TextBuffer.ContentType;
                    if (contentType.IsOfType(VisualBasicContentType) ||
                        contentType.IsOfType(CSharpContentType))
                    {
                        Clear();
                        activeWpfTextView = wpfTextView;
                        activeWpfTextView.Selection.SelectionChanged += HandleSelectionChanged;
                        activeWpfTextView.TextBuffer.Changed         += HandleTextBufferChanged;
                        activeWpfTextView.LostAggregateFocus         += HandleTextViewLostFocus;

                        var classificationFormatMapService = GetMefService <IClassificationFormatMapService>();
                        var editorFormatMapService         = GetMefService <IEditorFormatMapService>();
                        activeClassificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(activeWpfTextView);
                        activeClassificationFormatMap.ClassificationFormatMappingChanged += HandleFormatMappingChanged;
                        activeEditorFormatMap = editorFormatMapService.GetEditorFormatMap(activeWpfTextView);
                        activeEditorFormatMap.FormatMappingChanged += HandleFormatMappingChanged;

                        UpdateThemedColors();
                        RefreshSyntaxVisualizer();
                    }
                }
            }

            return(VSConstants.S_OK);
        }
예제 #2
0
 int IVsRunningDocTableEvents.OnBeforeDocumentWindowShow(uint docCookie, int isFirstShow, IVsWindowFrame vsWindowFrame)
 {
     if (isFirstShow == 0)
     {
         WpfTextView = vsWindowFrame.ToWpfTextView();
     }
     return(0);
 }
예제 #3
0
        // Handle the case where the user closes the current code document / switches to a different code document.
        int IVsRunningDocTableEvents.OnAfterDocumentWindowHide(uint docCookie, IVsWindowFrame vsWindowFrame)
        {
            if (IsVisible && activeWpfTextView != null)
            {
                var wpfTextView = vsWindowFrame.ToWpfTextView();
                if (wpfTextView == activeWpfTextView)
                {
                    Clear();
                }
            }

            return(VSConstants.S_OK);
        }
예제 #4
0
        // Handle the case where the user opens a new code document / switches to a different code document.
        int IVsRunningDocTableEvents.OnBeforeDocumentWindowShow(uint docCookie, int isFirstShow, IVsWindowFrame vsWindowFrame)
        {
            if (IsVisible && isFirstShow == 0)
            {
                var wpfTextView = vsWindowFrame.ToWpfTextView();
                if (wpfTextView != null)
                {
                    var contentType = wpfTextView.TextBuffer.ContentType;
                    if (contentType.IsOfType(ContentTypeNames.VisualBasicContentType) ||
                        contentType.IsOfType(ContentTypeNames.CSharpContentType))
                    {
                        Clear();
                        activeWpfTextView = wpfTextView;
                        activeWpfTextView.Selection.SelectionChanged += HandleSelectionChanged;
                        activeWpfTextView.TextBuffer.Changed         += HandleTextBufferChanged;
                        RefreshSyntaxVisualizer();
                    }
                }
            }

            return(VSConstants.S_OK);
        }