Problem with OpenNETCF.IO.FileSystemWatcher

Last post 03-01-2008 4:26 by henning. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 02-29-2008 7:39

    Problem with OpenNETCF.IO.FileSystemWatcher

    hi!

    to put it simply... the filesystemwatcher does not fire its events... i wrote a very simple application to test this:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using Airkom.Guard.MobileClient.Utilities;
    using OpenNETCF.IO;
    namespace filesystemwatchertest
    {
    public partial class Form1 : Form
    {
    private FileSystemWatcher fsw;
    public Form1()
    {
    InitializeComponent();
    //--> \Programme\filesystemwatchertest
    textBox1.Text = EnviromentTools.ApplicationPath;
    }
    void fsw_Deleted(object sender, FileSystemEventArgs e)
    {
    WatcherChangeTypes wct = e.ChangeType;
    }
    void fsw_Created(object sender, FileSystemEventArgs e)
    {
    WatcherChangeTypes wct = e.ChangeType;
    }
    void fsw_Changed(object sender, FileSystemEventArgs e)
    {
    WatcherChangeTypes wct = e.ChangeType;
    }
    private void button1_Click(object sender, EventArgs e)
    {
    fsw = new FileSystemWatcher(textBox1.Text, "*.*");
    fsw.IncludeSubdirectories = true;
    fsw.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite |
    NotifyFilters.FileName | NotifyFilters.DirectoryName;
    fsw.Changed += new FileSystemEventHandler(fsw_Changed);
    fsw.Created += new FileSystemEventHandler(fsw_Created);
    fsw.Deleted += new FileSystemEventHandler(fsw_Deleted);
    fsw.EnableRaisingEvents = true;
    }
    private void menuItem1_Click(object sender, EventArgs e)
    {
    this.Close();
    }
    }
    }

    i test by using active sync to copy files in the directory or delete them... when copying a file in the directory it does nothing... when deleting the file, the OnDeleted event is thrown as wanted... he does throw its events if i limit it to *.txt copy a txt file in the directory (nothing happens) and edit it with the editor...

    does anybody has the same problem or may help me?

    thx

    Filed under:
  • 02-29-2008 8:15 In reply to

    • Neil
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-30-2007
    • North Wales
    • Posts 1,152

    Re: Problem with OpenNETCF.IO.FileSystemWatcher

    I formatted your post so that people can easily read it.  

    Before we test your code, could you tell us which version of the Smart Device Framework you are using? 


  • 02-29-2008 18:16 In reply to

    Re: Problem with OpenNETCF.IO.FileSystemWatcher

    Oh! Sorry for forgetting that! Some months ago I started using the FileSystemWatcher with the SDF 2.0. There it worked as expected... Yesterday I upgraded to SDF 2.2 and ran into this problem... It seemed odd, so i first searched for a error on my side... Today i wrote the first mentioned simple testapplication to see it was my project or the FileSystemWatcher itself was the problem... I compiled the testapp on the WinMob 5 Emulator GER and an HTC Compact III. Both showed nearly the same behaviour... Has there been any changes to the FileSystemWatcher between SDF 2.0 and 2.2? thx in advance
    Filed under:
  • 02-29-2008 22:16 In reply to

    • ctacke
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-27-2007
    • Indiana
    • Posts 1,939

    Re: Problem with OpenNETCF.IO.FileSystemWatcher

     Please report this in our bug database so we can track, try to replicate and fix it.

    Filed under:
  • 03-01-2008 4:26 In reply to

    Re: Problem with OpenNETCF.IO.FileSystemWatcher

    ok! Done that. Hope it will be fixed soon (or somebody points out where i made the mistake in using it). thx
Page 1 of 1 (5 items)