Exemple #1
0
 public void SetGameOverWithComputer(string typeOfGameOver, string reason)
 {
     Application.Current.Dispatcher.Invoke(async() =>
     {
         if (typeOfGameOver == "win")
         {
             await Task.Run(() => _serverWorker.GameOverThisComputer(1101));
             GameInformation    = FIRST_PLAYER_WIN;
             string[] positions = reason.Split('-');
             SetSymbolInPlayingField(FirstGamerSymbol, positions[0], true, "#00FF7F");
             await Task.Delay(528);
             SetSymbolInPlayingField(FirstGamerSymbol, positions[1], true, "#00FF7F");
             await Task.Delay(528);
             SetSymbolInPlayingField(FirstGamerSymbol, positions[2], true, "#00FF7F");
             IsVisibleCancel = true;
         }
         else if (typeOfGameOver == "lose")
         {
             await Task.Run(() => _serverWorker.GameOverThisComputer(1102));
             GameInformation    = SECOND_PLAYER_WIN;
             string[] positions = reason.Split('-');
             SetSymbolInPlayingField(SecondGamerSymbol, positions[0], true, "#FA8072");
             await Task.Delay(528);
             SetSymbolInPlayingField(SecondGamerSymbol, positions[1], true, "#FA8072");
             await Task.Delay(528);
             SetSymbolInPlayingField(SecondGamerSymbol, positions[2], true, "#FA8072");
             IsVisibleCancel = true;
         }
         else
         {
             await Task.Run(() => _serverWorker.GameOverThisComputer(1103));
             GameInformation = DRAW;
             SetSymbolInPlayingField(SecondGamerSymbol, reason, false);
             IsVisibleCancel = true;
         }
     }, DispatcherPriority.Background);
 }