mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
BeginCommand utilizes canExecute
This commit is contained in:
parent
1b185c5ef6
commit
d6295cc306
@ -63,10 +63,13 @@ namespace Wabbajack
|
||||
private BitmapImage _NextIcon = UIUtils.BitmapImageFromResource("Wabbajack.UI.Icons.next.png");
|
||||
public BitmapImage NextIcon { get => _NextIcon; set => this.RaiseAndSetIfChanged(ref _NextIcon, value); }
|
||||
|
||||
private bool _UIReady;
|
||||
public bool UIReady { get => _UIReady; set => this.RaiseAndSetIfChanged(ref _UIReady, value); }
|
||||
|
||||
// Command properties
|
||||
public IReactiveCommand ChangePathCommand => ReactiveCommand.Create(ExecuteChangePath);
|
||||
public IReactiveCommand ChangeDownloadPathCommand => ReactiveCommand.Create(ExecuteChangeDownloadPath);
|
||||
public IReactiveCommand BeginCommand => ReactiveCommand.Create(ExecuteBegin);
|
||||
public IReactiveCommand BeginCommand { get; }
|
||||
public IReactiveCommand ShowReportCommand => ReactiveCommand.Create(ShowReport);
|
||||
public IReactiveCommand VisitNexusSiteCommand => ReactiveCommand.Create(VisitNexusSite);
|
||||
public IReactiveCommand OpenReadmeCommand { get; }
|
||||
@ -91,7 +94,12 @@ namespace Wabbajack
|
||||
this.OpenReadmeCommand = ReactiveCommand.Create(
|
||||
execute: this.OpenReadmeWindow,
|
||||
canExecute: this.WhenAny(x => x.ModList)
|
||||
.Select(modList => !string.IsNullOrEmpty(modList?.Readme)));
|
||||
.Select(modList => !string.IsNullOrEmpty(modList?.Readme))
|
||||
.ObserveOnGuiThread());
|
||||
this.BeginCommand = ReactiveCommand.Create(
|
||||
execute: this.ExecuteBegin,
|
||||
canExecute: this.WhenAny(x => x.UIReady)
|
||||
.ObserveOnGuiThread());
|
||||
|
||||
// Apply modlist properties when it changes
|
||||
this.WhenAny(x => x.ModList)
|
||||
@ -306,13 +314,6 @@ namespace Wabbajack
|
||||
viewer.Show();
|
||||
}
|
||||
|
||||
private bool _uiReady = false;
|
||||
public bool UIReady
|
||||
{
|
||||
get => _uiReady;
|
||||
set => this.RaiseAndSetIfChanged(ref _uiReady, value);
|
||||
}
|
||||
|
||||
private string _SplashScreenModName = "Wabbajack";
|
||||
public string SplashScreenModName { get => _SplashScreenModName; set => this.RaiseAndSetIfChanged(ref _SplashScreenModName, value); }
|
||||
|
||||
|
@ -24,6 +24,11 @@ namespace Wabbajack
|
||||
return source.Where(u => u != null);
|
||||
}
|
||||
|
||||
public static IObservable<T> ObserveOnGuiThread<T>(this IObservable<T> source)
|
||||
{
|
||||
return source.ObserveOn(RxApp.MainThreadScheduler);
|
||||
}
|
||||
|
||||
/// These snippets were provided by RolandPheasant (author of DynamicData)
|
||||
/// They'll be going into the official library at some point, but are here for now.
|
||||
#region Dynamic Data EnsureUniqueChanges
|
||||
|
@ -315,8 +315,7 @@
|
||||
<Button
|
||||
Grid.Row="1"
|
||||
Margin="0,4,0,0"
|
||||
Command="{Binding BeginCommand}"
|
||||
IsEnabled="{Binding UIReady}">
|
||||
Command="{Binding BeginCommand}">
|
||||
<TextBlock FontSize="13" FontWeight="Bold">Begin</TextBlock>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
Loading…
Reference in New Issue
Block a user