Update UI binding to IsEnabled
This commit is contained in:
parent
d6aaeda28c
commit
83a3200813
@ -2,6 +2,7 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
|
using SPTInstaller.Aki.Helper;
|
||||||
using SPTInstaller.Controllers;
|
using SPTInstaller.Controllers;
|
||||||
using SPTInstaller.Helpers;
|
using SPTInstaller.Helpers;
|
||||||
using SPTInstaller.Models;
|
using SPTInstaller.Models;
|
||||||
@ -11,7 +12,7 @@ namespace SPTInstaller.ViewModels;
|
|||||||
public class PreChecksViewModel : ViewModelBase
|
public class PreChecksViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private string _installPath;
|
private string _installPath;
|
||||||
private bool _preCheckSucceeded;
|
private bool _allowInstall;
|
||||||
|
|
||||||
public ObservableCollection<PreCheckBase> PreChecks { get; set; } = new(ServiceHelper.GetAll<PreCheckBase>());
|
public ObservableCollection<PreCheckBase> PreChecks { get; set; } = new(ServiceHelper.GetAll<PreCheckBase>());
|
||||||
public ICommand StartInstallCommand { get; set; }
|
public ICommand StartInstallCommand { get; set; }
|
||||||
@ -21,10 +22,10 @@ public class PreChecksViewModel : ViewModelBase
|
|||||||
set => this.RaiseAndSetIfChanged(ref _installPath, value);
|
set => this.RaiseAndSetIfChanged(ref _installPath, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool PreCheckSucceeded
|
public bool AllowInstall
|
||||||
{
|
{
|
||||||
get => _preCheckSucceeded;
|
get => _allowInstall;
|
||||||
set => this.RaiseAndSetIfChanged(ref _preCheckSucceeded, value);
|
set => this.RaiseAndSetIfChanged(ref _allowInstall, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PreChecksViewModel(IScreen host) : base(host)
|
public PreChecksViewModel(IScreen host) : base(host)
|
||||||
@ -47,7 +48,7 @@ public class PreChecksViewModel : ViewModelBase
|
|||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
var result = await installer.RunPreChecks();
|
var result = await installer.RunPreChecks();
|
||||||
PreCheckSucceeded = result.Succeeded;
|
AllowInstall = result.Succeeded;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -23,7 +23,7 @@
|
|||||||
Margin="10"
|
Margin="10"
|
||||||
FontSize="15" FontWeight="SemiBold"
|
FontSize="15" FontWeight="SemiBold"
|
||||||
Classes="yellow"
|
Classes="yellow"
|
||||||
IsVisible="{Binding PreCheckSucceeded}"
|
IsEnabled="{Binding AllowInstall}"
|
||||||
Command="{Binding StartInstallCommand}"
|
Command="{Binding StartInstallCommand}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user