Title: Windows Forms-Lesson 10-File System Watcher 2
Duration: 20 minutes
Summary: In this video, we wrap up the FileSystemWatcher part of the application. We added code for OnChanged, OnRenamed, ThreadMethodSafe, and SetText. The reason we needed threads in this case was that Controls in Windows Forms are bound to a specific thread and are not thread safe. Therefore, if you are calling a control's method from a different thread, you must use one of the control's invoke methods to marshal the call to the proper thread. This property can be used to determine if you must call an invoke method, which can be useful if you do not know what thread owns a control. Finally, we implemented the method that writes to the eventlog. We intentionally threw an exception, and in the catch block, we wrote an entry into the EventLog.
Methodology of the development of example: Good coding standard and simplified design to illustrate the key points.
Technology Used: Windows Forms and .NET 3.5
Keywords: Form, FileSystemWatcher, CheckBox, Help File, EventLog, NotifyFilters, FileSystemEventHandler, Filter, Thread, RenamedEventArgs, ParameterizedThreadStart, Environment.








See the prices for this post in Mr.Bool Credits System below: