Esempio n. 1
0
 private void StartPolling(CancellationToken cancellationToken)
 {
     Task.Factory.StartNew(async() =>
     {
         while (!cancellationToken.IsCancellationRequested)
         {
             try
             {
                 await _httpTransport.GetAsync(_httpUri, CancellationToken.None).ConfigureAwait(false);
             }
             catch
             {
                 OnTransportClosed();
                 throw;
             }
         }
     }, TaskCreationOptions.LongRunning);
 }