Exemplo n.º 1
0
    private void Lobby_MemberJoined(object sender, MemberEventArgs e) {
      Dispatcher.Invoke(() => {
        var member = e.Member as QueueLobbyMember;
        if (member != null) {
          var player = new LobbyPlayer2(lobby.IsCaptain, member, 0);
          PlayerList.Children.Add(player);

          var players = PlayerList.Children.Cast<LobbyPlayer2>().ToList();
          foreach (var control in players) {
            PlayerList.Children.Remove(control);
            int index = lobby.Members.IndexOf(control.Member);
            PlayerList.Children.Insert(index, control);
          }
        } else {
          var player = new InvitedPlayer(e.Member as LobbyInvitee);
          InviteList.Children.Add(player);
        }
      });
    }
Exemplo n.º 2
0
        private void Lobby_MemberJoined(object sender, MemberEventArgs e)
        {
            Dispatcher.Invoke(() => {
                var member = e.Member as QueueLobbyMember;
                if (member != null)
                {
                    var player = new LobbyPlayer2(lobby.IsCaptain, member, 0);
                    PlayerList.Children.Add(player);

                    var players = PlayerList.Children.Cast <LobbyPlayer2>().ToList();
                    foreach (var control in players)
                    {
                        PlayerList.Children.Remove(control);
                        int index = lobby.Members.IndexOf(control.Member);
                        PlayerList.Children.Insert(index, control);
                    }
                }
                else
                {
                    var player = new InvitedPlayer(e.Member as LobbyInvitee);
                    InviteList.Children.Add(player);
                }
            });
        }