public PlayerDetailsViewModel(LeaderboardViewEntry item)
        {
            Title = item.UserName;
            Item  = item;

            LatestMatches            = new ObservableRangeCollection <Match>();
            PlayerLeaderBoardHistory = new ObservableRangeCollection <PlayerLeaderboardEntry>();
            MatchesReceivedEgg       = new ObservableRangeCollection <Match>();
            MatchesGivenEgg          = new ObservableRangeCollection <Match>();

            LoadItemsCommand = new Command(async() => await ExecuteLoadCommand());
            LoadItemsCommand.Execute(this);
            SelectedLimit = LimitRanges.FirstOrDefault();
        }
Exemplo n.º 2
0
        private void GetStreak(IOrderedEnumerable <Match> matches, IEnumerable <LeaderboardViewEntry> entries, bool winStreak, out int streak, out LeaderboardViewEntry player)
        {
            player = null;
            int currentStreak = 0;

            streak = 0;

            foreach (var e in entries)
            {
                foreach (var match in matches)
                {
                    if (GetPlayers(match, winStreak).Contains(e.UserName))
                    {
                        currentStreak++;
                    }

                    if (GetPlayers(match, !winStreak).Contains(e.UserName))
                    {
                        if (currentStreak > streak)
                        {
                            streak = currentStreak;
                            player = e;
                        }

                        currentStreak = 0;
                    }
                }

                currentStreak = 0;
            }
        }