Exemplo n.º 1
0
        async public Task GetChallengeHistory(bool forceRefresh = false)
        {
            if (!forceRefresh && _hasLoadedBefore)
            {
                return;
            }

            using (new Busy(this))
            {
                ChallengeViewModel empty = null;
                if (Challenges.Count == 0)
                {
                    empty = new ChallengeViewModel()
                    {
                        EmptyMessage = "Loading previous challenges"
                    };

                    Challenges.Add(empty);
                }

                var task = AzureService.Instance.GetChallengesForMembership(Membership);
                await RunSafe(task);

                if (task.IsFaulted)
                {
                    return;
                }

                if (empty != null && Challenges.Contains(empty))
                {
                    Challenges.Remove(empty);
                }

                LocalRefresh(task.Result);
            }
        }