Client has been renamed to launcher, and thus namespaces and artifact names had to change. The server project has also had some artifacts renamed in order to create a more clear separation of builds. This will break auto-updates before v0.9.0.
28 lines
867 B
Text
28 lines
867 B
Text
@using LANCommander.SDK.Models
|
|
@using Semver
|
|
@inject UpdateService UpdateService
|
|
@inject ModalService ModalService
|
|
|
|
@code {
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
UpdateService.OnUpdateAvailable += OnUpdateAvailable;
|
|
}
|
|
|
|
async Task OnUpdateAvailable(CheckForUpdateResponse response)
|
|
{
|
|
var confirmUpdate = await ModalService.ConfirmAsync(new ConfirmOptions
|
|
{
|
|
OkText = "Update Now",
|
|
CancelText = "Later",
|
|
Title = "Launcher Update",
|
|
Content = $"An update for v{response.Version} is available. Do you want to download and install?",
|
|
Centered = true
|
|
});
|
|
|
|
if (confirmUpdate && SemVersion.TryParse(response.Version, SemVersionStyles.Any, out var version))
|
|
{
|
|
await UpdateService.UpdateAsync(version);
|
|
}
|
|
}
|
|
}
|