Welcome to MSDN Blogs Sign in | Join | Help

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

 

Published Monday, February 06, 2006 8:44 PM by Adrian Hamza
Filed under:

Attachment(s): Program.cs

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

Thursday, February 09, 2006 5:23 AM by Pedro Rainho

# re: Using DelayedFileSystemWatcher sample

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 *.*...
Thursday, February 09, 2006 1:12 PM by Adrian Hamza

# Correct

Yes, that's true. Your fix is good.
I'll update the file and re-upload it.
Sunday, June 11, 2006 9:39 PM by Rocko

# re: Using DelayedFileSystemWatcher sample

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
Monday, June 12, 2006 1:37 PM by Adrian Hamza

# re: Using DelayedFileSystemWatcher sample

The DelayedFileSystemWatcher class was not derived from Component and it does not implement ISupportInitialize. That's the only difference when compared to FileSystemWatcher class. That's why you cannot call BeginInit, because there's no BeginInit method. You can probably try to implement this functionality yourself.

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker