private void UpdateTextViewIfRequired(IWpfTextView wpfTextView) { var contentType = wpfTextView.TextBuffer.ContentType; IWpfTextView oldValue; if (_textViews.TryGetValue(contentType, out oldValue) && oldValue.Equals(wpfTextView)) { return; } _textViews[contentType] = wpfTextView; LastActiveTextViewChanged?.Invoke(this, new ActiveTextViewChangedEventArgs(oldValue, wpfTextView)); }
public void OnActiveFrameChanged(IVsWindowFrame oldFrame, IVsWindowFrame newFrame) { var oldTextView = GetWpfTextView(oldFrame); if (oldTextView != null) { UpdateTextViewIfRequired(oldTextView); } var newTextView = GetWpfTextView(newFrame); if (newTextView != null) { UpdateTextViewIfRequired(newTextView); } LastActiveTextViewChanged?.Invoke(this, new ActiveTextViewChangedEventArgs(oldTextView, newTextView)); }