-
Notifications
You must be signed in to change notification settings - Fork 2
/
BetterConfigurationManagerPackage.cs
39 lines (37 loc) · 1.48 KB
/
BetterConfigurationManagerPackage.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.ComponentModel.Design;
using System.Runtime.InteropServices;
using BetterConfigurationManager.MainToolWindow;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
namespace BetterConfigurationManager
{
[PackageRegistration(UseManagedResourcesOnly = true),
InstalledProductRegistration("#110", "#112", "1.2", IconResourceID = 400),
ProvideMenuResource("Menus.ctmenu", 1),
ProvideToolWindow(typeof(MainToolWindowInitialize), Style = VsDockStyle.MDI, MultiInstances = false),
Guid(Guids.BetterConfigurationManagerPackageId)]
public sealed class BetterConfigurationManagerPackage : Package
{
protected override void Initialize()
{
base.Initialize();
var menuCommandService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
if (menuCommandService == null)
return;
var commandID = new CommandID(Guids.BetterConfigurationManagerMenuId,
(int)PkgCmdIDList.BetterConfigurationManagerMenu);
var menuCommand = new MenuCommand(ShowToolWindow, commandID);
menuCommandService.AddCommand(menuCommand);
}
private void ShowToolWindow(object sender, EventArgs e)
{
ToolWindowPane window = FindToolWindow(typeof(MainToolWindowInitialize), 0, true);
if ((window == null) || (window.Frame == null))
throw new NotSupportedException(Resources.CanNotCreateWindow);
var windowFrame = (IVsWindowFrame)window.Frame;
ErrorHandler.ThrowOnFailure(windowFrame.Show());
}
}
}