restsharing.blogg.se

Filewatcher application
Filewatcher application













filewatcher application

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

filewatcher application

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

filewatcher application

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.

filewatcher application

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

  • SaveChangesToFileThis method will write the changes made to a File named "ntent" created in the C:\ drive.The code below shows the declaration of the SaveChangesToFile method.
  • MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Information) Public void ShowMessageBox(string message, string caption)
  • ShowMessageBoxThis method will show the MessageBox for any changes made in the folder.The code given shows the declaration of the method "ShowMessageBox".
  • I have written Two Methods which do most of the notification functions. Source Code Information : The folder watcher is a very simple to develop application.Below I have explained some of the important code that will be useful for you to understand the working of this application. It is made using the FileSystemWatcher component. Initiotech's Folder Watcher is a Folder monitoring application that will keep on monitoring changes made to a Folder.If any changes are made to the folder their will be a MessageBox notifying about the Change.















    Filewatcher application