///////////////////////////////////////////////////////////////////////////// // Overridden Package Implementation #region Package Members /// <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() { IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell)); Guid clsid = Guid.Empty; int result; uiShell.ShowMessageBox(0, ref clsid, "ExcelDnaTools", "Hello There!!!", string.Empty, 0, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST, OLEMSGICON.OLEMSGICON_INFO, 0, // false out result); Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); // Initialize our internal helpers _connection = new ExcelConnection(); // Not connected at this point _debugManager = new DebugManager(this, _connection); _solutionHelper = new SolutionHelper(this); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (mcs == null) { Debug.Fail("MenuCommandService not found!?"); return; } // Create the command for the menu item. CommandID menuCommandID = new CommandID(GuidList.guidExcelDnaToolsCmdSet, (int)PkgCmdIDList.cmdidExcelDna); MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID); mcs.AddCommand(menuItem); // Create the command for the tool window CommandID toolwndCommandID = new CommandID(GuidList.guidExcelDnaToolsCmdSet, (int)PkgCmdIDList.cmdidExcelDnaExplorer); MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID); mcs.AddCommand(menuToolWin); CommandID attachExcelCommandID = new CommandID(GuidList.guidExcelDnaToolsCmdSet, (int)PkgCmdIDList.cmdidExcelDnaAttachExcel); OleMenuCommand menuAttachExcel = new OleMenuCommand(AttachExcelCallback, attachExcelCommandID); menuAttachExcel.ParametersDescription = "$"; // Documented http://www.getcodesamples.com/src/7D389846/8A0A4E48 mcs.AddCommand(menuAttachExcel); CommandID attachDebuggerCommandID = new CommandID(GuidList.guidExcelDnaToolsCmdSet, (int)PkgCmdIDList.cmdidExcelDnaAttachDebugger); OleMenuCommand menuAttachDebugger = new OleMenuCommand(AttachDebuggerCallback, attachDebuggerCommandID); mcs.AddCommand(menuAttachDebugger); }
/// <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() { IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell)); Guid clsid = Guid.Empty; int result; uiShell.ShowMessageBox(0, ref clsid, "ExcelDnaTools", "Hello There!!!", string.Empty, 0, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST, OLEMSGICON.OLEMSGICON_INFO, 0, // false out result); Debug.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); // Initialize our internal helpers _connection = new ExcelConnection(); // Not connected at this point _debugManager = new DebugManager(this, _connection); _solutionHelper = new SolutionHelper(this); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (mcs == null) { Debug.Fail("MenuCommandService not found!?"); return; } // Create the command for the menu item. CommandID menuCommandID = new CommandID(GuidList.guidExcelDnaToolsCmdSet, (int)PkgCmdIDList.cmdidExcelDna); MenuCommand menuItem = new MenuCommand(MenuItemCallback, menuCommandID ); mcs.AddCommand( menuItem ); // Create the command for the tool window CommandID toolwndCommandID = new CommandID(GuidList.guidExcelDnaToolsCmdSet, (int)PkgCmdIDList.cmdidExcelDnaExplorer); MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID); mcs.AddCommand( menuToolWin ); CommandID attachExcelCommandID = new CommandID(GuidList.guidExcelDnaToolsCmdSet, (int)PkgCmdIDList.cmdidExcelDnaAttachExcel); OleMenuCommand menuAttachExcel = new OleMenuCommand(AttachExcelCallback, attachExcelCommandID); menuAttachExcel.ParametersDescription = "$"; // Documented http://www.getcodesamples.com/src/7D389846/8A0A4E48 mcs.AddCommand(menuAttachExcel); CommandID attachDebuggerCommandID = new CommandID(GuidList.guidExcelDnaToolsCmdSet, (int)PkgCmdIDList.cmdidExcelDnaAttachDebugger); OleMenuCommand menuAttachDebugger = new OleMenuCommand(AttachDebuggerCallback, attachDebuggerCommandID); mcs.AddCommand(menuAttachDebugger); }