Exemplo n.º 1
0
 public async Task StopAsync()
 {
     if (Crawler == null)
     {
         throw new Exception("No Crawler task exists");
     }
     else if (Crawler.Status == TaskStatus.WaitingForActivation)
     {
         IsTerminated = true;
         await Crawler.ContinueWith((x) =>
         {
             Crawler.Dispose();
             Crawler = null;
         });
     }
     else if (Crawler.Status == TaskStatus.RanToCompletion)
     {
         throw new Exception("Crawler task is already Completed");
     }
 }