public MainViewModel() { try { App.Current.MainWindow.Closing += MainWindow_Closing; fileHelper = FileHelpers.Instance; fileHelper.MessageRaised += FileHelper_MessageRaised; watcher = Watcher.Instance(this); watcher.MessageRaised += Watcher_MessageRaised; watcher.Run(); } catch { #if DEBUG return; #endif throw new Exception("Could not start watcher"); } }
public async Task<int> Execute() { this._tasks = new List<ITask>(); _worker = new Task(Work); var srcPaths = this.Source.Split(';'); var destPaths = this.Destination.Split(';'); for (int i = 0; i < srcPaths.Length && i < destPaths.Length; i++) { Watcher watcher = new Watcher(this, srcPaths[i], destPaths[i]); watcher.Run(); } _worker.Start(); _resetEvent.WaitOne(); return 0; }