/// <summary> /// Initializes a new instance of the <see cref="Activate"/> 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 Activate(Package package, EventHolder eventHolder) { this.package = package ?? throw new ArgumentNullException("package"); this.EventHolder = eventHolder; Eventer = new Eventer(EventHolder, ActivatePackage.ConfigXmlPath); if (this.ServiceProvider.GetService(typeof(IMenuCommandService)) is OleMenuCommandService commandService) { var menuCommandID = new CommandID(CommandSet, CommandId); var menuItem = new OleMenuCommand(this.MenuItemCallback, menuCommandID); commandService.AddCommand(menuItem); } }
public override void LoadSettingsFromStorage() { var config = Eventer.ReadConfigData(ActivatePackage.ConfigXmlPath); BuildDoneTalkData = config.BuildDone; Port = config.Port; IPAddress = config.IPAddress; BuildFaildTalkData = config.BuildFaild; BuildBeginTalkData = config.BuildBegin; StartupCompleteTalkData = config.StartupComplete; BeginShutdownTalkData = config.BeginShutdown; OpenedTalkData = config.Opened; ClosingTalkData = config.Closing; ExceptionNotHandledTalkData = config.ExceptionNotHandled; ExceptionThrownTalkData = config.ExceptionThrown; EnterDebuggerTalkData = config.EnterDebugger; EnterDesignTalkData = config.EnterDesign; EnterRunModeTalkData = config.EnterRunMode; }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">SupportingEvents sender.</param> /// <param name="e">SupportingEvents args.</param> private void MenuItemCallback(object sender, EventArgs e) { var mycmd = sender as OleMenuCommand; if (mycmd != null) { mycmd.Checked = !mycmd.Checked; } if (mycmd.Checked) { Eventer.Activate(); } else { Eventer.Deactivate(); } }
public override void SaveSettingsToStorage() { var config = new VsBouyomiConfigData { BuildDone = BuildDoneTalkData, BuildFaild = BuildFaildTalkData, BuildBegin = BuildBeginTalkData, StartupComplete = StartupCompleteTalkData, BeginShutdown = BeginShutdownTalkData, Opened = OpenedTalkData, Closing = ClosingTalkData, ExceptionNotHandled = ExceptionNotHandledTalkData, ExceptionThrown = ExceptionThrownTalkData, EnterDebugger = EnterDebuggerTalkData, EnterDesign = EnterDesignTalkData, EnterRunMode = EnterRunModeTalkData, IPAddress = IPAddress, Port = Port }; Eventer.WriteConfigData(ActivatePackage.ConfigXmlPath, config); Activate.Eventer.Config = config; }