- Move all Launcher components to LANCommander.Launcher.UI namespace - Move all SCSS files next to components (when possible) - Refactor styles that control overflow of content into titlebar to MainWindow only - Remove use in launcher UI of SDK.Client
30 lines
1 KiB
Text
30 lines
1 KiB
Text
@using LANCommander.SDK.Models
|
|
@using Semver
|
|
@namespace LANCommander.Launcher.UI
|
|
@inject UpdateService UpdateService
|
|
@inject ModalService ModalService
|
|
@inject LocalizationService LocalizationService
|
|
|
|
@code {
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
UpdateService.OnUpdateAvailable += OnUpdateAvailable;
|
|
}
|
|
|
|
async Task OnUpdateAvailable(CheckForUpdateResponse response)
|
|
{
|
|
var confirmUpdate = await ModalService.ConfirmAsync(new ConfirmOptions
|
|
{
|
|
OkText = LocalizationService.GetString("UpdateNow"),
|
|
CancelText = LocalizationService.GetString("Later"),
|
|
Title = LocalizationService.GetString("LauncherUpdate"),
|
|
Content = LocalizationService.GetString("UpdateAvailableMessage", response.Version),
|
|
Centered = true
|
|
});
|
|
|
|
if (confirmUpdate && SemVersion.TryParse(response.Version, SemVersionStyles.Any, out var version))
|
|
{
|
|
await UpdateService.UpdateAsync(version);
|
|
}
|
|
}
|
|
}
|