2024-08-04 17:53:19 -05:00
|
|
|
@using LANCommander.Launcher.Models
|
2025-12-31 20:01:04 -06:00
|
|
|
@namespace LANCommander.Launcher.UI
|
2024-10-26 15:48:47 -05:00
|
|
|
@inject InstallService InstallService
|
2025-10-05 19:30:32 -05:00
|
|
|
@inject LibraryService LibraryService
|
|
|
|
|
@inject GameClient GameClient
|
2024-06-11 00:26:17 -05:00
|
|
|
@inject NavigationManager NavigationManager
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
@inject LocalizationService LocalizationService
|
2025-10-05 19:30:32 -05:00
|
|
|
@inject ConfirmService ConfirmService
|
|
|
|
|
@inject ModalService ModalService
|
2025-12-31 20:01:04 -06:00
|
|
|
@inject ISettingsProvider SettingsProvider
|
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
|
|
|
{
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
<h2>@LocalizationService.GetString("InProgress")</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>
|
2025-10-15 21:26:40 -05:00
|
|
|
|
|
|
|
|
<Button Type="ButtonType.Text" Danger Icon="@IconType.Outline.Close" OnClick="() => Cancel(queueItem)" />
|
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
|
|
|
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
<h2>@LocalizationService.GetString("UpNext")</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
|
|
|
{
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
<Empty Simple Description="@LocalizationService.GetString("TheQueueIsEmpty")" />
|
2024-06-11 00:26:17 -05:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
{
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
<h2>@LocalizationService.GetString("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)">
|
Add localization support to launcher
Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
2025-08-18 21:29:38 -05:00
|
|
|
@LocalizationService.GetString("ViewInLibrary")
|
2024-06-11 00:26:17 -05:00
|
|
|
</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
|
|
|
|
2025-10-05 19:30:32 -05:00
|
|
|
protected override void OnInitialized()
|
|
|
|
|
{
|
|
|
|
|
InstallService.OnInstallFail += OnInstallFail;
|
|
|
|
|
}
|
|
|
|
|
|
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();
|
|
|
|
|
};
|
|
|
|
|
}
|
2025-10-15 21:26:40 -05:00
|
|
|
|
|
|
|
|
async Task Cancel(IInstallQueueItem queueItem)
|
|
|
|
|
{
|
|
|
|
|
await InstallService.CancelInstallAsync(queueItem.Id);
|
|
|
|
|
}
|
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);
|
|
|
|
|
}
|
2025-10-05 19:30:32 -05:00
|
|
|
|
|
|
|
|
async Task OnInstallFail(Data.Models.Game game)
|
|
|
|
|
{
|
|
|
|
|
var result = await ConfirmService.Show(
|
|
|
|
|
LocalizationService.GetString("InstallationFailedMessage", game.Title),
|
|
|
|
|
LocalizationService.GetString("InstallationFailed"),
|
|
|
|
|
ConfirmButtons.RetryCancel,
|
|
|
|
|
ConfirmIcon.Error
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await LibraryService.LibraryChanged();
|
|
|
|
|
|
|
|
|
|
if (result == ConfirmResult.Retry)
|
|
|
|
|
{
|
|
|
|
|
var libraryItem = LibraryService.GetItem(game.Id);
|
|
|
|
|
|
|
|
|
|
Install(libraryItem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async Task Install(Models.ListItem libraryItem)
|
|
|
|
|
{
|
|
|
|
|
var addons = await GameClient.GetAddonsAsync(libraryItem.Key);
|
|
|
|
|
|
|
|
|
|
if (SettingsProvider.CurrentValue.Games.InstallDirectories.Length > 1 || (addons != null && addons.Any()))
|
|
|
|
|
{
|
|
|
|
|
var modalOptions = new ModalOptions
|
|
|
|
|
{
|
|
|
|
|
Title = LocalizationService.GetString("InstallGame", libraryItem.Name),
|
|
|
|
|
Maximizable = false,
|
|
|
|
|
DefaultMaximized = false,
|
|
|
|
|
Closable = true,
|
|
|
|
|
OkText = LocalizationService.GetString("Install"),
|
|
|
|
|
Draggable = true,
|
|
|
|
|
Centered = true,
|
|
|
|
|
WrapClassName = "ant-modal-wrap-no-padding",
|
|
|
|
|
Footer = null,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var modalRef = ModalService.CreateModal<InstallDialog, Models.ListItem, string>(modalOptions, libraryItem);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
await InstallService.Add(libraryItem.DataItem as Data.Models.Game);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-25 15:40:31 -05:00
|
|
|
}
|