using System.Globalization; using System.Security.Claims; using Gremlin_BlazorServer.Data.EntityClasses; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Authorization; using NuGet.Packaging; namespace Gremlin_BlazorServer.Pages; public partial class LineItems { private readonly CultureInfo cultureInfo = new("de-DE"); private readonly IList lineItems=new List(); private LineItem selectedLineItem = new(); [CascadingParameter] private Task? AuthenticationStateTask { get; set; } protected override async Task OnInitializedAsync() { if (AuthenticationStateTask != null) { ClaimsPrincipal user = (await AuthenticationStateTask).User; if (user.Identity is{ IsAuthenticated: true }) { await ApplicationLoadingIndicatorService.Show(); lineItems.AddRange(await GenericController.GetAllAsync()); selectedLineItem = lineItems.First(); await OnSelectedLineItemChanged(selectedLineItem); await ApplicationLoadingIndicatorService.Hide(); } } } private async Task OnSelectedLineItemChanged(LineItem newSelectedLineItem) { await ApplicationLoadingIndicatorService.Show(); selectedLineItem = newSelectedLineItem; await ApplicationLoadingIndicatorService.Hide(); } }