diff --git a/src/NexusMods.App.UI/Controls/Alerts/Alert.axaml.cs b/src/NexusMods.App.UI/Controls/Alerts/Alert.axaml.cs index 6304c24670..f8ed6485be 100644 --- a/src/NexusMods.App.UI/Controls/Alerts/Alert.axaml.cs +++ b/src/NexusMods.App.UI/Controls/Alerts/Alert.axaml.cs @@ -200,6 +200,11 @@ protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs chang } } + if (change.Property == IsDismissedProperty) + { + IsVisible = !IsDismissed; + } + base.OnPropertyChanged(change); } @@ -225,7 +230,6 @@ protected override void OnApplyTemplate(TemplateAppliedEventArgs e) if (_icon == null || _dismissButton == null || _titleText == null || _bodyText == null || _bodyTextBorder == null || _actionsRowBorder == null) return; - // turn off elements based on properties _dismissButton.IsVisible = ShowDismiss; _bodyTextBorder.IsVisible = ShowBody && !string.IsNullOrWhiteSpace(Body); diff --git a/src/NexusMods.App.UI/Controls/Alerts/AlertSettingsWrapper.cs b/src/NexusMods.App.UI/Controls/Alerts/AlertSettingsWrapper.cs index 1ec799e0a0..e078ad57ca 100644 --- a/src/NexusMods.App.UI/Controls/Alerts/AlertSettingsWrapper.cs +++ b/src/NexusMods.App.UI/Controls/Alerts/AlertSettingsWrapper.cs @@ -22,7 +22,7 @@ public AlertSettingsWrapper() public AlertSettingsWrapper(ISettingsManager settingsManager, string key) { _settingsManager = settingsManager; - + Key = key; IsDismissed = settingsManager.Get().IsDismissed(key); } @@ -33,7 +33,17 @@ public void DismissAlert() _settingsManager?.Update(alertSettings => alertSettings with { - AlertStatus = alertSettings.AlertStatus.SetItem(Key, true), + AlertStatus = alertSettings.AlertStatus.SetItem(Key, IsDismissed), + }); + } + + public void ShowAlert() + { + IsDismissed = false; + + _settingsManager?.Update(alertSettings => alertSettings with + { + AlertStatus = alertSettings.AlertStatus.SetItem(Key, IsDismissed), }); } } diff --git a/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/ILoadOrderViewModel.cs b/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/ILoadOrderViewModel.cs index 11340eb024..a36629f10f 100644 --- a/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/ILoadOrderViewModel.cs +++ b/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/ILoadOrderViewModel.cs @@ -2,6 +2,7 @@ using System.Reactive; using NexusMods.Abstractions.UI; using NexusMods.App.UI.Controls; +using NexusMods.App.UI.Controls.Alerts; using ReactiveUI; namespace NexusMods.App.UI.Pages.Sorting; @@ -71,4 +72,9 @@ public interface ILoadOrderViewModel : IViewModelInterface /// Contents text for the empty state, in case there are no sortable items to display /// string EmptyStateMessageContents { get; } + + /// + /// AlertSettings wrapper for the Alert so it can be shown\hidden based on the settings + /// + AlertSettingsWrapper AlertSettingsWrapper { get; } } diff --git a/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderView.axaml b/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderView.axaml index 3063e39386..cf589611f6 100644 --- a/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderView.axaml +++ b/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderView.axaml @@ -23,7 +23,7 @@ - + @@ -45,14 +45,12 @@ - - - - + + - + @@ -66,30 +64,42 @@ - - - + + + + + + - + - - - + diff --git a/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderView.axaml.cs b/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderView.axaml.cs index 32e1051180..247b572a1f 100644 --- a/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderView.axaml.cs +++ b/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderView.axaml.cs @@ -52,6 +52,10 @@ public LoadOrderView() vm => vm.Adapter.IsSourceEmpty.Value, view => view.EmptyState.IsActive) .DisposeWith(disposables); + + // alert + this.OneWayBind(ViewModel, vm => vm.AlertSettingsWrapper, view => view.LoadOrderAlert.AlertSettings) + .DisposeWith(disposables); } ); } diff --git a/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderViewDesignViewModel.cs b/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderViewDesignViewModel.cs index 3bf804806d..b02a25209b 100644 --- a/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderViewDesignViewModel.cs +++ b/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderViewDesignViewModel.cs @@ -6,8 +6,11 @@ using Avalonia.Controls.Models.TreeDataGrid; using DynamicData; using DynamicData.Binding; +using NexusMods.Abstractions.Settings; using NexusMods.Abstractions.UI; using NexusMods.App.UI.Controls; +using NexusMods.App.UI.Controls.Alerts; +using NexusMods.App.UI.Settings; using ReactiveUI; namespace NexusMods.App.UI.Pages.Sorting; @@ -20,15 +23,16 @@ public class LoadOrderDesignViewModel : AViewModel, ILoadOr public string InfoAlertHeading { get; set;} = "Info Alert Heading"; public string InfoAlertMessage { get; set;} = "Info Alert Message"; public bool InfoAlertIsVisible { get; set; } = true; - public ReactiveCommand InfoAlertCommand { get; } = ReactiveCommand.Create(() => { Console.WriteLine("InfoAlertCommand"); }); + public ReactiveCommand InfoAlertCommand { get; } = ReactiveCommand.Create(() => { }); public string TrophyToolTip { get; set;} = "Trophy Tool Tip"; public ListSortDirection SortDirectionCurrent { get; set; } public bool IsWinnerTop { get; set;} public string EmptyStateMessageTitle { get; } = "Empty State Message Title"; public string EmptyStateMessageContents { get; } = "Empty State Message Contents"; + public AlertSettingsWrapper AlertSettingsWrapper { get; } - public LoadOrderDesignViewModel() - { + public LoadOrderDesignViewModel(ISettingsManager settingsManager) + { Adapter = new LoadOrderTreeDataGridDesignAdapter(); this.WhenActivated(d => @@ -38,6 +42,8 @@ public LoadOrderDesignViewModel() .DisposeWith(d); } ); + + AlertSettingsWrapper = new AlertSettingsWrapper(settingsManager, "cyberpunk2077 redmod load-order first-loaded-wins"); } } diff --git a/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderViewModel.cs b/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderViewModel.cs index c60a119f6a..673f1f33ec 100644 --- a/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderViewModel.cs +++ b/src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderViewModel.cs @@ -7,8 +7,11 @@ using DynamicData.Binding; using NexusMods.Abstractions.Games; using NexusMods.Abstractions.Loadouts; +using NexusMods.Abstractions.Settings; using NexusMods.Abstractions.UI; using NexusMods.App.UI.Controls; +using NexusMods.App.UI.Controls.Alerts; +using NexusMods.App.UI.Settings; using ReactiveUI; using ReactiveUI.Fody.Helpers; @@ -27,10 +30,12 @@ public class LoadOrderViewModel : AViewModel, ILoadOrderVie [Reactive] public bool IsWinnerTop { get; private set; } public string EmptyStateMessageTitle { get; } public string EmptyStateMessageContents { get; } + + public AlertSettingsWrapper AlertSettingsWrapper { get; } public TreeDataGridAdapter Adapter { get; } - public LoadOrderViewModel(LoadoutId loadoutId, ISortableItemProviderFactory itemProviderFactory) + public LoadOrderViewModel(LoadoutId loadoutId, ISortableItemProviderFactory itemProviderFactory, ISettingsManager settingsManager) { var provider = itemProviderFactory.GetLoadoutSortableItemProvider(loadoutId); @@ -52,6 +57,13 @@ public LoadOrderViewModel(LoadoutId loadoutId, ISortableItemProviderFactory item var sortDirectionObservable = this.WhenAnyValue(vm => vm.SortDirectionCurrent); Adapter = new LoadOrderTreeDataGridAdapter(provider, sortDirectionObservable); Adapter.ViewHierarchical.Value = true; + + AlertSettingsWrapper = new AlertSettingsWrapper(settingsManager, "cyberpunk2077 redmod load-order first-loaded-wins"); + + InfoAlertCommand = ReactiveCommand.Create(() => + { + AlertSettingsWrapper.ShowAlert(); + }); this.WhenActivated(d => { diff --git a/src/NexusMods.App.UI/Pages/Sorting/SortingSelection/SortingSelectionDesignViewModel.cs b/src/NexusMods.App.UI/Pages/Sorting/SortingSelection/SortingSelectionDesignViewModel.cs index b70b6c78d3..5bc6ade038 100644 --- a/src/NexusMods.App.UI/Pages/Sorting/SortingSelection/SortingSelectionDesignViewModel.cs +++ b/src/NexusMods.App.UI/Pages/Sorting/SortingSelection/SortingSelectionDesignViewModel.cs @@ -1,24 +1,31 @@ using System.Collections.ObjectModel; using NexusMods.Abstractions.UI; +using Microsoft.Extensions.DependencyInjection; +using NexusMods.Abstractions.Settings; namespace NexusMods.App.UI.Pages.Sorting; public class SortingSelectionDesignViewModel : AViewModel, ISortingSelectionViewModel { + private readonly ISettingsManager _settingsManager; public ReadOnlyObservableCollection LoadOrderViewModels { get; } - - public SortingSelectionDesignViewModel() + public SortingSelectionDesignViewModel(IServiceProvider serviceProvider) { + _settingsManager = serviceProvider.GetRequiredService(); + var loadOrderViewModels = new ObservableCollection { - new LoadOrderDesignViewModel { SortOrderName = "Load order (RedMOD)", + new LoadOrderDesignViewModel(_settingsManager) + { + SortOrderName = "Load order (RedMOD)", InfoAlertHeading = "Load Order for REDmod files in Cyberpunk 2077 - First Loaded Wins", - InfoAlertMessage = "Some Cyberpunk 2077 mods use REDmod files to alter core gameplay elements. If two REDmod files modify the same part of the game, the one loaded first will take priority and overwrite changes from those loaded later.\n\nFor example, the 1st position overwrites the 2nd, the 2nd overwrites the 3rd, and so on." + InfoAlertMessage = + "Some Cyberpunk 2077 mods use REDmod files to alter core gameplay elements. If two REDmod files modify the same part of the game, the one loaded first will take priority and overwrite changes from those loaded later.\n\nFor example, the 1st position overwrites the 2nd, the 2nd overwrites the 3rd, and so on." }, - new LoadOrderDesignViewModel { SortOrderName = "Load Order (Archive XL)" }, - new LoadOrderDesignViewModel { SortOrderName = "File Overwrites" } + new LoadOrderDesignViewModel(_settingsManager) { SortOrderName = "Load Order (Archive XL)" }, + new LoadOrderDesignViewModel(_settingsManager) { SortOrderName = "File Overwrites" } }; - + LoadOrderViewModels = new ReadOnlyObservableCollection(loadOrderViewModels); } } diff --git a/src/NexusMods.App.UI/Pages/Sorting/SortingSelection/SortingSelectionViewModel.cs b/src/NexusMods.App.UI/Pages/Sorting/SortingSelection/SortingSelectionViewModel.cs index 098e935aaf..423e51ca4d 100644 --- a/src/NexusMods.App.UI/Pages/Sorting/SortingSelection/SortingSelectionViewModel.cs +++ b/src/NexusMods.App.UI/Pages/Sorting/SortingSelection/SortingSelectionViewModel.cs @@ -2,6 +2,7 @@ using Microsoft.Extensions.DependencyInjection; using NexusMods.Abstractions.Games; using NexusMods.Abstractions.Loadouts; +using NexusMods.Abstractions.Settings; using NexusMods.Abstractions.UI; using NexusMods.MnemonicDB.Abstractions; @@ -11,12 +12,14 @@ public class SortingSelectionViewModel : AViewModel, { private readonly LoadoutId _loadoutId; private readonly IConnection _connection; + private readonly ISettingsManager _settingsManager; public ReadOnlyObservableCollection LoadOrderViewModels { get; } public SortingSelectionViewModel(IServiceProvider serviceProvider, LoadoutId loadutId) { _loadoutId = loadutId; _connection = serviceProvider.GetRequiredService(); + _settingsManager = serviceProvider.GetRequiredService(); var loadout = Loadout.Load(_connection.Db, _loadoutId); var sortableItemProviders = loadout @@ -26,7 +29,7 @@ public SortingSelectionViewModel(IServiceProvider serviceProvider, LoadoutId loa LoadOrderViewModels = new ReadOnlyObservableCollection( new ObservableCollection( - sortableItemProviders.Select(provider => new LoadOrderViewModel(_loadoutId, provider)) + sortableItemProviders.Select(provider => new LoadOrderViewModel(_loadoutId, provider, _settingsManager)) ) ); } diff --git a/src/Themes/NexusMods.Themes.NexusFluentDark/Resources/ControlThemes/AlertControlTheme.axaml b/src/Themes/NexusMods.Themes.NexusFluentDark/Resources/ControlThemes/AlertControlTheme.axaml index 5d3646ccbf..d01734b149 100644 --- a/src/Themes/NexusMods.Themes.NexusFluentDark/Resources/ControlThemes/AlertControlTheme.axaml +++ b/src/Themes/NexusMods.Themes.NexusFluentDark/Resources/ControlThemes/AlertControlTheme.axaml @@ -196,10 +196,6 @@ - - diff --git a/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/CheckBox/CheckBoxStyles.axaml b/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/CheckBox/CheckBoxStyles.axaml index ea2bf5f97c..416ccb69d2 100644 --- a/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/CheckBox/CheckBoxStyles.axaml +++ b/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/CheckBox/CheckBoxStyles.axaml @@ -3,28 +3,135 @@ + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/ComboBox/ComboBoxStyles.axaml b/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/ComboBox/ComboBoxStyles.axaml index 48b3154970..93addf5feb 100644 --- a/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/ComboBox/ComboBoxStyles.axaml +++ b/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/ComboBox/ComboBoxStyles.axaml @@ -100,6 +100,23 @@ Item 2 + + + + Item 1 + Item 2 + + + + Item 1 + Item 2 + + + + Item 1 + Item 2 + + @@ -200,6 +217,8 @@ + + + + + + + + + + + diff --git a/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/TabControl/TabControlStyles.axaml b/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/TabControl/TabControlStyles.axaml index dde946d19d..a4ace35060 100644 --- a/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/TabControl/TabControlStyles.axaml +++ b/src/Themes/NexusMods.Themes.NexusFluentDark/Styles/Controls/TabControl/TabControlStyles.axaml @@ -155,7 +155,7 @@ -