public async Task GetGames() { try { if (IsBusy) { return; } IsBusy = true; var gamesService = new GamesService(); var games = await gamesService.GetGamesAsync(Constants.GetGamesUri(_selectedDay)); GamesList.Clear(); foreach (var game in games) { GamesList.Add(new GameViewModel() { GameModel = game }); } int sI = GamesList.Count / 2; SelectedGame = GamesList[sI]; } catch (Exception ex) { Debug.WriteLine("Error : " + ex.Message); } finally { IsBusy = false; } }
public async Task SearchGames(bool replace) { Messenger.Publish(new ProgressBarActivator(this, true)); if (replace) { FetchedPages = 0; GamesList = new MvxObservableCollection <GameWithImageRowModel>(); } var listRowModels = await _gameService.GetGamesByCategory(new GameCategoryRequest { Skip = FetchedPages *StaticAppSettings.PullDataPageSize, Take = StaticAppSettings.PullDataPageSize, GameCategory = GameCategoryModel.GameCategory }); if (listRowModels != null) { foreach (var rowModel in listRowModels) { GamesList.Add(new GameWithImageRowModel(rowModel)); } FetchedPages++; } Messenger.Publish(new ProgressBarActivator(this, false)); }
public override async Task Initialize() { Messenger.Publish(new ProgressBarActivator(this, true)); var gamesForUser = await _gameService.GetGamesForUser(); foreach (var game in gamesForUser) { GamesList.Add(new GameWithImageRowModel(game)); } Messenger.Publish(new ProgressBarActivator(this, false)); }
private void AddGame() { var game = new GameModel() { GameId = this.GameId }; game = _gameData.GetGame(game); if (game != null) { foreach (var item in GamesList) { if (item.GameId == game.GameId) { return; } } GamesList.Add(game); _cache.CachedUser.AvailableGames.Add(game); } }
public void AddGame(Game game) { GamesList.Add(game); }