示例#1
0
        protected override void ShowMore()
        {
            request          = new GetUserScoresRequest(User.Value.Id, type, VisiblePages++, ItemsPerPage);
            request.Success += scores => Schedule(() =>
            {
                foreach (var s in scores)
                {
                    s.Ruleset = Rulesets.GetRuleset(s.RulesetID);
                }

                if (!scores.Any() && VisiblePages == 1)
                {
                    MoreButton.Hide();
                    MoreButton.IsLoading = false;
                    MissingText.Show();
                    return;
                }

                IEnumerable <DrawableProfileScore> drawableScores;

                switch (type)
                {
                default:
                    drawableScores = scores.Select(score => new DrawablePerformanceScore(score, includeWeight ? Math.Pow(0.95, ItemsContainer.Count) : (double?)null));
                    break;

                case ScoreType.Recent:
                    drawableScores = scores.Select(score => new DrawableTotalScore(score));
                    break;
                }

                LoadComponentsAsync(drawableScores, s =>
                {
                    MissingText.Hide();
                    MoreButton.FadeTo(scores.Count == ItemsPerPage ? 1 : 0);
                    MoreButton.IsLoading = false;

                    ItemsContainer.AddRange(s);
                });
            });

            Api.Queue(request);
        }