@using LANCommander.Client.Models @inject DownloadService DownloadService @inject NavigationManager NavigationManager @if (DownloadService.Queue.Any(qi => qi.State)) { In Progress @foreach (var queueItem in DownloadService.Queue.Where(qi => qi.State)) { @queueItem.Title } } Up Next @foreach (var queueItem in DownloadService.Queue.Where(qi => !qi.State && qi.Status == Enums.DownloadStatus.Idle)) { @queueItem.Title } @if (!DownloadService.Queue.Any(qi => qi.Status == Enums.DownloadStatus.Idle)) { } @if (DownloadService.Queue.Any(qi => !qi.State && qi.Status != Enums.DownloadStatus.Idle)) { Completed @foreach (var queueItem in DownloadService.Queue.Where(qi => !qi.State)) { @queueItem.Title @ByteSizeLib.ByteSize.FromBytes(queueItem.TotalBytes) View in Library } } @code { [Parameter] public bool Visible { get; set; } [Parameter] public EventCallback VisibleChanged { get; set; } protected override async Task OnInitializedAsync() { DownloadService.OnQueueChanged += async () => { StateHasChanged(); }; } async Task Remove(IDownloadQueueItem queueItem) { DownloadService.Remove(queueItem); } async Task ViewInLibrary(IDownloadQueueItem queueItem) { Visible = false; NavigationManager.NavigateTo("/" + queueItem.Id); } }