Beispiel #1
0
        private void SocketClientOnGuessResponse(object source, EventArgs args)
        {
            var e = (MatchEventArgs)args;

            if (e.Valid)
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    CanStillGuess = false;
                    SoundService.PlayWordGuessedRight();
                    if (Mode == GameModes.FFA)
                    {
                        OnNewCanavasMessage((String)CurrentDictionary["RightGuessFFA"]);
                    }
                });
            }
            else
            {
                if (Mode == GameModes.FFA || HealthPoint > 1)
                {
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        CanStillGuess = false;
                        OnNewCanavasMessage($"{CurrentDictionary["TryAgain"]}");
                        SoundService.PlayWordGuessedWrong();
                    });
                    Task.Delay(2000).ContinueWith((t) =>
                    {
                        if (_roundStarted)
                        {
                            Application.Current.Dispatcher.Invoke(() =>
                            {
                                CanStillGuess = true;
                                //Refresh command
                                CommandManager.InvalidateRequerySuggested();
                            });
                        }
                    });
                }
            }
        }