///////////////////////////////////////////////////////////////////////////// // 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() { Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); SettingsManager = new ShellSettingsManager(this); WritableSettingsStore userSettingsStore = SettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (userSettingsStore.PropertyExists("Settings", "Params")) { try { Params = new CommentReflowerLib.ParameterSet(userSettingsStore.GetMemoryStream("Settings", "Params")); } catch (Exception) { ShowMessageBox("Comment Reflower Error", "Unable to read user settings. Resetting to default."); Params = new CommentReflowerLib.ParameterSet(); } } else { Params = new CommentReflowerLib.ParameterSet(); } // Add our command handlers for menu (commands must exist in the .vsct file) var mcs = (OleMenuCommandService)GetService(typeof(IMenuCommandService)); CommandID menuCommandID; OleMenuCommand menuItem; menuCommandID = new CommandID(GuidList.guidCommentReflowerCmdSet, PkgCmdIDList.cmdidAlignParameters); menuItem = new OleMenuCommand(MenuItemCallback, null, QueryStatusCallback, menuCommandID); mcs.AddCommand(menuItem); menuCommandID = new CommandID(GuidList.guidCommentReflowerCmdSet, PkgCmdIDList.cmdidReflowPoint); menuItem = new OleMenuCommand(MenuItemCallback, null, QueryStatusCallback, menuCommandID); mcs.AddCommand(menuItem); menuCommandID = new CommandID(GuidList.guidCommentReflowerCmdSet, PkgCmdIDList.cmdidReflowSelection); menuItem = new OleMenuCommand(MenuItemCallback, null, QueryStatusCallback, menuCommandID); mcs.AddCommand(menuItem); menuCommandID = new CommandID(GuidList.guidCommentReflowerCmdSet, PkgCmdIDList.cmdidSettings); menuItem = new OleMenuCommand(MenuItemCallback, menuCommandID); mcs.AddCommand(menuItem); }
private void MainThreadInitialization(OleMenuCommandService menuCommandService, bool isAsyncPath) { SettingsManager = new ShellSettingsManager(this); WritableSettingsStore userSettingsStore = SettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (userSettingsStore.PropertyExists("Settings", "Params")) { try { Params = new CommentReflowerLib.ParameterSet(userSettingsStore.GetMemoryStream("Settings", "Params")); } catch (Exception) { ShowMessageBox("Comment Reflower Error", "Unable to read user settings. Resetting to default."); Params = new CommentReflowerLib.ParameterSet(); } } else { Params = new CommentReflowerLib.ParameterSet(); } // Add our command handlers for menu (commands must exist in the .vsct file) var mcs = menuCommandService; CommandID menuCommandID; OleMenuCommand menuItem; menuCommandID = new CommandID(GuidList.guidCommentReflowerCmdSet, PkgCmdIDList.cmdidAlignParameters); menuItem = new OleMenuCommand(MenuItemCallback, null, QueryStatusCallback, menuCommandID); mcs.AddCommand(menuItem); menuCommandID = new CommandID(GuidList.guidCommentReflowerCmdSet, PkgCmdIDList.cmdidReflowPoint); menuItem = new OleMenuCommand(MenuItemCallback, null, QueryStatusCallback, menuCommandID); mcs.AddCommand(menuItem); menuCommandID = new CommandID(GuidList.guidCommentReflowerCmdSet, PkgCmdIDList.cmdidReflowSelection); menuItem = new OleMenuCommand(MenuItemCallback, null, QueryStatusCallback, menuCommandID); mcs.AddCommand(menuItem); menuCommandID = new CommandID(GuidList.guidCommentReflowerCmdSet, PkgCmdIDList.cmdidSettings); menuItem = new OleMenuCommand(MenuItemCallback, menuCommandID); mcs.AddCommand(menuItem); }
/// <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(); SettingsManager = new ShellSettingsManager(this); WritableSettingsStore userSettingsStore = SettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (userSettingsStore.PropertyExists("Settings", "Params")) { try { Params = new CommentReflowerLib.ParameterSet(userSettingsStore.GetMemoryStream("Settings", "Params")); } catch (Exception) { ShowMessageBox("Comment Reflower Error", "Unable to read user settings. Resetting to default."); Params = new CommentReflowerLib.ParameterSet(); } } else { Params = new CommentReflowerLib.ParameterSet(); } // Add our command handlers for menu (commands must exist in the .vsct file) var mcs = (OleMenuCommandService)GetService(typeof(IMenuCommandService)); CommandID menuCommandID; OleMenuCommand menuItem; menuCommandID = new CommandID(GuidList.guidCommentReflowerCmdSet, PkgCmdIDList.cmdidAlignParameters); menuItem = new OleMenuCommand(MenuItemCallback, null, QueryStatusCallback, menuCommandID); mcs.AddCommand(menuItem); menuCommandID = new CommandID(GuidList.guidCommentReflowerCmdSet, PkgCmdIDList.cmdidReflowPoint); menuItem = new OleMenuCommand(MenuItemCallback, null, QueryStatusCallback, menuCommandID); mcs.AddCommand(menuItem); menuCommandID = new CommandID(GuidList.guidCommentReflowerCmdSet, PkgCmdIDList.cmdidReflowSelection); menuItem = new OleMenuCommand(MenuItemCallback, null, QueryStatusCallback, menuCommandID); mcs.AddCommand(menuItem); menuCommandID = new CommandID(GuidList.guidCommentReflowerCmdSet, PkgCmdIDList.cmdidSettings); menuItem = new OleMenuCommand(MenuItemCallback, menuCommandID); mcs.AddCommand(menuItem); }