private void HookEvents(bool add) { using (IItemEvents events = _item.GetEvents()) { if (add) { events.Read += HandleRead; events.BeforeDelete += HandleBeforeDelete; events.Forward += HandleForward; events.PropertyChange += HandlePropertyChange; events.Reply += HandleReply; events.ReplyAll += HandleReplyAll; events.Unload += HandleUnload; events.Write += HandleWrite; } else { events.Read -= HandleRead; events.BeforeDelete -= HandleBeforeDelete; events.Forward -= HandleForward; events.PropertyChange -= HandlePropertyChange; events.Reply -= HandleReply; events.ReplyAll -= HandleReplyAll; events.Unload -= HandleUnload; events.Write -= HandleWrite; } } }
public PatternManager( [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider, ISolution solution, IShellEvents shellEvents, ISolutionEvents solutionEvents, IItemEvents itemEvents, IEnumerable <IInstalledToolkitInfo> installedToolkits, IUserMessageService messageService) { Guard.NotNull(() => serviceProvider, serviceProvider); Guard.NotNull(() => solution, solution); Guard.NotNull(() => shellEvents, shellEvents); Guard.NotNull(() => solutionEvents, solutionEvents); Guard.NotNull(() => itemEvents, itemEvents); Guard.NotNull(() => installedToolkits, installedToolkits); Guard.NotNull(() => messageService, messageService); this.serviceProvider = serviceProvider; this.solution = solution; this.solutionEvents = solutionEvents; this.shellEvents = shellEvents; this.itemEvents = itemEvents; this.installedToolkits = installedToolkits.ToArray(); this.messageService = messageService; this.solutionEvents.SolutionOpened += this.OnSolutionOpened; this.solutionEvents.SolutionClosing += this.OnSolutionClosing; this.itemEvents.ItemRemoved += OnItemRemoved; }
public TestPatternManager(IServiceProvider serviceProvider, ISolution solution, IShellEvents shellEvents, ISolutionEvents solutionEvents, IItemEvents itemEvents, IEnumerable<IInstalledToolkitInfo> installedFactories, IUserMessageService messageService) : base(serviceProvider, solution, shellEvents, solutionEvents, itemEvents, installedFactories, messageService) { }
public TestPatternManager(IServiceProvider serviceProvider, ISolution solution, IShellEvents shellEvents, ISolutionEvents solutionEvents, IItemEvents itemEvents, IEnumerable <IInstalledToolkitInfo> installedFactories, IUserMessageService messageService) : base(serviceProvider, solution, shellEvents, solutionEvents, itemEvents, installedFactories, messageService) { }