Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ImportsMonitor"/> class.
        /// </summary>
        /// <param name="solutionMonitor">The solution monitor</param>
        public ImportsMonitor(SolutionMonitor solutionMonitor)
        {
            this.solutionMonitor = Requires.NotNull(solutionMonitor, nameof(solutionMonitor));

            this.solutionMonitor.SolutionChanged += this.SolutionMonitor_SolutionChanged;
            this.solutionMonitor.SolutionClosing += this.SolutionMonitor_SolutionClosing;

            this.previousImportPaths = Enumerable.Empty <string>();
        }
Ejemplo n.º 2
0
 /// <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");
        }