コード例 #1
0
        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");
            }
        }
コード例 #2
0
ファイル: SynchWatcher.cs プロジェクト: moonwa/moonlit.tools
 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;
 }