Sdílet prostřednictvím


Using DelayedFileSystemWatcher sample

See attached file for a sample on how to use DelayedFileSystemWatcher class described in my previous post FileSystemWatcher generates duplicate events - How to workaround

 

Program.cs

Comments

  • Anonymous
    February 08, 2006
    I'm using your class and there is a bug e the property Filter, you have

    public string Filter
    {
               get
               {
                   return this._fileSystemWatcher.Filter;
               }
               set
               {
                   this._fileSystemWatcher.Filter = this.Filter;
       }
    }

    and I think it should be

    public string Filter
    {
               get
               {
                   return this._fileSystemWatcher.Filter;
               }
               set
               {
                   this._fileSystemWatcher.Filter = value;
       }
    }

    to define a filter diferent than ....
  • Anonymous
    February 09, 2006
    Yes, that's true. Your fix is good.
    I'll update the file and re-upload it.
  • Anonymous
    June 11, 2006
    Hi Adrian,


    Great code! I really enjoyed how it is working. However I was trying to use the DelayedEvent class in Windwos Service. When compile I’m getting the following exception in InitializeComponent():

    ((System.ComponentModel.ISupportInitialize)(FileMonitor)).BeginInit();
    Unable to cast object of type 'DirectoryMonitorService.DelayedFileSystemWatcher' to type 'System.ComponentModel.ISupportInitialize. Make sure that the source type is convertible to the destination type.

    I was wondering if you can help in this issue. I’m new in the win service and not sure how to make that conversation.

    Thanks in advance!
    Rocko
  • Anonymous
    June 12, 2006
    The comment has been removed