Microsoft MVP성태의 닷넷 이야기
fileSystemWatcher 이벤트 관련 질문입니다 [링크 복사], [링크+제목 복사],
조회: 12597
글쓴 사람
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]

... 76  77  78  79  80  81  [82]  83  84  85  86  87  88  89  90  ...
NoWriterDateCnt.TitleFile(s)
439태기7/25/200613953    답변글 [답변]: IE를 가로채서 그리고 싶을때..(재질문) [1]파일 다운로드1
435이영균7/21/200614638작그마한 스마트클라이언트 프로젝트를 진행하고 있습니다. [1]파일 다운로드1
431혁이7/19/200613316UpdatePanel(Atlas)위의 SmartClient가 이벤트후 사라집니다. ㅜㅜ파일 다운로드1
432정성태7/19/200613675    답변글 [답변]: UpdatePanel(Atlas)위의 SmartClient가 이벤트후 사라집니다. ㅜㅜ
433혁이7/20/200614504        답변글 [답변]: [답변]: UpdatePanel(Atlas)위의 SmartClient가 이벤트후 사라집니다. ㅜㅜ
434정성태7/20/200615338            답변글 [답변]: [답변]: [답변]: UpdatePanel(Atlas) 위의 SmartClient가 이벤트 후 사라집니다. ㅜㅜ [1]
429kwt7/12/200614591ActiveX 개발을 배우고 싶은데요 [3]
427이홍자7/11/200614828스마트 클라이언트 실행 시 그리드의 체크박스가 안보여요.. [1]
426정보문7/11/200615408액티브X 설치2 [1]
423이방은7/9/200614285리소스 임베디드 질문요.. [1]파일 다운로드1
422guest7/6/200613790COM+에서 풀링을 사용할 경우... [1]파일 다운로드1
424guest7/10/200614656    답변글 소스 코드 입니다. [1]
425guest7/11/200613920        답변글 다시 올립니다.파일 다운로드1
428정성태7/11/200613725            답변글 [답변]: 다시 올립니다.
421정보문7/6/200614299액티브X 설치 [1]
1354허재호11/12/201415024    답변글 [답변]: 액티브X 설치
418임대진7/4/200613566이럴적 있으세요?
419정성태7/4/200613770    답변글 [답변]: 이럴적 있으세요?
417이방은6/29/200613504[질문]2.0에서 웹리소스에 대해서 [2]
416박영일6/29/200613707CAS 설정여부 [1]
415김인학6/28/200614260스마트 클라이언트에서 웹서비스를 호출하고 있습니다. [1]
413김성호6/28/200613924IE프로그램문제... [2]
411이진형6/27/200614209어셈블리 네임 알아내기 [2]
414정성태6/28/200613316    답변글 [답변]: 어셈블리 네임 알아내기
410이재원6/26/200613472자바스크립트 스마트클라이언트 이벤트 호출 [3]
412이재원6/27/200613604    답변글 [답변]: 자바스크립트 스마트클라이언트 이벤트 호출
... 76  77  78  79  80  81  [82]  83  84  85  86  87  88  89  90  ...