G
Guest
Hi All
Can I use FileSystemWatcher to monitor changes to the root directory of a memory card? I'm trying to detect insert/remove of memory card. Below is my snippet of code which does not seem to detect the event. Thanks in advance for your insights.
Ge
(e-mail address removed)
=============================================
// default to fals
IsFullFramework = false
#region FULL_FRAMEWOR
IsFullFramework = System.Environment.OSVersion.Platform != PlatformID.WinCE
#endregio
if (! IsFullFramework
string[] CFNames = StorageCard.GetStorageCardNames()
// IPaq has internal RAM card, first storage card is the external CF card
if (CFNames.Length < 2
MessageBox.Show("Please insert RAM Card", "Notice")
els
{
DirectoryInfo[] CFDirectoryList = StorageCard.GetStorageCards();
FileWatcher = new FileSystemWatcher(CFDirectoryList[0].FullName)
FileWatcher.Changed += new FileSystemEventHandler(fsw_Changed)
FileWatcher.Created += new FileSystemEventHandler(fsw_Changed)
FileWatcher.Deleted += new FileSystemEventHandler(fsw_Changed)
FileWatcher.EnableRaisingEvents = true
FileWatcher.IncludeSubdirectories = true
private void fsw_Changed(object sender, FileSystemEventArgs e
MessageBox.Show("Please insert RAM Card", "Notice")
Can I use FileSystemWatcher to monitor changes to the root directory of a memory card? I'm trying to detect insert/remove of memory card. Below is my snippet of code which does not seem to detect the event. Thanks in advance for your insights.
Ge
(e-mail address removed)
=============================================
// default to fals
IsFullFramework = false
#region FULL_FRAMEWOR
IsFullFramework = System.Environment.OSVersion.Platform != PlatformID.WinCE
#endregio
if (! IsFullFramework
string[] CFNames = StorageCard.GetStorageCardNames()
// IPaq has internal RAM card, first storage card is the external CF card
if (CFNames.Length < 2
MessageBox.Show("Please insert RAM Card", "Notice")
els
{
DirectoryInfo[] CFDirectoryList = StorageCard.GetStorageCards();
FileWatcher = new FileSystemWatcher(CFDirectoryList[0].FullName)
FileWatcher.Changed += new FileSystemEventHandler(fsw_Changed)
FileWatcher.Created += new FileSystemEventHandler(fsw_Changed)
FileWatcher.Deleted += new FileSystemEventHandler(fsw_Changed)
FileWatcher.EnableRaisingEvents = true
FileWatcher.IncludeSubdirectories = true
private void fsw_Changed(object sender, FileSystemEventArgs e
MessageBox.Show("Please insert RAM Card", "Notice")