本文整理汇总了C#中IVsCodeWindow.GetLastActiveView方法的典型用法代码示例。如果您正苦于以下问题:C# IVsCodeWindow.GetLastActiveView方法的具体用法?C# IVsCodeWindow.GetLastActiveView怎么用?C# IVsCodeWindow.GetLastActiveView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVsCodeWindow
的用法示例。
在下文中一共展示了IVsCodeWindow.GetLastActiveView方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EditorNavigationDropdownBarClient
public EditorNavigationDropdownBarClient(IVsCodeWindow codeWindow, IVsEditorAdaptersFactoryService editorAdaptersFactory, EditorNavigationSource source, IBufferGraphFactoryService bufferGraphFactoryService)
{
_codeWindow = codeWindow;
_editorAdaptersFactory = editorAdaptersFactory;
_source = source;
_bufferGraphFactoryService = bufferGraphFactoryService;
_currentTextView = editorAdaptersFactory.GetWpfTextView(codeWindow.GetLastActiveView());
_dispatcher = _currentTextView.VisualElement.Dispatcher;
_imageList = new ImageList
{
ColorDepth = ColorDepth.Depth32Bit
};
var connectionPointContainer = codeWindow as IConnectionPointContainer;
if (connectionPointContainer != null)
{
var textViewEventsGuid = typeof(IVsCodeWindowEvents).GUID;
IConnectionPoint connectionPoint;
connectionPointContainer.FindConnectionPoint(ref textViewEventsGuid, out connectionPoint);
connectionPoint?.Advise(this, out _codeWindowEventsCookie);
}
var primaryView = codeWindow.GetPrimaryView();
if (primaryView != null)
((IVsCodeWindowEvents)this).OnNewView(primaryView);
var secondaryView = codeWindow.GetSecondaryView();
if (secondaryView != null)
((IVsCodeWindowEvents)this).OnNewView(secondaryView);
_navigationItems = new List<EditorTypeNavigationTarget>();
source.NavigationTargetsChanged += OnNavigationTargetsChanged;
UpdateNavigationTargets();
_currentTextView.Caret.PositionChanged += OnCaretPositionChanged;
}
示例2: EditorNavigationDropdownBar
public EditorNavigationDropdownBar(IVsCodeWindow codeWindow, IVsEditorAdaptersFactoryService editorAdaptersFactory, IEnumerable<IEditorNavigationSource> sources, IBufferGraphFactoryService bufferGraphFactoryService, IJavaEditorNavigationTypeRegistryService editorNavigationTypeRegistryService)
{
Contract.Requires<ArgumentNullException>(codeWindow != null, "codeWindow");
Contract.Requires<ArgumentNullException>(editorAdaptersFactory != null, "editorAdaptersFactory");
Contract.Requires<ArgumentNullException>(sources != null, "sources");
Contract.Requires<ArgumentNullException>(bufferGraphFactoryService != null, "bufferGraphFactoryService");
Contract.Requires<ArgumentNullException>(editorNavigationTypeRegistryService != null, "editorNavigationTypeRegistryService");
this._codeWindow = codeWindow;
this._editorAdaptersFactory = editorAdaptersFactory;
this._sources = sources;
this._bufferGraphFactoryService = bufferGraphFactoryService;
this._editorNavigationTypeRegistryService = editorNavigationTypeRegistryService;
this._currentTextView = editorAdaptersFactory.GetWpfTextView(codeWindow.GetLastActiveView());
this._dispatcher = this._currentTextView.VisualElement.Dispatcher;
this._imageList = new ImageList()
{
ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit
};
_navigationControls =
this._sources
.SelectMany(source => source.GetNavigationTypes())
.Distinct()
//.OrderBy(...)
.Select(type => Tuple.Create(type, new List<IEditorNavigationTarget>()))
.ToArray();
_selectedItem = new IEditorNavigationTarget[_navigationControls.Length];
if (this._navigationControls.Length == 0)
{
return;
}
IConnectionPointContainer connectionPointContainer = codeWindow as IConnectionPointContainer;
if (connectionPointContainer != null)
{
Guid textViewEventsGuid = typeof(IVsCodeWindowEvents).GUID;
IConnectionPoint connectionPoint;
connectionPointContainer.FindConnectionPoint(ref textViewEventsGuid, out connectionPoint);
if (connectionPoint != null)
connectionPoint.Advise(this, out _codeWindowEventsCookie);
}
IVsTextView primaryView = codeWindow.GetPrimaryView();
if (primaryView != null)
((IVsCodeWindowEvents)this).OnNewView(primaryView);
IVsTextView secondaryView = codeWindow.GetSecondaryView();
if (secondaryView != null)
((IVsCodeWindowEvents)this).OnNewView(secondaryView);
foreach (var source in this._sources)
{
source.NavigationTargetsChanged += WeakEvents.AsWeak(OnNavigationTargetsChanged, eh => source.NavigationTargetsChanged -= eh);
UpdateNavigationTargets(source);
}
_currentTextView.Caret.PositionChanged += OnCaretPositionChanged;
}