2024-08-04 17:53:19 -05:00
|
|
|
@using LANCommander.Launcher.Models
|
2024-10-26 15:48:47 -05:00
|
|
|
@inject InstallService InstallService
|
2024-06-11 00:26:17 -05:00
|
|
|
@inject NavigationManager NavigationManager
|
2024-05-25 15:40:31 -05:00
|
|
|
|
2024-12-31 18:21:41 -06:00
|
|
|
<Drawer Placement="DrawerPlacement.Bottom" Class="download-queue" @bind-Visible="@Visible" OnClose="Hide">
|
2024-06-11 00:26:17 -05:00
|
|
|
|
2024-10-26 15:48:47 -05:00
|
|
|
@if (InstallService.Queue.Any(qi => qi.State))
|
2024-05-27 17:07:28 -05:00
|
|
|
{
|
2024-06-11 00:26:17 -05:00
|
|
|
<h2>In Progress</h2>
|
2024-10-26 15:48:47 -05:00
|
|
|
@foreach (var queueItem in InstallService.Queue.Where(qi => qi.State))
|
2024-06-11 00:26:17 -05:00
|
|
|
{
|
|
|
|
|
<div class="queue-item">
|
|
|
|
|
<MediaImage Id="@queueItem.CoverId" Class="queue-item-cover" />
|
|
|
|
|
<div class="queue-item-info">
|
|
|
|
|
<div>
|
|
|
|
|
<h3>@queueItem.Title</h3>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="queue-item-current-download">
|
|
|
|
|
<CurrentDownloadItem />
|
2024-05-27 17:07:28 -05:00
|
|
|
</div>
|
2024-05-25 15:40:31 -05:00
|
|
|
</div>
|
2024-06-11 00:26:17 -05:00
|
|
|
}
|
2024-05-27 17:07:28 -05:00
|
|
|
}
|
2024-05-25 15:40:31 -05:00
|
|
|
|
2024-05-27 17:07:28 -05:00
|
|
|
<h2>Up Next</h2>
|
2025-01-31 00:34:37 -06:00
|
|
|
@foreach (var queueItem in InstallService.Queue.Where(qi => !qi.State && qi.Status == SDK.Enums.InstallStatus.Queued))
|
2024-05-27 17:07:28 -05:00
|
|
|
{
|
|
|
|
|
<div class="queue-item">
|
2024-06-11 00:26:17 -05:00
|
|
|
<MediaImage Id="@queueItem.CoverId" Class="queue-item-cover" />
|
2024-05-27 17:07:28 -05:00
|
|
|
<div class="queue-item-info">
|
|
|
|
|
<div>
|
2024-06-11 00:26:17 -05:00
|
|
|
<h3>@queueItem.Title</h3>
|
2024-05-27 17:07:28 -05:00
|
|
|
</div>
|
2024-05-25 15:40:31 -05:00
|
|
|
</div>
|
2024-06-11 00:26:17 -05:00
|
|
|
<div class="queue-item-actions">
|
2024-12-31 18:21:41 -06:00
|
|
|
<Button Icon="@IconType.Outline.Close" Size="ButtonSize.Large" Danger OnClick="() => Remove(queueItem)" />
|
2024-06-11 00:26:17 -05:00
|
|
|
</div>
|
2024-05-25 15:40:31 -05:00
|
|
|
</div>
|
2024-05-27 17:07:28 -05:00
|
|
|
}
|
2024-05-25 15:40:31 -05:00
|
|
|
|
2025-01-31 00:34:37 -06:00
|
|
|
@if (!InstallService.Queue.Any(qi => qi.Status == SDK.Enums.InstallStatus.Queued))
|
2024-05-27 17:07:28 -05:00
|
|
|
{
|
2024-06-11 00:26:17 -05:00
|
|
|
<Empty Simple Description="@("The queue is empty")" />
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-31 00:34:37 -06:00
|
|
|
@if (InstallService.Queue.Any(qi => !qi.State && qi.Status != SDK.Enums.InstallStatus.Queued && qi.Status != SDK.Enums.InstallStatus.Failed && qi.Status != SDK.Enums.InstallStatus.Canceled))
|
2024-06-11 00:26:17 -05:00
|
|
|
{
|
|
|
|
|
<h2>Completed</h2>
|
2024-10-26 15:48:47 -05:00
|
|
|
@foreach (var queueItem in InstallService.Queue.Where(qi => !qi.State))
|
2024-06-11 00:26:17 -05:00
|
|
|
{
|
|
|
|
|
<div class="queue-item">
|
|
|
|
|
<MediaImage Id="@queueItem.CoverId" Class="queue-item-cover" />
|
|
|
|
|
<div class="queue-item-info">
|
|
|
|
|
<div>
|
|
|
|
|
<h3>@queueItem.Title</h3>
|
2025-01-29 23:02:59 -06:00
|
|
|
<span><ByteSize Value="queueItem.TotalBytes" /></span>
|
2024-06-11 00:26:17 -05:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="queue-item-actions">
|
2024-08-01 17:21:44 -05:00
|
|
|
<PlayButton LibraryItemId="@queueItem.Id">
|
2024-06-11 00:26:17 -05:00
|
|
|
<MenuExtra>
|
|
|
|
|
<MenuItem OnClick="() => ViewInLibrary(queueItem)">
|
|
|
|
|
View in Library
|
|
|
|
|
</MenuItem>
|
|
|
|
|
</MenuExtra>
|
|
|
|
|
</PlayButton>
|
2024-05-27 17:07:28 -05:00
|
|
|
</div>
|
2024-05-25 15:40:31 -05:00
|
|
|
</div>
|
2024-06-11 00:26:17 -05:00
|
|
|
}
|
2024-05-27 17:07:28 -05:00
|
|
|
}
|
|
|
|
|
</Drawer>
|
2024-05-25 15:40:31 -05:00
|
|
|
|
|
|
|
|
@code {
|
2024-08-09 01:24:24 -05:00
|
|
|
bool Visible { get; set; } = false;
|
2024-05-29 20:13:38 -05:00
|
|
|
|
2024-05-25 15:40:31 -05:00
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
|
{
|
2024-10-26 15:48:47 -05:00
|
|
|
InstallService.OnQueueChanged += async () =>
|
2024-05-25 15:40:31 -05:00
|
|
|
{
|
|
|
|
|
StateHasChanged();
|
|
|
|
|
};
|
|
|
|
|
}
|
2024-06-11 00:26:17 -05:00
|
|
|
|
2024-10-26 15:48:47 -05:00
|
|
|
async Task Remove(IInstallQueueItem queueItem)
|
2024-06-11 00:26:17 -05:00
|
|
|
{
|
2024-10-26 15:48:47 -05:00
|
|
|
InstallService.Remove(queueItem);
|
2024-06-11 00:26:17 -05:00
|
|
|
}
|
|
|
|
|
|
2024-10-26 15:48:47 -05:00
|
|
|
async Task ViewInLibrary(IInstallQueueItem queueItem)
|
2024-06-11 00:26:17 -05:00
|
|
|
{
|
|
|
|
|
Visible = false;
|
|
|
|
|
NavigationManager.NavigateTo("/" + queueItem.Id);
|
|
|
|
|
}
|
2024-08-09 01:24:24 -05:00
|
|
|
|
|
|
|
|
public async Task Show()
|
|
|
|
|
{
|
|
|
|
|
Visible = true;
|
|
|
|
|
|
|
|
|
|
await InvokeAsync(StateHasChanged);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task Hide()
|
|
|
|
|
{
|
|
|
|
|
Visible = false;
|
|
|
|
|
|
|
|
|
|
await InvokeAsync(StateHasChanged);
|
|
|
|
|
}
|
2024-05-25 15:40:31 -05:00
|
|
|
}
|