別のアプリケーションの背後にあるバックグラウンド(filesystemwatcherを使用)で、Windows Mobile 6.1デバイス上で実行するアプリケーション(c#で記述)を取得しようとしています。私は単純なfilesystemwatcherを作成しました。これは、現在のアプリケーションである限り(つまり、その後に別のプログラムを開かない限り)うまく機能します。インスタンスに戻った後でも、filesystemwatcherは機能しなくなります。.net cfにはファイルシステムウォッチャーが含まれていないため、OpenNETCFを使用します。
なぜこれが機能しないのか誰もが知っていますか?
どんな助けでも大歓迎です。
これが私のコードです:
private void Form1_Load(object sender, EventArgs e)
{
OpenNETCF.IO.FileSystemWatcher f = new OpenNETCF.IO.FileSystemWatcher(@"c:\happydays", "*.*");
f.IncludeSubdirectories = true;
f.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite |
NotifyFilters.FileName | NotifyFilters.DirectoryName;
f.Created += new FileSystemEventHandler(File_Created);
f.EnableRaisingEvents = true;
}
private void File_Created(object sender, OpenNETCF.IO.FileSystemEventArgs e)
{
MessageBox.Show("File Created");
}