private void TournamentStartedHandler(object sender, TournamentStartedEventArgs e)
        {
            var tournamentStartedMessageXml = new TournamentStartedMessage
            {
                Games = e.Games.Select(x => new GameStartMessage
                {
                    GameId = x.GameId,
                    MaxMoves = x.MaxMoves,
                    Player1 = x.Player1,
                    Player2 = x.Player2
                }).ToArray()
            }.ToXml();

            foreach (var player in e.Players)
            {
                Connection.Send(new Message(player, tournamentStartedMessageXml));
            }
        }
Пример #2
0
 private void TournamentStartedHandler(object sender, TournamentStartedEventArgs e)
 {
     ShowTournamentWait = false;
     ShowTournamentList = true;
     _dispatcher.BeginInvoke(new Action(() => {
         foreach (var game in e.Games)
         {
             if (new Jid(game.Player1).Bare == _xmppHost.Connection.MyJID.Bare || new Jid(game.Player2).Bare == _xmppHost.Connection.MyJID.Bare || ((App)App.Current).IsServer)
             {
                 TournamentGamesInternal.Add(new TournamentGameItemViewModel
                 {
                     GameId = game.GameId,
                     MaxMoves = game.MaxMoves,
                     Player1 = new Jid(game.Player1).Bare,
                     Player2 = new Jid(game.Player2).Bare
                 });
             }
         }
     }), new object[] { });
 }