/// <summary> /// Initializes a new instance of the <see cref="LastWriteFileChangeMonitor"/> class. /// </summary> /// <param name="package"></param> /// <param name="importsMonitor">An instance of <see cref="ImportsMonitor"/> that reports files to monitor</param> public LastWriteFileChangeMonitor(ApprenticePackage package, ImportsMonitor importsMonitor) { this.package = Requires.NotNull(package, nameof(package)); this.asp = Requires.NotNull((IAsyncServiceProvider)package, nameof(package)); this.importsMonitor = Requires.NotNull(importsMonitor, nameof(importsMonitor)); this.cookies = new List <uint>(); this.importsMonitor.ImportsChanged += this.ImportsMonitor_ImportsChanged; }
/// <summary> /// Initializes a new instance of the <see cref="ImportsHierarchyNodeManager"/> class. /// </summary> /// <param name="package">The package instance</param> /// <param name="importsMonitor">An instance of <see cref="ImportsMonitor"/></param> /// <param name="solutionMonitor">An instance of <see cref="SolutionMonitor"/></param> public ImportsHierarchyNodeManager(ApprenticePackage package, ImportsMonitor importsMonitor, SolutionMonitor solutionMonitor) { this.importsMonitor = Requires.NotNull(importsMonitor, nameof(importsMonitor)); this.solutionMonitor = Requires.NotNull(solutionMonitor, nameof(solutionMonitor)); this.package = Requires.NotNull(package, nameof(package)); this.sp = Requires.NotNull((IServiceProvider)package, nameof(package)); this.importsMonitor.ImportsChanged += this.ImportsMonitor_ImportsChanged; this.solutionMonitor.SolutionClosing += this.SolutionMonitor_SolutionClosing; }
private async Task StartAsync() { this.solutionMonitor = new SolutionMonitor(this.package); this.importMonitor = new ImportsMonitor(this.solutionMonitor); this.hierarchyNodeManager = new ImportsHierarchyNodeManager(this.package, this.importMonitor, this.solutionMonitor); this.changeMonitor = new LastWriteFileChangeMonitor(this.package, this.importMonitor); this.changeMonitor.FileChanged += this.ChangeMonitor_FileChanged; await this.changeMonitor.InitializeAsync(); await this.solutionMonitor.InitializeAsync(); this.solutionMonitor.Start(); Trace.TraceInformation("ImportWatcher Started"); }
private void Stop() { if (this.changeMonitor != null) { this.changeMonitor.FileChanged -= this.ChangeMonitor_FileChanged; } this.changeMonitor?.Dispose(); this.hierarchyNodeManager?.Dispose(); this.importMonitor?.Dispose(); this.solutionMonitor?.Dispose(); this.changeMonitor = null; this.hierarchyNodeManager = null; this.importMonitor = null; this.solutionMonitor = null; Trace.TraceInformation("ImportWatcher Stopped"); }