/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { IVsUIShell uiShell = GetService(typeof(IVsUIShell)) as IVsUIShell; _executeSelectedTestsCommand = new ExecuteSelectedTestsCommand(this, uiShell); mcs.AddCommand(_executeSelectedTestsCommand); _codeCoverageToolWindowCommand = new CodeCoverageToolWindowCommand(this); mcs.AddCommand(_codeCoverageToolWindowCommand); } DTE = (Package.GetGlobalService(typeof(EnvDTE.DTE))) as EnvDTE.DTE; SetCodeCoverageResultsToolWindow(); VSEventsHandler = new VSEventsHandler(this); Instance = this; }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", ToString())); base.Initialize(); Instance = this; DTE = (Package.GetGlobalService(typeof(EnvDTE.DTE))) as EnvDTE.DTE; LoadSettings(); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { VSEventsHandler = new VSEventsHandler(this); IVsUIShell uiShell = GetService(typeof(IVsUIShell)) as IVsUIShell; var executeSelectedTestsCommand = new ExecuteSelectedTestsCommand(this); mcs.AddCommand(executeSelectedTestsCommand); var codeCoverageToolWindowCommand = new CodeCoverageToolWindowCommand(this); mcs.AddCommand(codeCoverageToolWindowCommand); var testExplorerToolWindowCommand = new TestExplorerToolWindowCommand(this); mcs.AddCommand(testExplorerToolWindowCommand); var testSettingsFileSelectorCommand = new MSTestSettingsFileSelectorCommand(this); mcs.AddCommand(testSettingsFileSelectorCommand); foreach (var command in TestsExplorerToolbarCommands.Commands) { mcs.AddCommand(command); } foreach (var command in ResultsToolbarCommands.Commands) { mcs.AddCommand(command); } Commands.Add(executeSelectedTestsCommand); Commands.Add(codeCoverageToolWindowCommand); Commands.Add(testExplorerToolWindowCommand); Commands.Add(testSettingsFileSelectorCommand); } }