public WebCrawlerViewModel()
 {
     CurrentModel = new WebCrawlerModel();
     CurrentModel.ExceptionOccurance += HandleCriticalException;
     incrementCommand = new RelayCommand(CommandsImplementation.IncrementCounterForCheckingUI);
     crawlCommand     = new RelayCommand(CommandsImplementation.Crawl, CommandsImplementation.CanCrawling);
 }
Example #2
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;
         }
     });
 }
 public WebCrawlerViewModel()
 {
     webCrawlerModel = new WebCrawlerModel();
     CrawlingCommand = new StartCrawlingCommand(
         async() =>
     {
         if (CrawlingCommand.CanExecute(null))
         {
             CrawlingCommand.Disable();
             WebCrawlResult = await webCrawlerModel.GetWebCrawlingResultAsync();
             CrawlingCommand.Enable();
         }
     }
         );
 }