@using LANCommander.Launcher.Models @using System.Diagnostics @inject InstallService InstallService @inject SDK.Client Client @inject GameService GameService @if (CurrentQueueItem != null) {
@if (ShowIcon) {
}
@if (CurrentQueueItem.Status == SDK.Enums.GameInstallStatus.Downloading && CurrentQueueItem.Progress > 0) { @CurrentQueueItem.Status.GetDisplayName(): @CurrentQueueItem.Progress.ToString("0%") } else { @CurrentQueueItem.Status.GetDisplayName() }
@if (CurrentQueueItem.TransferSpeed > 0) {
@TimeSpan.FromSeconds((CurrentQueueItem.TotalBytes - CurrentQueueItem.BytesDownloaded) / CurrentQueueItem.TransferSpeed).ToShortTime()
}
@ByteSizeLib.ByteSize.FromBytes(CurrentQueueItem.BytesDownloaded).ToString() / @ByteSizeLib.ByteSize.FromBytes(CurrentQueueItem.TotalBytes).ToString()
@ByteSizeLib.ByteSize.FromBytes(CurrentQueueItem.TransferSpeed).ToString()/s
} @code { [Parameter] public bool ShowIcon { get; set; } IInstallQueueItem CurrentQueueItem = null; Stopwatch Stopwatch = new Stopwatch(); protected override async Task OnInitializedAsync() { InstallService.OnInstallComplete += async (game) => { Stopwatch.Stop(); }; InstallService.OnQueueChanged += async () => { CurrentQueueItem = InstallService.Queue.OrderByDescending(qi => qi.QueuedOn).FirstOrDefault(qi => qi.State); await InvokeAsync(StateHasChanged); await Task.Yield(); }; } }