System.IO.FileSystemWatcher.BeginInit C# (CSharp) Méthode

BeginInit() public méthode

public BeginInit ( ) : void
Résultat void
        public void BeginInit()
        {
            bool oldEnabled = _enabled;
            StopRaisingEvents();
            _enabled = oldEnabled;
            _initializing = true;
        }

Usage Example

Exemple #1
0
        public FileWatcher(string directory, string filter)
        {
            _dispatcher = Dispatcher.CurrentDispatcher;

            _watcher = new FileSystemWatcher();
            _watcher.BeginInit();
            _watcher.Path = directory;
            _watcher.Filter = filter;
            _watcher.IncludeSubdirectories = false;
            _watcher.InternalBufferSize = InitialBufferSize;

            _watcher.NotifyFilter
                = NotifyFilters.DirectoryName
                | NotifyFilters.FileName
                | NotifyFilters.LastWrite
                | NotifyFilters.Attributes
                | NotifyFilters.Security
                | NotifyFilters.Size;

            // note: all events are on threadpool threads!
            _watcher.Created += onCreated;
            _watcher.Deleted += onDeleted;
            _watcher.Changed += onChanged;
            _watcher.Renamed += onRenamed;
            _watcher.Error += onError;

            _watcher.EndInit();

            _watcher.EnableRaisingEvents = true;
        }
All Usage Examples Of System.IO.FileSystemWatcher::BeginInit