From e42336131ee9456fa7246e3cca642de41b6bb504 Mon Sep 17 00:00:00 2001 From: trawzified <55751269+tr4wzified@users.noreply.github.com> Date: Sun, 17 Dec 2023 13:21:08 +0100 Subject: [PATCH] Fix up NavigationVM not binding to NavigationView, fill icons on hover --- Wabbajack.App.Wpf/Themes/Styles.xaml | 27 +++++++++++++++++++ Wabbajack.App.Wpf/View Models/MainWindowVM.cs | 4 ++- Wabbajack.App.Wpf/View Models/NavigationVM.cs | 12 +++++---- Wabbajack.App.Wpf/Views/MainWindow.xaml | 2 +- .../Views/ModeSelectionView.xaml.cs | 1 + .../Views/NavigationView.xaml.cs | 6 ++--- 6 files changed, 42 insertions(+), 10 deletions(-) diff --git a/Wabbajack.App.Wpf/Themes/Styles.xaml b/Wabbajack.App.Wpf/Themes/Styles.xaml index 4e50f546..36207dec 100644 --- a/Wabbajack.App.Wpf/Themes/Styles.xaml +++ b/Wabbajack.App.Wpf/Themes/Styles.xaml @@ -1194,6 +1194,15 @@ + + + + @@ -1329,6 +1347,15 @@ + + + diff --git a/Wabbajack.App.Wpf/View Models/MainWindowVM.cs b/Wabbajack.App.Wpf/View Models/MainWindowVM.cs index ddba7240..6499263c 100644 --- a/Wabbajack.App.Wpf/View Models/MainWindowVM.cs +++ b/Wabbajack.App.Wpf/View Models/MainWindowVM.cs @@ -39,6 +39,9 @@ namespace Wabbajack [Reactive] public ViewModel ActivePane { get; private set; } + [Reactive] + public NavigationVM NavigationVM { get; private set; } + public ObservableCollectionExtended Log { get; } = new ObservableCollectionExtended(); public readonly CompilerVM Compiler; @@ -47,7 +50,6 @@ namespace Wabbajack public readonly ModListGalleryVM Gallery; public readonly ModeSelectionVM ModeSelectionVM; public readonly WebBrowserVM WebBrowserVM; - public readonly NavigationVM NavigationVM; public readonly Lazy ModListContentsVM; public readonly UserInterventionHandlers UserInterventionHandlers; private readonly Client _wjClient; diff --git a/Wabbajack.App.Wpf/View Models/NavigationVM.cs b/Wabbajack.App.Wpf/View Models/NavigationVM.cs index ec876634..0a2628d6 100644 --- a/Wabbajack.App.Wpf/View Models/NavigationVM.cs +++ b/Wabbajack.App.Wpf/View Models/NavigationVM.cs @@ -22,20 +22,22 @@ namespace Wabbajack public class NavigationVM : ViewModel { private readonly ILogger _logger; - public ICommand BrowseCommand { get; } - public ICommand InstallCommand { get; } - public ICommand CompileCommand { get; } - public ReactiveCommand UpdateCommand { get; } public NavigationVM(ILogger logger) { _logger = logger; + HomeCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(NavigateToGlobal.ScreenType.ModeSelectionView)); + BrowseCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(NavigateToGlobal.ScreenType.ModListGallery)); InstallCommand = ReactiveCommand.Create(() => { LoadLastLoadedModlist.Send(); NavigateToGlobal.Send(NavigateToGlobal.ScreenType.Installer); }); CompileCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(NavigateToGlobal.ScreenType.Compiler)); - BrowseCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(NavigateToGlobal.ScreenType.ModListGallery)); } + public ICommand HomeCommand { get; } + public ICommand BrowseCommand { get; } + public ICommand InstallCommand { get; } + public ICommand CompileCommand { get; } + public ReactiveCommand UpdateCommand { get; } } } diff --git a/Wabbajack.App.Wpf/Views/MainWindow.xaml b/Wabbajack.App.Wpf/Views/MainWindow.xaml index c1a7bea4..e05a06a7 100644 --- a/Wabbajack.App.Wpf/Views/MainWindow.xaml +++ b/Wabbajack.App.Wpf/Views/MainWindow.xaml @@ -63,7 +63,7 @@ - + diff --git a/Wabbajack.App.Wpf/Views/ModeSelectionView.xaml.cs b/Wabbajack.App.Wpf/Views/ModeSelectionView.xaml.cs index 78c2cd84..9444b344 100644 --- a/Wabbajack.App.Wpf/Views/ModeSelectionView.xaml.cs +++ b/Wabbajack.App.Wpf/Views/ModeSelectionView.xaml.cs @@ -27,6 +27,7 @@ namespace Wabbajack public ModeSelectionView() { InitializeComponent(); + var vm = ViewModel; this.WhenActivated(dispose => { this.WhenAnyValue(x => x.ViewModel.Modlists) diff --git a/Wabbajack.App.Wpf/Views/NavigationView.xaml.cs b/Wabbajack.App.Wpf/Views/NavigationView.xaml.cs index 1c5e4a7e..e07f3d81 100644 --- a/Wabbajack.App.Wpf/Views/NavigationView.xaml.cs +++ b/Wabbajack.App.Wpf/Views/NavigationView.xaml.cs @@ -19,10 +19,10 @@ namespace Wabbajack InitializeComponent(); this.WhenActivated(dispose => { - this.WhenAny(x => x.ViewModel.BrowseCommand) - .BindToStrict(this, x => x.BrowseButton.Command) + this.BindCommand(ViewModel, vm => vm.BrowseCommand, v => v.BrowseButton) + .DisposeWith(dispose); + this.BindCommand(ViewModel, vm => vm.HomeCommand, v => v.HomeButton) .DisposeWith(dispose); - /* this.WhenAny(x => x.ViewModel.InstallCommand) .BindToStrict(this, x => x.InstallButton.Command)