79 lines
2.7 KiB
Text
79 lines
2.7 KiB
Text
@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)
|
|
{
|
|
<div class="downloader-current">
|
|
@if (ShowIcon)
|
|
{
|
|
<div class="downloader-current-icon">
|
|
<MediaImage Id="@Progress.IconId" />
|
|
</div>
|
|
}
|
|
<div class="downloader-current-info">
|
|
<div class="downloader-current-upper">
|
|
<div class="downloader-current-upper-status">
|
|
@if (Progress.Status == SDK.Enums.InstallStatus.Downloading && Progress.Progress > 0)
|
|
{
|
|
<Text>@Progress.Status.GetDisplayName() @Progress.Title: @Progress.Progress.ToString("0%")</Text>
|
|
}
|
|
else
|
|
{
|
|
<Text>@Progress.Status.GetDisplayName()</Text>
|
|
}
|
|
</div>
|
|
@if (Progress.TransferSpeed > 0)
|
|
{
|
|
<div class="downloader-current-upper-time-remaining">
|
|
@Progress.TimeRemaining.ToString(@"hh\:mm\:ss")
|
|
</div>
|
|
}
|
|
</div>
|
|
<div class="downloader-current-progress">
|
|
<Progress Percent="(Progress.Progress * 100)" />
|
|
</div>
|
|
<div class="downloader-current-lower">
|
|
<div class="downloader-current-lower-data">
|
|
<ByteSize Value="Progress.BytesTransferred" /> / <ByteSize Value="Progress.TotalBytes" />
|
|
</div>
|
|
<div class="downloader-current-lower-speed">
|
|
<ByteSize Value="Progress.TransferSpeed" />/s
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
@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();
|
|
};
|
|
}
|
|
}
|