Ejemplo n.º 1
0
        private async void GetGlobalScores()
        {
            try
            {
                var scores = new List <Score>();

                TableQuery <ScoreEntity>  allScoresQuery = new TableQuery <ScoreEntity>();
                IEnumerable <ScoreEntity> allScores      = await _azureStorageService.GetAsync(GameConstants.AzureStorageScoreTable, allScoresQuery);

                scores = allScores.Select(m => new Score {
                    PlayerId = new Guid(m.PartitionKey), PlayerName = m.Name, Date = DateTime.Parse(m.RowKey), Points = m.Score
                }).ToList();

                _globalScores = scores.OrderByDescending(m => m.Points).Take(20).ToList();
            }
            catch (Exception e)
            {
                _globalScores = new List <Score>();
            }
            finally
            {
                _globalScoreIsLoaded = true;
            }
        }