Duration: 15:31 min
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.