Exemplo n.º 1
0
        private void ImportsMonitor_ImportsChanged(object sender, ImportsMonitor.ImportsChangedEventArgs e)
        {
            Trace.TraceInformation($"{nameof(ImportsHierarchyNodeManager)}.{nameof(ImportsHierarchyNodeManager.ImportsMonitor_ImportsChanged)}");

            if (this.vsSolution == null)
            {
                lock (this)
                {
                    if (this.vsSolution == null)
                    {
                        this.vsSolution       = (IVsSolution)this.sp.GetService(typeof(SVsSolution));
                        this.currentHierarchy = new ImportsHierarchyNode(this.package);
                        this.vsSolution.AddVirtualProject(
                            this.currentHierarchy,
                            (uint)(__VSADDVPFLAGS.ADDVP_AddToProjectWindow
                                   | __VSADDVPFLAGS.ADDVP_ExcludeFromBuild
                                   | __VSADDVPFLAGS.ADDVP_ExcludeFromCfgUI
                                   | __VSADDVPFLAGS.ADDVP_ExcludeFromDebugLaunch
                                   | __VSADDVPFLAGS.ADDVP_ExcludeFromDeploy
                                   | __VSADDVPFLAGS.ADDVP_ExcludeFromEnumOutputs
                                   | __VSADDVPFLAGS.ADDVP_ExcludeFromSCC));
                    }
                }
            }

            this.currentHierarchy.UpdateItems(e.ImportPaths);
        }
        private void ImportsMonitor_ImportsChanged(object sender, ImportsMonitor.ImportsChangedEventArgs e)
        {
            Trace.TraceInformation($"{nameof(LastWriteFileChangeMonitor)}.{nameof(LastWriteFileChangeMonitor.ImportsMonitor_ImportsChanged)}");
            this.UnadviseAllAndClear(this.fileChange, this.cookies);

            if (e.SolutionPath == null)
            {
                return;
            }

            this.currentSolutionPath = e.SolutionPath;

            foreach (var p in e.ImportPaths)
            {
                ErrorHandler.ThrowOnFailure(
                    this.fileChange.AdviseFileChange(p, (uint)_VSFILECHANGEFLAGS.VSFILECHG_Time, this, out uint cookie));
                this.cookies.Add(cookie);
            }
        }