ATMLUtilitiesLibrary.UTRSFileWatcher.WatchFile C# (CSharp) Метод

WatchFile() публичный Метод

public WatchFile ( UTRSFileWatchable sender, string documentPath, string documentName ) : void
sender UTRSFileWatchable
documentPath string
documentName string
Результат void
        public void WatchFile( UTRSFileWatchable sender, string documentPath, string documentName )
        {
            if (!_fileWatchers.ContainsKey( sender ))
            {
                var watcher = new FileSystemWatcher();
                watcher.Path = documentPath;
                watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName |
                                       NotifyFilters.DirectoryName;
                // Only watch text files.
                watcher.Filter = documentName;
                watcher.Changed += sender.FileChanged;
                watcher.Created += sender.FileCreated;
                watcher.Deleted += sender.FileDeleted;
                watcher.Renamed += sender.FileRenamed;
                watcher.EnableRaisingEvents = true;
                _fileWatchers.Add( sender, watcher );
            }
        }