From d788a3ae955575fb45fa5a52123052bafafdf21d Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Mon, 20 Jan 2020 15:59:26 -0600 Subject: [PATCH] CompilerView swapped to RxUserControl --- Wabbajack/Extensions/IViewForExt.cs | 24 +++- Wabbajack/View Models/Compilers/CompilerVM.cs | 6 +- Wabbajack/Views/Common/CpuView.xaml.cs | 2 +- Wabbajack/Views/Compilers/CompilerView.xaml | 88 +++++------- .../Views/Compilers/CompilerView.xaml.cs | 135 +++++++++++++++++- Wabbajack/Views/MainWindow.xaml | 2 +- 6 files changed, 200 insertions(+), 57 deletions(-) diff --git a/Wabbajack/Extensions/IViewForExt.cs b/Wabbajack/Extensions/IViewForExt.cs index 083a7449..549cd367 100644 --- a/Wabbajack/Extensions/IViewForExt.cs +++ b/Wabbajack/Extensions/IViewForExt.cs @@ -54,6 +54,26 @@ namespace Wabbajack viewProperty: viewProperty); } + public static IReactiveBinding BindStrict( + this TView view, + TViewModel viewModel, + Expression> vmProperty, + Expression> viewProperty, + IObservable signalViewUpdate, + Func vmToViewConverter, + Func viewToVmConverter) + where TViewModel : class + where TView : class, IViewFor + { + return view.Bind( + viewModel: viewModel, + vmProperty: vmProperty, + viewProperty: viewProperty, + signalViewUpdate: signalViewUpdate, + vmToViewConverter: vmToViewConverter, + viewToVmConverter: viewToVmConverter); + } + public static IReactiveBinding BindStrict( this TView view, TViewModel viewModel, @@ -78,7 +98,9 @@ namespace Wabbajack Expression> property) where TTarget : class { - return @this.BindTo(target, property); + return @this + .ObserveOnGuiThread() + .BindTo(target, property); } /// diff --git a/Wabbajack/View Models/Compilers/CompilerVM.cs b/Wabbajack/View Models/Compilers/CompilerVM.cs index 00531ec9..daee630b 100644 --- a/Wabbajack/View Models/Compilers/CompilerVM.cs +++ b/Wabbajack/View Models/Compilers/CompilerVM.cs @@ -48,9 +48,9 @@ namespace Wabbajack public ObservableCollectionExtended Log => MWVM.Log; public ReactiveCommand BackCommand { get; } - public IReactiveCommand GoToModlistCommand { get; } - public IReactiveCommand CloseWhenCompleteCommand { get; } - public IReactiveCommand BeginCommand { get; } + public ReactiveCommand GoToModlistCommand { get; } + public ReactiveCommand CloseWhenCompleteCommand { get; } + public ReactiveCommand BeginCommand { get; } public FilePickerVM OutputLocation { get; } diff --git a/Wabbajack/Views/Common/CpuView.xaml.cs b/Wabbajack/Views/Common/CpuView.xaml.cs index 2899bfe5..72cf54c7 100644 --- a/Wabbajack/Views/Common/CpuView.xaml.cs +++ b/Wabbajack/Views/Common/CpuView.xaml.cs @@ -40,7 +40,7 @@ namespace Wabbajack set => SetValue(SettingsHookProperty, value); } public static readonly DependencyProperty SettingsHookProperty = DependencyProperty.Register(nameof(SettingsHook), typeof(MainSettings), typeof(CpuView), - new FrameworkPropertyMetadata(default(SettingsVM))); + new FrameworkPropertyMetadata(default(SettingsVM), WireNotifyPropertyChanged)); private bool _ShowingSettings; public bool ShowingSettings { get => _ShowingSettings; set => this.RaiseAndSetIfChanged(ref _ShowingSettings, value); } diff --git a/Wabbajack/Views/Compilers/CompilerView.xaml b/Wabbajack/Views/Compilers/CompilerView.xaml index 99c843f2..131801f0 100644 --- a/Wabbajack/Views/Compilers/CompilerView.xaml +++ b/Wabbajack/Views/Compilers/CompilerView.xaml @@ -1,4 +1,4 @@ - @@ -27,11 +29,11 @@ + Grid.ColumnSpan="5" /> + BorderThickness="1" /> - + + OverhangShadow="True" /> - + - + - + + ToolTip="Path to a readme file." /> + ToolTip="Readme website" />