public async Task <IActionResult> Cancel() { var user = await this._userManager.FindByNameAsync(this.User.Identity.Name); var watchCmd = new WatchCommand(this._serviceProvider, user.ChatId); await watchCmd.Execute("stop"); return(RedirectToAction("List")); }
public async Task <IActionResult> Watch(string userName) { var user = await this._userManager.FindByNameAsync(this.User.Identity.Name); var watchCmd = new WatchCommand(this._serviceProvider, user.ChatId); watchCmd.Execute().Wait(); //var watchCmd2 = new PrepareToAttackCommand(this.serviceProvider, user.ChatId); //watchCmd2.Start = DateTimeOffset.Now.AddMinutes(1); //Task.WhenAll(watchCmd.Execute(), watchCmd2.Execute()); //await Task.Delay(10000); //var statusCmd = new StatusCommand(this.serviceProvider, user.ChatId); //statusCmd.Execute(); //await Task.Run(() => //{ // watchCmd.Execute(); // watchCmd2.Execute(); //}); return(RedirectToAction("List")); //WatchResponse response; //try //{ // response = await client.Watch(userName); // if (response.IsUserUnderAttack) // { // try // { // var notifications = await notificationRepo.GetIncomingAttacksAndScans(userName); // return View("NotificationsList", notifications); // } // catch (Exception exc) // { // this.logger.LogError(LoggingEvents.DbOpertationException, exc, "Unable to complete request to WEB API service. Method: Watch."); // } // } //} //catch (Exception exc) //{ // response = new WatchResponse // { // Error = "Something went wrong with completing the Watch request to WEB API service.", // Status = BotStatus.Error // }; // this.logger.LogError(LoggingEvents.WebApiException, exc, "Unable to complete request to WEB API service. Method: Watch."); //} //return View(response); }
public void Given_that_Frankie_is_watching_my_folder() { var options = new WatchOptions { Output = BasePath + "/_site", Source = BasePath, DontWaitForCommand = true }; var command = new WatchCommand(); WatchCommand = command; command.ExecuteCommand(options); }