mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Update - Display exceptions
Update - Run installer as admin so it well, works
This commit is contained in:
1 parent
e3c906390d
commit
36b4a10f40
2 files changed
+55
-8
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Services;
|
||||
using Artemis.UI.Shared.Services;
|
||||
@@ -9,12 +10,16 @@ namespace Artemis.UI.Screens.Settings.Dialogs
|
||||
public class UpdateDialogViewModel : DialogViewModelBase
|
||||
{
|
||||
private readonly JToken _buildInfo;
|
||||
private readonly IDialogService _dialogService;
|
||||
private readonly IUpdateService _updateService;
|
||||
private bool _canUpdate = true;
|
||||
|
||||
public UpdateDialogViewModel(JToken buildInfo, IUpdateService updateService)
|
||||
public UpdateDialogViewModel(JToken buildInfo, IUpdateService updateService, IDialogService dialogService)
|
||||
{
|
||||
_buildInfo = buildInfo;
|
||||
_updateService = updateService;
|
||||
_dialogService = dialogService;
|
||||
|
||||
CurrentBuild = Constants.BuildInfo.BuildNumberDisplay;
|
||||
LatestBuild = buildInfo?.SelectToken("value[0].buildNumber")?.Value<string>();
|
||||
}
|
||||
@@ -22,9 +27,28 @@ namespace Artemis.UI.Screens.Settings.Dialogs
|
||||
public string CurrentBuild { get; }
|
||||
public string LatestBuild { get; }
|
||||
|
||||
public bool CanUpdate
|
||||
{
|
||||
get => _canUpdate;
|
||||
set => SetAndNotify(ref _canUpdate, value);
|
||||
}
|
||||
|
||||
public async Task Update()
|
||||
{
|
||||
await _updateService.ApplyUpdate();
|
||||
try
|
||||
{
|
||||
CanUpdate = false;
|
||||
await _updateService.ApplyUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_dialogService.ShowExceptionDialog("An exception occurred while applying the update", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
CanUpdate = true;
|
||||
}
|
||||
|
||||
Session.Close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user