﻿using Devkoes.JenkinsManager.Model.Contract;
using Devkoes.JenkinsManager.UI;
using Devkoes.JenkinsManager.UI.Views;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using System;

namespace Devkoes.JenkinsManager.VSPackage.ExposedServices
{
    public class VisualStudioWindowHandler : IVisualStudioWindowHandler
    {
        public void ShowToolWindow()
        {
            // Get the instance number 0 of this tool window. This window is single instance so this instance
            // is actually the only one.
            // The last flag is set to true so that if the tool window does not exists it will be created.
            ToolWindowPane window = VSJenkinsManagerPackage.Instance.FindToolWindow(typeof(JenkinsToolWindow), 0, true);
            if ((null == window) || (null == window.Frame))
            {
                throw new NotSupportedException(Resources.CanNotCreateWindow);
            }
            IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame;
            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
        }

        public void ShowSettingsWindow()
        {
            try
            {
                VSJenkinsManagerPackage.Instance.ShowOptionPage(typeof(UserOptionsHost));
            }
            catch (Exception ex)
            {
                ServicesContainer.OutputWindowLogger.LogOutput("Showing settings panel failed:", ex);
            }
        }
    }
}

﻿using Devkoes.JenkinsManager.Model.Contract;
using Devkoes.JenkinsManager.UI;
using Devkoes.JenkinsManager.UI.Views;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using System;

namespace Devkoes.JenkinsManager.VSPackage.ExposedServices
{
    public class VisualStudioWindowHandler : IVisualStudioWindowHandler
    {
        public void ShowToolWindow()
        {
            // Get the instance number 0 of this tool window. This window is single instance so this instance
            // is actually the only one.
            // The last flag is set to true so that if the tool window does not exists it will be created.
            ToolWindowPane window = VSJenkinsManagerPackage.Instance.FindToolWindow(typeof(JenkinsToolWindow), 0, true);
            if ((null == window) || (null == window.Frame))
            {
                throw new NotSupportedException(Resources.CanNotCreateWindow);
            }
            IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame;
            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
        }

        public void ShowSettingsWindow()
        {
            try
            {
                VSJenkinsManagerPackage.Instance.ShowOptionPage(typeof(UserOptionsHost));
            }
            catch (Exception ex)
            {
                ServicesContainer.OutputWindowLogger.LogOutput(
                    "Showing settings panel failed:",
                    ex.ToString());
            }
        }
    }
}

Revert "Logging has new overload for exceptions, use it"
Revert "Logging has new overload for exceptions, use it"

This reverts commit 2fe8666247d45c289a6a2ca4fb716f0d25d756f1.
