/// <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); } }
/// <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() { var dte = (DTE)GetService(typeof(DTE)); this.EventHolder = new EventHolder { BuildEvents = dte.Events.BuildEvents, SolutionEvents = dte.Events.SolutionEvents, DebuggerEvents = dte.Events.DebuggerEvents, DteEvents = dte.Events.DTEEvents }; Activate.Initialize(this, this.EventHolder); base.Initialize(); }
public Eventer(EventHolder h, string path) { _holder = h; Config = ReadConfigData(path); BouyomiTcpClient = new BouyomiTcpClient(Config.IPAddress, Config.Port); }
/// <summary> /// Initializes the singleton instance of the command. /// </summary> /// <param name="package">Owner package, not null.</param> public static void Initialize(Package package, EventHolder eventHolder) { Instance = new Activate(package, eventHolder); }