/// <summary> /// Handles "apply" messages from the Visual Studio environment. /// </summary> /// <devdoc> /// This method is called when VS wants to save the user's /// changes (for example, when the user clicks OK in the dialog). /// </devdoc> protected override void OnApply(PageApplyEventArgs e) { VSPackage package = GetService(typeof(VSPackage)) as VSPackage; var configuration = package.GetConfiguration(); this.optionsControl.SaveSetting(configuration); }
/// <summary> /// Initializes a new instance of the <see cref="CopyWithLineNumbersCommand"/> class. /// Adds our command handlers for menu (commands must exist in the command table file) /// </summary> /// <param name="package">Owner package, not null.</param> private CopyWithLineNumbersCommand(VSPackage package) { if (package == null) { throw new ArgumentNullException("package"); } this.package = package; OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (commandService != null) { var menuCommandID = new CommandID(CommandSet, CommandId); var menuItem = new OleMenuCommand(this.MenuItemCallback, menuCommandID); menuItem.BeforeQueryStatus += this.BeforeQueryStatus; commandService.AddCommand(menuItem); } }
/// <summary> /// Initializes the singleton instance of the command. /// </summary> /// <param name="package">Owner package, not null.</param> public static void Initialize(VSPackage package) { Instance = new CopyWithLineNumbersCommand(package); }