File System Watcher class
control에서 CrossThread에 의한 Side effect를 줄이고자 할 경우 다음과 같이 사용할 수 있다.
- CheckForIllegalCrossThreadCalls = false;
- FileSystemWatcher w = new FileSystemWatcher();
- //w.Path = path string
- w.NotifyFilter = NotifyFilters.LastAccess| NotifyFilters.LastWrite
- |NotifyFilters.FileName|NotifyFilters.DirectoryName;
- w.Filter = "*.jpeg";
- w.Changed += new FileSystemEventHandler(OnChanged);
- w.Created += new FileSystemEventHandler(OnChanged);
w.Deleted += new FileSystemEventHandler(OnChanged);
w.Renamed += new RenamedEventHandler(OnRenamed);
- // Begin watching.
watcher.EnableRaisingEvents = true;
// Wait for the user to quit the program.
Console.WriteLine("Press \'q\' to quit the sample.");
while(Console.Read()!='q');
이 글은 스프링노트에서 작성되었습니다.
'software' 카테고리의 다른 글
부사수의 코드 2탄 (0) | 2012.12.18 |
---|---|
내 부사수의 안타까운 코드 (0) | 2012.12.18 |
Facebook tableview cell 수정위치 (0) | 2010.10.26 |
exif read library (0) | 2009.08.04 |
image metadata (0) | 2009.08.03 |