public static void Initialize(OptionsPage optionsPage) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(GlobalExceptionHandlerEvent); DTE = (DTE2)GeeksProductivityToolsPackage.GetGlobalService(typeof(SDTE)); Settings = new GlobalSettings(); Settings.Load(); OptionsPage = optionsPage; }
protected override void Initialize() { base.Initialize(); App.Initialize(GetDialogPage(typeof(OptionsPage)) as OptionsPage); Instance = this; var componentModel = (IComponentModel)GetService(typeof(SComponentModel)); // Add our command handlers for menu (commands must exist in the .vsct file) var menuCommandService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != menuCommandService) { // var mainMenu = new CommandID(GuidList.GuidGeeksProductivityToolsCmdSet, (int)PkgCmdIDList.CmdidMainMenu); // var founded = menuCommandService.FindCommand(mainMenu); // if (founded == null) // { // var menuCommand2 = new OleMenuCommand(null, mainMenu); // menuCommandService.AddCommand(menuCommand2); // menuCommand2.BeforeQueryStatus += MenuCommand2_BeforeQueryStatus; // } // Set up menu items new Menus.Typescript(menuCommandService).SetupCommands(); new Menus.RunBatchFiles(menuCommandService).SetupCommands(); new Menus.OpenRelatedFileF7(menuCommandService).SetupCommands(); } // Hook up event handlers events = App.DTE.Events; docEvents = events.DocumentEvents; solEvents = events.SolutionEvents; docEvents.DocumentSaved += DocumentEvents_DocumentSaved; solEvents.Opened += delegate { App.Initialize(GetDialogPage(typeof(OptionsPage)) as OptionsPage); }; }