/// <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 initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); //Create Editor Factory. Note that the base Package class will call Dispose on it. base.RegisterEditorFactory(new EditorFactory(this)); APITargetListSingleton api = APITargetListSingleton.Instance; InstalledAPIListSingleton apiList = InstalledAPIListSingleton.Instance; InstalledNDKListSingleton ndkList = InstalledNDKListSingleton.Instance; SimulatorListSingleton simList = SimulatorListSingleton.Instance; InstalledSimulatorListSingleton installedSimList = InstalledSimulatorListSingleton.Instance; _dte = (EnvDTE.DTE)GetService(typeof(EnvDTE.DTE)); if ((IsBlackBerrySolution(_dte)) && (apiList._installedAPIList.Count == 0)) { UpdateManager.UpdateManagerDialog ud = new UpdateManager.UpdateManagerDialog("Please choose your default API Level to be used by the Visual Studio Plug-in.", "default", false, false); ud.ShowDialog(); } SetNDKPath(); _commandEvents = new VSNDKCommandEvents((DTE2)_dte); _commandEvents.RegisterCommand(GuidList.guidVSStd97String, CommandConstants.cmdidStartDebug, startDebugCommandEvents_AfterExecute, startDebugCommandEvents_BeforeExecute); _commandEvents.RegisterCommand(GuidList.guidVSStd97String, CommandConstants.cmdidStartDebug, startDebugCommandEvents_AfterExecute, startDebugCommandEvents_BeforeExecute); _commandEvents.RegisterCommand(GuidList.guidVSStd2KString, CommandConstants.cmdidStartDebugContext, startDebugCommandEvents_AfterExecute, startDebugCommandEvents_BeforeExecute); _buildEvents = _dte.Events.BuildEvents; _buildEvents.OnBuildBegin += new _dispBuildEvents_OnBuildBeginEventHandler(this.OnBuildBegin); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if ( null != mcs ) { // Create the command for the tool window CommandID toolwndCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidBlackBerryTools); MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID); mcs.AddCommand( menuToolWin ); // Create the command for the settings window CommandID wndSettingsCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidBlackBerrySettings); MenuCommand menuSettingsWin = new MenuCommand(ShowSettingsWindow, wndSettingsCommandID); mcs.AddCommand(menuSettingsWin); // Create the command for the Debug Token window CommandID wndDebugTokenCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidBlackBerryDebugToken); MenuCommand menuDebugTokenWin = new MenuCommand(ShowDebugTokenWindow, wndDebugTokenCommandID); mcs.AddCommand(menuDebugTokenWin); // Create the command for the menu item. CommandID projCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidfooLocalBox); OleMenuCommand projItem = new OleMenuCommand(MenuItemCallback, projCommandID); mcs.AddCommand(projItem); } }
/// <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 initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); //Create Editor Factory. Note that the base Package class will call Dispose on it. base.RegisterEditorFactory(new EditorFactory(this)); _dte = (EnvDTE.DTE)GetService(typeof(EnvDTE.DTE)); SetNDKPath(); GetInstalledAPIList(); GetAvailableAPIList(); GetInstalledSimulatorList(); GetSimulatorList(); _commandEvents = new VSNDKCommandEvents((DTE2)_dte); _commandEvents.RegisterCommand(GuidList.guidVSStd97String, CommandConstants.cmdidStartDebug, startDebugCommandEvents_AfterExecute, startDebugCommandEvents_BeforeExecute); _buildEvents = _dte.Events.BuildEvents; _buildEvents.OnBuildBegin += new _dispBuildEvents_OnBuildBeginEventHandler(this.OnBuildBegin); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if ( null != mcs ) { // Create the command for the tool window CommandID toolwndCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidBlackBerryTools); MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID); mcs.AddCommand( menuToolWin ); // Create the command for the settings window CommandID wndSettingsCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidBlackBerrySettings); MenuCommand menuSettingsWin = new MenuCommand(ShowSettingsWindow, wndSettingsCommandID); mcs.AddCommand(menuSettingsWin); // Create the command for the Debug Token window CommandID wndDebugTokenCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidBlackBerryDebugToken); MenuCommand menuDebugTokenWin = new MenuCommand(ShowDebugTokenWindow, wndDebugTokenCommandID); mcs.AddCommand(menuDebugTokenWin); // Create the command for the menu item. CommandID projCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidfooLocalBox); OleMenuCommand projItem = new OleMenuCommand(MenuItemCallback, projCommandID); mcs.AddCommand(projItem); } }