public async Task <bool> LogPlay(PlayItemDataItem play) { if (string.IsNullOrEmpty(_Username)) { return(false); } string password = AppSettings.Singleton.UserPasswordSetting; if (string.IsNullOrEmpty(_Username)) { return(false); } return(await Client.LogPlay(_Username, password, play.GameId, play.PlayDate, play.NumPlays, play.Comments, play.Length)); }
private async void LoadPlays() { UserPlaysHub.Clear(); UserPlays.Clear(); if (string.IsNullOrEmpty(_Username)) { return; } int MaxPlaysHub = 10; IEnumerable <PlayItem> items = await Client.LoadLastPlays(_Username); //int ItemsToGet = Math.Min(items.Count(), 50); int ItemsToGet = items.Count(); for (int i = 0; i < ItemsToGet; i++) { PlayItemDataItem play = new PlayItemDataItem() { Name = items.ElementAt(i).Name, NumPlays = items.ElementAt(i).NumPlays, GameId = items.ElementAt(i).GameId, PlayDate = items.ElementAt(i).PlayDate, }; UserPlays.Add(play); if (i < MaxPlaysHub) { UserPlaysHub.Add(play); } } try { // Separately load games through cache foreach (PlayItemDataItem pi in UserPlays) { BoardGameDataItem game = await LoadGame(pi.GameId); pi.Thumbnail = game.Thumbnail; } } catch (Exception) { } }
public async Task<bool> LogPlay(PlayItemDataItem play) { if (string.IsNullOrEmpty(_Username)) return false; string password = AppSettings.Singleton.UserPasswordSetting; if (string.IsNullOrEmpty(_Username)) return false; return await Client.LogPlay(_Username, password, play.GameId, play.PlayDate, play.NumPlays, play.Comments, play.Length); }
private async void LoadPlays() { UserPlaysHub.Clear(); UserPlays.Clear(); if (string.IsNullOrEmpty(_Username)) return; int MaxPlaysHub = 10; IEnumerable<PlayItem> items = await Client.LoadLastPlays(_Username); //int ItemsToGet = Math.Min(items.Count(), 50); int ItemsToGet = items.Count(); for (int i = 0; i < ItemsToGet; i++) { PlayItemDataItem play =new PlayItemDataItem() { Name = items.ElementAt(i).Name, NumPlays = items.ElementAt(i).NumPlays, GameId = items.ElementAt(i).GameId, PlayDate = items.ElementAt(i).PlayDate, }; UserPlays.Add(play); if (i < MaxPlaysHub) UserPlaysHub.Add(play); } try { // Separately load games through cache foreach (PlayItemDataItem pi in UserPlays) { BoardGameDataItem game = await LoadGame(pi.GameId); pi.Thumbnail = game.Thumbnail; } } catch (Exception) { } }
private void ResetCurrentPlay() { CurrentPlay = new PlayItemDataItem(); CurrentPlay.PlayDate = DateTime.Today; CurrentPlay.NumPlays = 1; if (CurrentGame != null) { CurrentPlay.GameId = CurrentGame.GameId; CurrentPlay.Thumbnail = CurrentGame.Thumbnail; CurrentPlay.Name = CurrentGame.Name; } }