File System Watcher problem referencing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • philip Montgome
    New Member
    • Mar 2011
    • 8

    File System Watcher problem referencing

    I have this code to create multiple filesystemwatch ers and store them in an array list but I need to be able to reference an individual watcher to disable raising events while I complete another process. Does anyone know how to achieve this?.

    Thanks

    Code:
            protected void CreateWatchers()
            {
                Logtext("Create Watchers");
    
    
                foreach (string s in watchers)
                {
    
    
                    System.IO.FileSystemWatcher Clientwatcher = new System.IO.FileSystemWatcher();
    
                    Clientwatcher.Path = s;
    
                    Clientwatcher.Filter = "*.FIDEF";
    
                    //Clientwatcher.NotifyFilter = NotifyFilters.
    
                    Clientwatcher.IncludeSubdirectories = false;
    
                    Clientwatcher.Created += new FileSystemEventHandler(FileWatcherUpdated);
    
                    //Clientwatcher.Changed += new FileSystemEventHandler(FileWatcherUpdated);
    
                    Clientwatcher.EnableRaisingEvents = true;
    
                    fw.Add(Clientwatcher);
    
                   
                }
  • bukkko
    New Member
    • Jan 2012
    • 1

    #2
    Hi,

    I'm trying to do something similar with multiple watchers.
    did you ever find out how to do this?
    Also I'd like to know where would you place the above code, as putting code in the InitializeCompo nent method is not allowed.

    Thanks

    Comment

    Working...