bloxstrap/Bloxstrap/UI/ViewModels/Installer/WelcomeViewModel.cs
pizzaboxer 2791cb0b2e
Refactor automatic updater + fix install details + fix launch flag parser + fix temp directory
Automatic updater now relies on the -upgrade flag specifically being set and uses a mutex for coordinating the process

Temp directory is now obtained appropriately (should fix exceptions relating to it?)

Installation details are now reconfigured on every upgrade

Specifying a nonexistant flag would insta-crash the app

Also, the message box was making the wrong sound for the warning icon
2024-08-30 13:29:51 +01:00

40 lines
1.4 KiB
C#

namespace Bloxstrap.UI.ViewModels.Installer
{
// TODO: administrator check?
public class WelcomeViewModel : NotifyPropertyChangedViewModel
{
// formatting is done here instead of in xaml, it's just a bit easier
public string MainText => String.Format(
Resources.Strings.Installer_Welcome_MainText,
"[github.com/pizzaboxer/bloxstrap](https://github.com/pizzaboxer/bloxstrap)",
"[bloxstrap.pizzaboxer.xyz](https://bloxstrap.pizzaboxer.xyz)"
);
public string VersionNotice { get; private set; } = "";
public bool CanContinue { get; set; } = false;
public event EventHandler? CanContinueEvent;
// called by codebehind on page load
public async void DoChecks()
{
var releaseInfo = await App.GetLatestRelease();
if (releaseInfo is not null)
{
if (Utilities.CompareVersions(App.Version, releaseInfo.TagName) == VersionComparison.LessThan)
{
VersionNotice = String.Format(Strings.Installer_Welcome_UpdateNotice, App.Version, releaseInfo.TagName.Replace("v", ""));
OnPropertyChanged(nameof(VersionNotice));
}
}
CanContinue = true;
OnPropertyChanged(nameof(CanContinue));
CanContinueEvent?.Invoke(this, new EventArgs());
}
}
}