@using LANCommander.Launcher.Models @using LANCommander.SDK.Services @using RedistributableService = LANCommander.Launcher.Services.RedistributableService @using GameService = LANCommander.Launcher.Services.GameService @inject InstallService InstallService @inject SDK.Client Client @if (CurrentQueueItem != null) {
@if (ShowIcon) {
}
@if (Progress.Status == SDK.Enums.InstallStatus.Downloading && Progress.Progress > 0) { @Progress.Status.GetDisplayName() @Progress.Title: @Progress.Progress.ToString("0%") } else { @Progress.Status.GetDisplayName() }
@if (Progress.TransferSpeed > 0) {
@Progress.TimeRemaining.ToString(@"hh\:mm\:ss")
}
/
/s
} @code { [Parameter] public bool ShowIcon { get; set; } IInstallQueueItem CurrentQueueItem = null; InstallProgress Progress = new(); protected override async Task OnInitializedAsync() { InstallService.OnProgress += async (progress) => { Progress = progress; if (Progress.Progress < 0) Progress.Progress = 0; await InvokeAsync(StateHasChanged); await Task.Yield(); }; InstallService.OnQueueChanged += async () => { CurrentQueueItem = InstallService.Queue.OrderByDescending(qi => qi.QueuedOn).FirstOrDefault(qi => qi.State); await InvokeAsync(StateHasChanged); await Task.Yield(); }; } }