Microsoft MVP성태의 닷넷 이야기
fileSystemWatcher 이벤트 관련 질문입니다 [링크 복사], [링크+제목 복사],
조회: 11389
글쓴 사람
guest
홈페이지
첨부 파일
 

우문현답에 감사드리며
1.0.0.0 폴더에 test.txt 파일을 삭제 시도 시 MessageBox.Show("경고")를 띄우려하는데
안되네요 ㅜㅜ



   private FileSystemWatcher _fileSystemWatcher;
       

        private void Run_Watcher()
        {
            _fileSystemWatcher = new FileSystemWatcher(Application.LocalUserAppDataPath);
            

            _fileSystemWatcher.NotifyFilter = NotifyFilters.Attributes
                                 | NotifyFilters.CreationTime
                                 | NotifyFilters.DirectoryName
                                 | NotifyFilters.FileName
                                 | NotifyFilters.LastAccess
                                 | NotifyFilters.LastWrite
                                 | NotifyFilters.Security
                                 | NotifyFilters.Size;

            _fileSystemWatcher.Changed += OnChanged;
            _fileSystemWatcher.Created += OnCreated;
            _fileSystemWatcher.Deleted += OnDeleted;
            _fileSystemWatcher.Renamed += OnRenamed;
            _fileSystemWatcher.Error += OnError;

            _fileSystemWatcher.Filter = "*.txt";
            _fileSystemWatcher.IncludeSubdirectories = true;
            _fileSystemWatcher.EnableRaisingEvents = true;
        }
        private void btnFeileEvent_Click(object sender, EventArgs e)
        {
            Run_Watcher();
        }
        private static void OnDeleted(object sender, FileSystemEventArgs e)
        {
            
            MessageBox.Show("OnDeleted: " + e.FullPath);
        }








[최초 등록일: ]
[최종 수정일: 4/18/2023]


비밀번호

댓글 작성자
 



2023-04-18 07시50분
c:\temp 디렉터리로 해놓고 테스트해도 마찬가지인가요? 딱히 안 될 이유가 없는데요, Application.LocalUserAppDataPath 경로를 출력해 보시고 정확히 그 디렉터리에서 테스트한 것인지 확인해 보세요.
정성태
2023-04-18 07시56분
[guest] 이렇게 빨리 감사드립니다^^; 항상 대안을 제시해주시네요 c:\temp
[guest]

... 46  47  48  49  50  51  52  53  54  55  56  [57]  58  59  60  ...
NoWriterDateCnt.TitleFile(s)
1241(non...3/22/201421124(글쓴이의 요청으로 삭제합니다.) [4]
1240이석주3/21/201423810인터넷 익스플로러가 hang이 걸리는 현상 문의 [1]파일 다운로드1
1238(non...3/13/201417716(글쓴이의 요청으로 삭제합니다.) [2]
1237(non...3/11/201417753(글쓴이의 요청으로 삭제합니다.) [2]
1236(non...3/11/201418616(글쓴이의 요청으로 삭제합니다.) [2]
1235(non...3/10/201417714(글쓴이의 요청으로 삭제합니다.) [2]
1234(non...3/10/201420898(글쓴이의 요청으로 삭제합니다.) [3]
1233(non...3/9/201418579(글쓴이의 요청으로 삭제합니다.) [4]
1232(non...3/8/201417462(글쓴이의 요청으로 삭제합니다.) [2]
1231(non...3/7/201418754(글쓴이의 요청으로 삭제합니다.) [9]
1230POCO3/7/201419110쓰레드 안에서 DependencyProperty get, set시 또 다른 스레드 오류.. [1]
1229(non...3/6/201419778(글쓴이의 요청으로 삭제합니다.) [11]
1228POCO3/6/201417832안녕하세요. 질문이 있습니다. [1]
1226김형진3/4/201427975안녕하세요 windows azure에 관해 질문했던 사람입니다. [2]
1224(non...3/3/201423292(글쓴이의 요청으로 삭제합니다.) [11]
1223sadf...3/3/201417855아래 질문에 답변 감사드립니다. 한가지 더 궁금한점이 있어 질문드립니다. [1]
1222(non...3/2/201418318(글쓴이의 요청으로 삭제합니다.) [4]
1221(non...3/1/201418710(글쓴이의 요청으로 삭제합니다.) [2]
1220Until2/28/201417019질문드립니다. [1]
1219이성환2/28/201416488string.Join()과 Enumerable.Aggregate()의 차이가 궁금합니다. [2]파일 다운로드1
1218김형진2/25/201418296안녕하세요. window azure에 대해서 질문이 있어서 문의 드립니다 [4]
1217(non...2/23/201418895(글쓴이의 요청으로 삭제합니다.) [1]
1215아리수2/20/201422314C# 공부하면서 WPF에 대한 질문. [2]
1214조광훈2/20/201420314IIS8 응용프로그램 풀 관련 질문 드립니다. [2]파일 다운로드1
1213김태훈2/17/201417515가상화 프로그램 질문입니다. [1]파일 다운로드1
1212조광훈2/13/201416283ISAPI 필터에서 커스텀 헤더 정보 추가 [1]파일 다운로드1
... 46  47  48  49  50  51  52  53  54  55  56  [57]  58  59  60  ...