Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void InitializeWatcher()
- {
- watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
- | NotifyFilters.FileName | NotifyFilters.DirectoryName;
- watcher.Filter = "*.*";
- watcher.Changed += new FileSystemEventHandler(OnChanged);
- watcher.Created += new FileSystemEventHandler(OnCreated);
- watcher.Deleted += new FileSystemEventHandler(OnDeleted);
- watcher.Renamed += new RenamedEventHandler(OnRenamed);
- watcher.EnableRaisingEvents = true;
- }
- private void OnDeleted(object sender, FileSystemEventArgs e)
- {
- SetBalloonTip("File Eliminato");
- notifyIcon1.ShowBalloonTip(1);
- ((FileSystemWatcher)sender).Deleted -= new FileSystemEventHandler(OnDeleted);
- timerRepeat.Interval = 500;
- timerRepeat.Elapsed += new ElapsedEventHandler(t_Elapsed);
- timerRepeat.Start();
- }
- void t_Elapsed(object sender, ElapsedEventArgs e)
- {
- ((System.Timers.Timer)sender).Stop();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement