Example #1
0
 public WebCrawlerViewModel()
 {
     _model         = new WebCrawlerModel();
     ClickerCommand = new RelayCommand(() =>
     {
         _clickerCount++;
         OnPropertyChanged("ClickerValue");
     });
     ClickerResetCommand = new RelayCommand(() =>
     {
         _clickerCount = 0;
         OnPropertyChanged("ClickerValue");
     });
     StartCommand = new AsyncCommand(async() =>
     {
         if (StartCommand.CanExecute)
         {
             StartCommand.CanExecute = false;
             try
             {
                 CrawlResult = await _model.ExecuteCrawlingAsync();
             }
             catch (CrawlConfigException e)
             {
                 StatusValue = $"Config error, Restart your program! ({e.Message})";
             }
             catch (Exception e)
             {
                 StatusValue = $"Error! {e.Message}";
             }
             StartCommand.CanExecute = true;
         }
     });
 }