Kamal
Wed Dec 14 23:42:10 CST 2005
my device is i-mate pocket pc
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
// Create a new FileSystemWatcher and set its properties.
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = @"\My Documents\My Pictures";
/* Watch for changes in LastAccess and LastWrite times, and
the renaming of files or directories. */
watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
| NotifyFilters.FileName | NotifyFilters.DirectoryName;
// Only watch text files.
watcher.Filter ="*.*";
// Add event handlers.
watcher.Changed += new FileSystemEventHandler(OnChanged);
watcher.Created += new FileSystemEventHandler(OnCreated);
// Begin watching.
watcher.EnableRaisingEvents = true;
}
// Event handlers respond to events raised by FileSystemEventHandler
static void OnChanged(Object sender, FileSystemEventArgs e)
{
MessageBox.Show("changed");
}
private static void OnCreated(object sender, FileSystemEventArgs e)
{
MessageBox.Show("created");
}
}
thanks
kamal
"Peter Foot [MVP]" <feedback@nospam-inthehand.com> wrote in message
news:unARWwLAGHA.356@TK2MSFTNGP12.phx.gbl...
> What is your device? can you post a code snippet you are using?
>
> Peter
>
> --
> Peter Foot
> Windows Embedded MVP
> www.peterfoot.net | www.inthehand.com
>
> "Kamal Al-Haddad" <kamal.elhaddad@gmail.com> wrote in message
> news:uCgGmNKAGHA.1124@TK2MSFTNGP10.phx.gbl...
>> ok,I find it but haven't no response
>> plz, if any one know how to listen folder on my device <when any file
>> added or created in this folder>,by this class or by another way
>>
>> Thanks
>> Kamal
>>
>> "Peter Foot [MVP]" <feedback@nospam-inthehand.com> wrote in message
>> news:e8bz1bIAGHA.2148@TK2MSFTNGP10.phx.gbl...
>>> The OpenNETCF SDF has an implementation (for .NETCF v1.0 but will also
>>> work under v2.0) - www.opennetcf.org/sdf/
>>> I've been making some improvements to this for our SDF v2.0 release, the
>>> current code will work under .NETCF v2.0 with the exception of Created
>>> event which will not be raised, and the Renamed event will contain the
>>> old and new filenames in the wrong fields.
>>>
>>> Peter
>>>
>>> --
>>> Peter Foot
>>> Windows Embedded MVP
>>>
http://www.inthehand.com |
http://www.peterfoot.net
>>>
>>> "Kamal Al-Haddad" <kamal.elhaddad@gmail.com> wrote in message
>>> news:uWmQH3HAGHA.344@TK2MSFTNGP11.phx.gbl...
>>>>I want to use FileSystemWatcher class on .Net compact framework 2.0
>>>> I can use it on .Net Framework form
>>>> using System.IO
>>>> But when use it in compact framwork,error appear : can't find this
>>>> class or namespace
>>>>
>>>> Thank you,
>>>> Kamal
>>>>
>>>>
>>>
>>>
>>
>>
>
>