예제 #1
0
        public LobbyWindow(string username, string password)
        {
            this.username = username;
            InitializeComponent();
            LobbyProxy = new LobbyClient(new InstanceContext(this));
            LobbyProxy.SubscribeToLobbyEvents(username, password);

            labelUsername.Content = "Welcome " + username;

            // Get online players and show them in the list
            var onlinePlayers = LobbyProxy.GetOnlineList();

            if (onlinePlayers.Count() > 0)
            {
                inviteButton.IsEnabled = true;
            }

            foreach (var item in onlinePlayers)
            {
                listOnlinePlayers.Children.Add(new PlayerListElementControl(item));
            }

            if (LobbyProxy.GetSavedGmes(username).Count == 0)
            {
                SavedGameList.Items.Add("No Saved Game..");
            }
            else
            {
                foreach (var item in LobbyProxy.GetSavedGmes(username))
                {
                    SavedGameList.Items.Add(item);
                }
            }
        }