private async void fillgamelist() { _spheroGames = await SampleGameDataSource.GetGameGroupAsync("SpheroGroupID"); this.DefaultViewModel["AvailableSpheroGames"] = _spheroGames; }
private async Task GetSampleGameDataAsync() { if (this._gameGroups.Count != 0) return; if (App.Current.AllGames.Count != 0) { SampleGameDataGroup spheroGroup = new SampleGameDataGroup("SpheroGroupID", "Sphero Games", "/Assets/Logo.scale-100.png"); SampleGameDataGroup droneGroup = new SampleGameDataGroup("DroneGroupID", "Drone Games", "/Assets/Logo.scale-100.png"); foreach (Game g in App.Current.AllGames) { if (g.GameState == 0 || g.GameState == null) { if (g.DronePlayer.UserName == App.Current.AppUser.UserName) { droneGroup.GameItems.Add(g); } if (g.SpheroPlayer.UserName == App.Current.AppUser.UserName) { spheroGroup.GameItems.Add(g); } } } this.gameGroups.Add(spheroGroup); this.gameGroups.Add(droneGroup); } }
/// The methods provided in this section are simply used to allow /// NavigationHelper to respond to the page's navigation methods. /// /// Page specific logic should be placed in event handlers for the /// <see cref="GridCS.Common.NavigationHelper.LoadState"/> /// and <see cref="GridCS.Common.NavigationHelper.SaveState"/>. /// The navigation parameter is available in the LoadState method /// in addition to page state preserved during an earlier session. protected async override void OnNavigatedTo(NavigationEventArgs e) { navigationHelper.OnNavigatedTo(e); // TODO: Assign a collection of bindable groups to this.DefaultViewModel["Groups"] _spheroGames = await SampleGameDataSource.GetGameGroupAsync("SpheroGroupID"); this.DefaultViewModel["AvailableSpheroGames"] = _spheroGames; }