LANCommander/LANCommander.Client/UI/Components/Footer.razor
2024-06-12 01:28:26 -05:00

37 lines
915 B
Text

@using LANCommander.Client.Models
@using System.Diagnostics
@inject DownloadService DownloadService
@inject SDK.Client Client
@inject GameService GameService
<footer>
@if (DownloadService.Queue.Any(qi => qi.State))
{
<div class="downloader" @onclick="() => ShowDownloadQueue()">
<CurrentDownloadItem ShowIcon="true" />
</div>
}
else
{
<Button Type="@ButtonType.Text" Icon="@IconType.Outline.Download" OnClick="() => ShowDownloadQueue()">Downloads</Button>
}
</footer>
<DownloadQueue @bind-Visible="@DownloadQueueVisible" />
@code {
bool DownloadQueueVisible = false;
protected override async Task OnInitializedAsync()
{
DownloadService.OnQueueChanged += async () =>
{
await InvokeAsync(StateHasChanged);
};
}
async Task ShowDownloadQueue()
{
DownloadQueueVisible = true;
}
}