コード例 #1
0
 public VsProjectReferencesTracker(Project project, DteWithEvents dteWithEvents, IIdeTracer tracer)
 {
     this.project = project.Object as VSProject;
     this.dteWithEvents = dteWithEvents;
     this.tracer = tracer;
     this.timer = new Timer(HandleFilesChangedOnDisk, null, Timeout.Infinite, Timeout.Infinite);
     this.triggerReferenceChangedTimer = new Timer(TriggerReferenceChange, null, Timeout.Infinite, Timeout.Infinite);
 }
コード例 #2
0
 public VsProjectReferencesTracker(Project project, DteWithEvents dteWithEvents, IIdeTracer tracer)
 {
     this.project       = project.Object as VSProject;
     this.dteWithEvents = dteWithEvents;
     this.tracer        = tracer;
     this.timer         = new Timer(HandleFilesChangedOnDisk, null, Timeout.Infinite, Timeout.Infinite);
     this.triggerReferenceChangedTimer = new Timer(TriggerReferenceChange, null, Timeout.Infinite, Timeout.Infinite);
 }
コード例 #3
0
        protected VsProjectFileTrackerBase(Project project, DteWithEvents dteWithEvents, IIdeTracer tracer)
        {
            this.project = project;
            this.dteWithEvents = dteWithEvents;
            this.tracer = tracer;

            this.timer = new Timer(HandleFilesChangedOnDisk, null, Timeout.Infinite, Timeout.Infinite);
        }
コード例 #4
0
        protected VsProjectFileTrackerBase(Project project, DteWithEvents dteWithEvents, IIdeTracer tracer)
        {
            this.project       = project;
            this.dteWithEvents = dteWithEvents;
            this.tracer        = tracer;

            this.timer = new Timer(HandleFilesChangedOnDisk, null, Timeout.Infinite, Timeout.Infinite);
        }
コード例 #5
0
        public VsProjectFileTracker(Project project, string fileName, DteWithEvents dteWithEvents, IVisualStudioTracer tracer, bool followTrackingAfterRename = false) :
            base(project, dteWithEvents, tracer)
        {
            this.followTrackingAfterRename = followTrackingAfterRename;
            this.fileName = fileName;

            SetLastChangeDate(VsxHelper.FindProjectItemByProjectRelativePath(project, fileName));

            SubscribeToDteEvents();
        }
コード例 #6
0
        public VsProjectFileTracker(Project project, string fileName, DteWithEvents dteWithEvents, IVisualStudioTracer visualStudioTracer, bool followTrackingAfterRename = false)
        {
            this.project = project;
            this.followTrackingAfterRename = followTrackingAfterRename;
            this.fileName           = fileName;
            this.visualStudioTracer = visualStudioTracer;

            SetLastChangeDate(VsxHelper.FindProjectItemByProjectRelativePath(project, fileName));
            SubscribeToDteEvents(dteWithEvents);
        }
コード例 #7
0
 public VsProjectFileTracker(ProjectItem projectItem, DteWithEvents dteWithEvents, IVisualStudioTracer visualStudioTracer, bool followTrackingAfterRename = false) :
     this(projectItem.ContainingProject, VsxHelper.GetProjectRelativePath(projectItem), dteWithEvents, visualStudioTracer, followTrackingAfterRename)
 {
     
 }
コード例 #8
0
        private void SubscribeToDteEvents(DteWithEvents dteWithEvents)
        {
            dteWithEvents.ProjectItemsEvents.ItemAdded +=
                item =>
            {
                visualStudioTracer.Trace("Item Added: " + item.Name, "VsProjectFileTracker");
                if (IsItemRelevant(item))
                {
                    OnFileChanged(item);
                }
            };

            dteWithEvents.ProjectItemsEvents.ItemRemoved +=
                item =>
            {
                visualStudioTracer.Trace("Item Removed: " + item.Name, "VsProjectFileTracker");
                if (IsItemRelevant(item))
                {
                    OnFileChanged(null);
                }
            };

            dteWithEvents.ProjectItemsEvents.ItemRenamed +=
                (item, oldName) =>
            {
                visualStudioTracer.Trace("Item Renamed to: " + item.Name + " from " + oldName, "VsProjectFileTracker");
                if (IsItemRelevant(item))
                {
                    OnFileChanged(item);
                }
                else if (IsItemRelevant(item, oldName))
                {
                    if (followTrackingAfterRename)
                    {
                        fileName = VsxHelper.GetProjectRelativePath(item);
                        OnFileChanged(item);
                    }
                    else
                    {
                        OnFileChanged(null);
                    }
                }
            };

            dteWithEvents.DocumentEvents.DocumentSaved +=
                document =>
            {
                visualStudioTracer.Trace("Document Saved: " + document, "VsProjectFileTracker");
                ProjectItem item = document.ProjectItem;
                if (IsItemRelevant(item))
                {
                    OnFileChanged(item);
                }
            };

            dteWithEvents.BuildEvents.OnBuildDone +=
                (scope, action) =>
            {
                this.visualStudioTracer.Trace("Build Done.", "VsProjectFileTracker");
                ProjectItem item          = VsxHelper.FindProjectItemByProjectRelativePath(project, fileName);
                var         newChangeDate = GetLastChangeDate(item);
                if (newChangeDate != LastChangeDate)
                {
                    OnFileChanged(item);
                }
            };
        }
コード例 #9
0
 protected VsProjectFileTrackerBase(Project project, DteWithEvents dteWithEvents, IVisualStudioTracer visualStudioTracer)
 {
     this.project            = project;
     this.dteWithEvents      = dteWithEvents;
     this.visualStudioTracer = visualStudioTracer;
 }
コード例 #10
0
 public VsProjectFileTracker(ProjectItem projectItem, DteWithEvents dteWithEvents, IVisualStudioTracer visualStudioTracer, bool followTrackingAfterRename = false) :
     this(projectItem.ContainingProject, VsxHelper.GetProjectRelativePath(projectItem), dteWithEvents, visualStudioTracer, followTrackingAfterRename)
 {
 }
コード例 #11
0
        public VsProjectFilesTracker(Project project, string regexPattern, DteWithEvents dteWithEvents, IVisualStudioTracer visualStudioTracer) : base(project, dteWithEvents, visualStudioTracer)
        {
            fileNameRe = new Regex(regexPattern, RegexOptions.IgnoreCase);

            SubscribeToDteEvents();
        }
コード例 #12
0
        public VsProjectFilesTracker(Project project, string regexPattern, DteWithEvents dteWithEvents, IIdeTracer tracer) : base(project, dteWithEvents, tracer)
        {
            fileNameRe = new Regex(regexPattern, RegexOptions.IgnoreCase);

            SubscribeToDteEvents();
        }