/// <inheritdoc/> protected override WindowPane?InstantiateToolWindow(Type toolWindowType) { WindowPane windowPane = base.InstantiateToolWindow(toolWindowType); IToolWindowProvider?provider = GetToolWindowProvider(toolWindowType); if (provider is not null) { // Set the content and the caption of the tool window. This needs to be // done as part of initializing the tool window. Doing it later results in // errors being thrown when Visual Studio creates the tool window's frame. #pragma warning disable IDE0079 // Remove unnecessary suppression #pragma warning disable VSTHRD104 // Offer async methods windowPane.Content = ThreadHelper.JoinableTaskFactory.Run( () => provider.CreateAsync(_currentToolWindowId, DisposalToken) ); #pragma warning restore VSTHRD104 // Offer async methods #pragma warning restore IDE0079 // Remove unnecessary suppression if (windowPane is ToolWindowPane toolPane) { toolPane.Caption = provider.GetTitle(_currentToolWindowId); } } return(windowPane); }
/// <inheritdoc/> protected override WindowPane InstantiateToolWindow(Type toolWindowType, object context) { IToolWindowProvider?provider = GetToolWindowProvider(toolWindowType); if (provider is not null) { // The context object we have been given was returned from the `InitializeToolWindowAsync()` // method, and is an `InstantiateToolWindowData` object that contains the content for the tool // window and its ID. The tool window is always created with an unspecified context object. InstantiateToolWindowData?data = (InstantiateToolWindowData)context; WindowPane pane = base.InstantiateToolWindow(toolWindowType, ToolWindowCreationContext.Unspecified); // Set the content and the caption of the tool window. This needs to be // done as part of initializing the tool window. Doing it later results in // errors being thrown when Visual Studio creates the tool window's frame. pane.Content = data.Content; if (pane is ToolWindowPane toolPane) { toolPane.Caption = provider.GetTitle(data.Id); } return(pane); } else { return(base.InstantiateToolWindow(toolWindowType, context)); } }
/// <summary> /// このコマンドのシングルトンのインスタンスを初期化します。 /// </summary> /// <param name="package">コマンドを提供するパッケージ</param> /// <param name="windowPane">配置するツールウィンドウ</param> public static void Initialize(Package package, WindowPane windowPane) { var window = (TypeHierarchyWindow)windowPane; Instance = new SwitchIncludedMetadataCommand(package, window); var viewModel = window.ViewModel; viewModel.PropertyChanged += (sender, e) => { Instance.MenuCommand.Enabled = viewModel.DisplayMode == DisplayMode.BaseSummaryAndChildren; }; }
/// <inheritdoc/> protected override WindowPane?InstantiateToolWindow(Type toolWindowType) { WindowPane windowPane = base.InstantiateToolWindow(toolWindowType); IToolWindowProvider?provider = GetToolWindowProvider(toolWindowType); if (provider is not null) { // Set the content and the caption of the tool window. This needs to be // done as part of initializing the tool window. Doing it later results in // errors being thrown when Visual Studio creates the tool window's frame. windowPane.Content = ThreadHelper.JoinableTaskFactory.Run( () => provider.CreateAsync(_currentToolWindowId, DisposalToken) ); if (windowPane is ToolWindowPane toolPane) { toolPane.Caption = provider.GetTitle(_currentToolWindowId); } } return(windowPane); }
public static bool With <T>(this WindowPane pane, out T service) { service = (T)WindowPaneGetService(pane, GetServiceQueryType <T>()); return(service != null); }
/// <summary> /// このコマンドのシングルトンのインスタンスを初期化します。 /// </summary> /// <param name="package">コマンドを提供するパッケージ</param> /// <param name="windowPane">配置するツールウィンドウ</param> public static void Initialize(Package package, WindowPane windowPane) { Instance = new SwitchDisplayModeCommand(package, (TypeHierarchyWindow)windowPane); }
private async Task<IVsWindowFrame> CreateDocWindowAsync(UnconfiguredProject unconfiguredProject, string documentName, IVsHierarchy hierarchy, uint itemId) { var windowFlags = _VSRDTFLAGS.RDT_DontAddToMRU | _VSRDTFLAGS.RDT_DontAutoOpen; var model = new WindowModel(project, targetUIs, lockService, threadHandler); await model.LoadFromProject(); var control = new Control(model); var windowPane = new WindowPane(control); var editorType = Guid.Empty; var commandUI = Guid.Empty; var caption = $"{model.Name} Deploy Rules"; IVsWindowFrame frame; var docView = IntPtr.Zero; var docData = IntPtr.Zero; var hr = 0; try { docView = Marshal.GetIUnknownForObject(windowPane); docData = Marshal.GetIUnknownForObject(model); hr = uiShell.CreateDocumentWindow((uint)windowFlags, documentName, (IVsUIHierarchy)hierarchy, itemId, docView, docData, ref editorType, null, ref commandUI, null, caption, string.Empty, null, out frame); } finally { if (docView != IntPtr.Zero) { Marshal.Release(docView); } if (docData != IntPtr.Zero) { Marshal.Release(docData); } } ErrorHandler.ThrowOnFailure(hr); return frame; }
internal FastFindControlWPFWrapper(DTE dte, SolutionFiles solution_files, FileFinder file_finder, TextFinder text_finder, GetOpenFilesThread get_open_files_thread, Settings settings, WindowPane window_pane_owner) { this.InitializeComponent(); this.m_DTE = dte; this.m_TabStopPanel.WpfHost = this.m_WindowsFormsHost; bool is_modal = false; this.m_FastFindControl = new FastFindControl(dte, solution_files, file_finder, text_finder, get_open_files_thread, settings, "", -1, is_modal); this.m_FastFindControl.ControlWantsToClose += onEscToCloseWindow; this.m_FastFindControl.Dock = DockStyle.Fill; this.m_TabStopPanel.Controls.Add(this.m_FastFindControl); }
public static void Test(WindowPane p) { var service = p.GetService(typeof(Service)); // etc. }