Пример #1
0
        public void TextViewCreated(IWpfTextView textView)
        {
            ITextDocument textDoc;
            //string fileName = null;
            var rc = textView.TextBuffer.Properties.TryGetProperty <ITextDocument>(typeof(ITextDocument), out textDoc);

            if (rc)
            {
                //fileName = Path.GetFileName(textDoc.FilePath);
                string            fileFullName   = System.IO.Path.GetFullPath(textDoc.FilePath).ToLower();
                IFileTracker      fileTracker    = cpTrackServ.GetFileTracker(fileFullName);
                FileChangeTracker fChangeTracker = GetFChangeTracker(fileFullName);
                if (fChangeTracker == null)
                {
                    if (fileTracker != null)
                    {
                        fChangeTracker = new FileChangeTracker(textView, fileFullName, fileTracker);
                        fileTrackers.Add(fChangeTracker);
                    }
                    else
                    {
                        AddView(fileFullName, textView);
                    }
                }
                else
                {
                    fChangeTracker.Advise(textView);
                }
            }
        }
Пример #2
0
        private void OnRemFTracker(FileTrackerArgs args)
        {
            FileChangeTracker fChangeTracker = GetFChangeTracker(args.fileTracker.fileFullName);

            if (fChangeTracker != null)
            {
                fChangeTracker.UnAdvise();
                AddView(fChangeTracker.fileFullName, fChangeTracker.textView);
                fileTrackers.Remove(fChangeTracker);
            }
        }
Пример #3
0
        private void OnAddFTracker(FileTrackerArgs args)
        {
            IWpfTextView view = null;

            if (openedFiles.TryGetValue(args.fileTracker.fileFullName, out view))
            {
                FileChangeTracker fChangeTracker = GetFChangeTracker(args.fileTracker.fileFullName);
                if (fChangeTracker == null)
                {
                    fChangeTracker = new FileChangeTracker(view, args.fileTracker.fileFullName, args.fileTracker);
                    fileTrackers.Add(fChangeTracker);
                }
                openedFiles.Remove(args.fileTracker.fileFullName);
            }
        }