Example #1
0
 public void EndGame()
 {
     _gameToken.Cancel();
     _needColor = null;
     OnChangeNeedColor?.Invoke(null);
     OnChangeActivePanelColor?.Invoke(null);
 }
Example #2
0
 private async Task GameCycle(CancellationToken cancellationToken)
 {
     do
     {
         var color = _colorRepository.GetRandomColor();
         OnChangeActivePanelColor?.Invoke(color);
         try
         {
             await Task.Delay(700, cancellationToken).ConfigureAwait(false);
         }
         catch
         {
             //Ignor
         }
     } while (!cancellationToken.IsCancellationRequested);
 }