FileSystemWatcher fires events for parent directory?

Last post 07-24-2008 8:01 by tulltrade. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 07-24-2008 8:01

    FileSystemWatcher fires events for parent directory?

    Hello,

     I've been playing with the FileSystemWatcher in OpenNETCF.IO v2.2.  For some reason, all events are fired in the parent directory of the path specified.  I tried setting IncludeSubdirectories to false without success, and even with it set to false events were fired on child directories as well.  This may be difficult to duplicate, but here is the code used (Note: I'm using VS 2005 Team Suite, developing for Windows Mobile 5.0 using .NET CF 2.0, OpenNETCF.dll runtime v2.0.50727): 

    public partial class tmMain : Form

    {

    public FileSystemWatcher tmWatcher;
    public tmMain()

    {

    InitializeComponent();

    appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
    tmWatcher = new FileSystemWatcher(appPath, "*.*");

    tmWatcher.IncludeSubdirectories = true;

    tmWatcher.Deleted += new OpenNETCF.IO.FileSystemEventHandler(this.thalesmanWatcher_Deleted);

    tmWatcher.Created += new OpenNETCF.IO.FileSystemEventHandler(this.thalesmanWatcher_Created);

    tmWatcher.Changed += new OpenNETCF.IO.FileSystemEventHandler(this.thalesmanWatcher_Changed);

    tmWatcher.EnableRaisingEvents = true;

    }

    ...

    }

     

    Thanks for any suggestions!

Page 1 of 1 (1 items)