public void EndGame() { _gameToken.Cancel(); _needColor = null; OnChangeNeedColor?.Invoke(null); OnChangeActivePanelColor?.Invoke(null); }
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); }