public Model(IView view, MyFolder folder = null) { if (folder == null) { folder = Factory.GetSpecialFolder(Environment.SpecialFolder.MyDocuments); } if (!folder.Exists) { throw new MyDirectoryNotFoundException(folder.FullPath); } directoryViewerSource = new DirectoryViewerSource(folder); InitializateView(view); myWatcher = new MyWatcher(folder, false); myWatcher.OnFileDelete += (sender, e, path) => { directoryViewerSource.Refresh(); ModelChange(GetArgs()); }; //myWatcherChange; myWatcher.OnFileCreate += (sender, e, path) => { directoryViewerSource.Refresh(); ModelChange(GetArgs()); }; myWatcher.OnFileModify += (sender, e, path) => { directoryViewerSource.Refresh(); ModelChange(GetArgs()); }; myWatcher.EnableRaisingEvents = true; }
private void Initialization() { watcher1 = new MyWatcher(folder1, true); watcher2 = new MyWatcher(folder2, true); MergeFolders(directoryPath1, directoryPath2); watcher1.OnFileCreate += Handler; watcher1.OnFileDelete += Handler; watcher1.OnFileModify += Handler; watcher2.OnFileCreate += Handler; watcher2.OnFileDelete += Handler; watcher2.OnFileModify += Handler; watcher1.EnableRaisingEvents = true; watcher2.EnableRaisingEvents = true; }