

String contents = "A File '" + e.OldName +"' in '" + folderWatch.Path + "' has been Renamed to '"+e.Name + "' at " + ("ddd, dd-MMM-yyyy") + " " + () Void folderWatch_Renamed(object sender, RenamedEventArgs e) ShowMessageBox(contents, "File Renamed") String contents = "A File '" + e.Name + "' in '" + folderWatch.Path + "' has been Deleted at " + ("ddd, dd-MMM-yyyy") + " " + () Void folderWatch_Deleted(object sender, FileSystemEventArgs e) The Different event handlers of the FileSystemWatcher are given below

NotifyIcon1.ShowBalloonTip(20, "Initiotech's Folder Watcher is Hidden Here", "Double Click To Show Options Again", ToolTipIcon.Info)

This.WindowState = FormWindowState.Minimized įolderWatch.Created += new FileSystemEventHandler(folderWatch_Created) įolderWatch.Renamed += new RenamedEventHandler(folderWatch_Renamed) įolderWatch.Deleted += new FileSystemEventHandler(folderWatch_Deleted) MessageBox.Show("Form Will Now Be Hidden in the Notify Area in the TaskBar","Form is Going to Be Hidden") Private void button2_Click(object sender, EventArgs e) The Start watching button has the following cod e. if you want to show the form again just double click the icon.Ģ) Notify Me Of Changes :- Will show message boxes when changes occur inģ)Do Not Save Changes :-Will not save changes to the File.

Now that the Path has been selected you can now click the "Start Watching"button.Before that you can check the options that you want to select.ġ) Hide and Watch :- Will hide the form and a icon will be placed in the Notify Area in the Task Bar. Private void button1_Click(object sender, EventArgs e)įolderBrowserDialog fbd = new FolderBrowserDialog() įbd.Description = "Choose a Folder to Watch" The Browse Button That is there Next to the TextBox shows a FolderBrowser Dialog which allows user to Choose the Folder to be Watched ,Once the user chooses the Folder the Path of the Folder gets displayed in the TextBox. I have declared two Boolean Variables to check whether the user has selected the Options to Show Notifications and to Save Changes to File. Public void SaveChangesToFile(string content)
FILEWATCHER APPLICATION CODE
