private Guid?CreateWindowPane(string name) { var outputWindow = GlobalServiceProvider.GetOutputWindow(); if (outputWindow == null) { return(null); } var definition = OutputWindowDefinitions.FirstOrDefault(lazy => lazy.Metadata.Name.Equals(name)); if (definition == null) { return(null); } Guid guid = Guid.NewGuid(); // this controls whether the pane is listed in the output panes drop-down list, *not* whether the pane is initially selected bool visible = true; bool clearWithSolution = false; string displayName = definition.Metadata.Name; if (definition.Value != null && !string.IsNullOrEmpty(definition.Value.DisplayName)) { displayName = definition.Value.DisplayName; } if (ErrorHandler.Failed(ErrorHandler.CallWithCOMConvention(() => outputWindow.CreatePane(ref guid, displayName, Convert.ToInt32(visible), Convert.ToInt32(clearWithSolution))))) { return(null); } return(guid); }
public IOutputWindowPane TryGetPane(string name) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (string.IsNullOrEmpty(name)) { throw new ArgumentException($"{nameof(name)} cannot be empty", nameof(name)); } if (PredefinedOutputWindowPanes.General.Equals(name)) { IVsOutputWindowPane generalPane = GlobalServiceProvider.GetService <SVsGeneralOutputWindowPane, IVsOutputWindowPane>(); if (generalPane != null) { return(new VsOutputWindowPaneAdapter(generalPane)); } } var outputWindow = GlobalServiceProvider.GetOutputWindow(); if (outputWindow == null) { return(null); } Guid?guid = _outputWindows.GetOrAdd(name, CreateWindowPaneOnMainThread); if (!guid.HasValue) { return(null); } Guid guidValue = guid.Value; IVsOutputWindowPane vspane = null; if (ErrorHandler.Failed(ErrorHandler.CallWithCOMConvention(() => outputWindow.GetPane(ref guidValue, out vspane)))) { return(null); } IOutputWindowPane pane = new VsOutputWindowPaneAdapter(vspane); return(pane); }