//private async void RefreshLobbies() //{ // IEnumerable<DinnergeddonServiceReference.Lobby> lobbies = await _proxy.GetLobbies(); // // ObservableCollection<DinnergeddonServiceReference.Lobby> lobbies = new ObservableCollection<DinnergeddonServiceReference.Lobby> ((await _proxy.GetLobbies()).ToList()); // Lobbies = new ObservableCollection<DinnergeddonServiceReference.Lobby>(lobbies.Cast<DinnergeddonServiceReference.Lobby>()); //} private void OnLobbyDeleted(object sender, Guid lobbyId) { IsJoined = false; JoinedLobby = null; _proxy.GetLobbies(); }
public LobbiesViewModel() { _proxy = new LobbyProxy(); //_proxy.LobbyJoined += OnJoinLobby; _proxy.LobbyCreated += OnLobbyCreated; _proxy.LobbyUpdated += OnLobbyUpdated; // _proxy.GetLobbiesResponse += OnLobbiesRecieved; // _proxy.GetLobbyByIdResponse += OnLobbyRecieved; _proxy.LobbyDeleted += OnLobbyDeleted; _proxy.LobbiesRecieved += OnLobbiesRecieved; /// // _lobbies = new ObservableCollection<LobbyServiceReference.Lobby>(_proxy.GetLobbies()); //Lobbies = _lobbies; //_lobbies = new List<LobbyServiceReference.Lobby>(); customPrincipal = Thread.CurrentPrincipal as CustomPrincipal; Mediator.Subscribe("LobbyCreated", new Action <object>((x) => { App.Current.Dispatcher.Invoke((Action) delegate { cld.Close(); //JoinLobby(x); }); })); _proxy.GetLobbies(); //RefreshLobbies(); }