예제 #1
0
        async public Task GetChallengeHistory(bool forceRefresh = false)
        {
            using (new Busy(this))
            {
                ChallengeViewModel empty = null;
                if (Challenges.Count == 0)
                {
                    empty = new ChallengeViewModel()
                    {
                        EmptyMessage = "Loading previous challenges"
                    };

                    Challenges.Add(empty);
                }

                if (forceRefresh)
                {
                    await AzureService.Instance.GameResultManager.PullLatestAsync().ConfigureAwait(false);

                    await AzureService.Instance.ChallengeManager.PullLatestAsync().ConfigureAwait(false);
                }

                var list = await AzureService.Instance.ChallengeManager.Table.Where(c => c.DateCompleted != null &&
                                                                                    (c.ChallengerAthleteId == Membership.AthleteId || c.ChallengeeAthleteId == Membership.AthleteId) &&
                                                                                    c.LeagueId == Membership.LeagueId)
                           .OrderByDescending(c => c.DateCompleted).ToListAsync();

                Challenges.Clear();
                list.ForEach(c => Challenges.Add(new ChallengeViewModel {
                    Challenge = c
                }));

                if (Challenges.Count == 0)
                {
                    Challenges.Add(new ChallengeViewModel {
                        EmptyMessage = "There are no previous challenges."
                    });
                }
            }
        }
예제 #2
0
 public void DeleteChallenges()
 {
     Challenges.Clear();
 }