コード例 #1
0
        protected override void OnInitialized()
        {
            editContext = new EditContext(customGameSettings);
            gameLevels  = GameLevelsService.GetGameLevels();

            selectedLevel = gameLevels.FirstOrDefault();
        }
コード例 #2
0
        protected override async Task OnInitializedAsync()
        {
            gameLevels    = GameLevelsService.GetGameLevels();
            selectedLevel = gameLevels.First().Name;
            var response = await HttpClient.GetAsync($"api/statistic/{selectedLevel}");

            if (response.IsSuccessStatusCode)
            {
                currentLevelStatistic = await response.Content.ReadFromJsonAsync <StatisticModel>();

                currentLevelStatistic.BestGames = currentLevelStatistic.BestGames.OrderBy(r => r.DurationInSeconds).ToList();
            }
            else if (response.StatusCode == HttpStatusCode.Unauthorized)
            {
                NavigationManager.NavigateTo("/login/statistics");
            }
        }