Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public IOutputWindowPane TryGetPane(string 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;
        }