public MainWindow() { updateHandler = new UpdateHandler(this); Application.ThreadException += new ThreadExceptionEventHandler(GlobalThreadExceptionHandler); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(GlobalUnhandledExceptionHandler); try { SilentUpdater updater = new SilentUpdater(); if (updater.NeedsUpdate()) { updater.DownloadUpdater(); Process.Start("UpPhotoUpdater.exe"); } else { SetUpAndRunUpPhoto(); } } catch (System.Net.WebException) { SetUpAndRunUpPhoto(); } catch (System.Exception ex) { ErrorHandler.LogException(ex); SetUpAndRunUpPhoto(); } }
public WatchedFolder(string path, MainWindow newParent) { parent = newParent; handler = parent.updateHandler; watcher = new FileSystemWatcher(path); watcher.Filter = "*.*"; watcher.IncludeSubdirectories = true; watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.LastAccess; watcher.SynchronizingObject = parent.gui; watcher.Changed += FileChangedEvent; watcher.Created += FileCreatedEvent; watcher.InternalBufferSize = 64000; watcher.EnableRaisingEvents = true; }