Пример #1
0
 private void Model_ResultChanged(object sender, EventArgs e)
 {
     Info = string.Empty;
     if (Position == NumberOfMoves)
     {
         if (Model.Result.IsGameOverResult)
         {
             Rules.GameOverResult result = ((Rules.GameResult.GameOverResult)Model.Result).Item;
             if (result.IsDraw)
             {
                 Info = "Konec hry - remíza";
             }
             else if (result.IsVictory)
             {
                 Rules.Victory vict = ((Rules.GameOverResult.Victory)result).Item;
                 if (vict.IsBlackWinner)
                 {
                     Info = string.Format("Konec hry - zvítězil {0} (černý)", this.BlackPlayer.Name);
                 }
                 else if (vict.IsWhiteWinner)
                 {
                     Info = string.Format("Konec hry - zvítězil {0} (bílý)", this.WhitePlayer.Name);
                 }
                 else
                 {
                     Info = "Hra skončila bez vítěze - chyba aplikace ??";
                 }
             }
             else
             {
                 Info = "Hra skončila s neznámým vítězem - chyba aplikace ??";
             }
         }
     }
 }
Пример #2
0
 private void OnResultChanged()
 {
     Error = string.Empty;
     if (Model.Result.IsGameOverResult)
     {
         Rules.GameOverResult result = ((Rules.GameResult.GameOverResult)Model.Result).Item;
         if (result.IsDraw)
         {
             Info = "Konec hry - remíza";
         }
         else if (result.IsVictory)
         {
             Rules.Victory vict = ((Rules.GameOverResult.Victory)result).Item;
             if (vict.IsBlackWinner)
             {
                 Info = string.Format("Konec hry - zvítězil {0} (černý)", this.BlackPlayer.Name);
             }
             else if (vict.IsWhiteWinner)
             {
                 Info = string.Format("Konec hry - zvítězil {0} (bílý)", this.WhitePlayer.Name);
             }
             else
             {
                 Info = "Hra skončila bez vítěze - chyba aplikace ??";
             }
         }
         else
         {
             Info = "Hra skončila s neznámým vítězem - chyba aplikace ??";
         }
     }
     else
     {
         Info = string.Empty;
     }
 }