Rename and refactor selection mode
MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/AddWalletPageViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/AddWalletPageViewModel.cs
@@ -25,9 +25,10 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
protected LegalDocuments _legalDocuments;
public AddWalletPageViewModel(LegalDocuments legalDocuments, WalletManager walletManager,
- BitcoinStore store, Network network, NavBarItemSelectionMode.Button)
+ BitcoinStore store, Network network)
{
Title = "Add Wallet";
+ SelectionMode = NavBarItemSelectionMode.Button;
_legalDocuments = legalDocuments;
this.WhenAnyValue(x => x.WalletName)

MODIFY
WalletWasabi.Fluent/ViewModels/HomePageViewModel.cs
WalletWasabi.Fluent/ViewModels/HomePageViewModel.cs
@@ -18,7 +18,7 @@ namespace WalletWasabi.Fluent.ViewModels
private readonly WalletManagerViewModel _walletManager;
private readonly AddWalletPageViewModel _addWalletPage;
- public HomePageViewModel(WalletManagerViewModel walletManager, AddWalletPageViewModel addWalletPage) : base(NavBarItemSelectionMode.Selected)
+ public HomePageViewModel(WalletManagerViewModel walletManager, AddWalletPageViewModel addWalletPage)
{
Title = "Home";
_walletManager = walletManager;

MODIFY
WalletWasabi.Fluent/ViewModels/NavBar/NavBarItemViewModel.cs
WalletWasabi.Fluent/ViewModels/NavBar/NavBarItemViewModel.cs
@@ -18,10 +18,10 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
private bool _isExpanded;
private string _title;
- protected NavBarItemViewModel(NavBarItemSelectionMode mode)
+ protected NavBarItemViewModel()
{
_title = "";
- Mode = mode;
+ SelectionMode = NavBarItemSelectionMode.Selected;
OpenCommand = ReactiveCommand.Create(
() =>
{
@@ -33,7 +33,7 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
public abstract string IconName { get; }
- public NavBarItemSelectionMode Mode { get; }
+ public NavBarItemSelectionMode SelectionMode { get; protected set; }
public bool IsExpanded
{
@@ -60,7 +60,7 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
get => _isSelected;
set
{
- switch ( Mode)
+ switch (SelectionMode)
{
case NavBarItemSelectionMode.Selected:
this.RaiseAndSetIfChanged(ref _isSelected, value);

MODIFY
WalletWasabi.Fluent/ViewModels/NavBar/NavBarViewModel.cs
WalletWasabi.Fluent/ViewModels/NavBar/NavBarViewModel.cs
@@ -171,13 +171,13 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
private void SetSelectedItem(NavBarItemViewModel? value)
{
- if (value is null || value.Mode == NavBarItemSelectionMode.Selected)
+ if (value is null || value.SelectionMode == NavBarItemSelectionMode.Selected)
{
Select(value);
return;
}
- if (value.Mode == NavBarItemSelectionMode.Button)
+ if (value.SelectionMode == NavBarItemSelectionMode.Button)
{
_isNavigating = true;
var previous = _selectedItem;
@@ -192,7 +192,7 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
return;
}
- if (value.Mode == NavBarItemSelectionMode.Toggle)
+ if (value.SelectionMode == NavBarItemSelectionMode.Toggle)
{
_isNavigating = true;
var previous = _selectedItem;

MODIFY
WalletWasabi.Fluent/ViewModels/Search/SearchItemViewModel.cs
WalletWasabi.Fluent/ViewModels/Search/SearchItemViewModel.cs
@@ -15,7 +15,6 @@ namespace WalletWasabi.Fluent.ViewModels.Search
string keywords,
string iconName,
Func<RoutableViewModel> createTargetView)
- : base(NavBarItemSelectionMode.Button)
{
Title = title;
Caption = caption;
@@ -23,6 +22,7 @@ namespace WalletWasabi.Fluent.ViewModels.Search
Category = category;
Keywords = keywords;
IconName = iconName;
+ SelectionMode = NavBarItemSelectionMode.Button;
OpenCommand = ReactiveCommand.Create(() => NavigateTo(createTargetView(), CurrentTarget));
}

MODIFY
WalletWasabi.Fluent/ViewModels/Search/SearchPageViewModel.cs
WalletWasabi.Fluent/ViewModels/Search/SearchPageViewModel.cs
@@ -22,7 +22,7 @@ namespace WalletWasabi.Fluent.ViewModels.Search
private IObservable<IChangeSet<SearchItemViewModel>>? _sourceObservable;
private string? _searchQuery;
- public SearchPageViewModel(WalletManagerViewModel walletManager) : base(NavBarItemSelectionMode.Selected)
+ public SearchPageViewModel(WalletManagerViewModel walletManager)
{
Title = "Search";
_categories = new Dictionary<string, SearchCategory>();

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/PrivacyModeViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/PrivacyModeViewModel.cs
@@ -11,11 +11,12 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
{
private bool _privacyMode;
- public PrivacyModeViewModel(NavigationStateViewModel navigationState, Global global)
- : base(navigationState, NavigationTarget.HomeScreen, NavBarItemSelectionMode.Toggle)
+ public PrivacyModeViewModel(Global global)
{
_privacyMode = global.UiConfig.PrivacyMode;
+ SelectionMode = NavBarItemSelectionMode.Toggle;
+
ToggleTitle();
this.WhenAnyValue(x => x.PrivacyMode)

MODIFY
WalletWasabi.Fluent/ViewModels/Settings/SettingsPageViewModel.cs
WalletWasabi.Fluent/ViewModels/Settings/SettingsPageViewModel.cs
@@ -48,7 +48,7 @@ namespace WalletWasabi.Fluent.ViewModels.Settings
private Global Global;
- public SettingsPageViewModel(): base(NavBarItemSelectionMode.Selected)
+ public SettingsPageViewModel()
{
Title = "Settings";

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModelBase.cs
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModelBase.cs
@@ -17,7 +17,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
private CompositeDisposable? _disposables;
private bool _disposedValue;
- protected WalletViewModelBase(Wallet wallet) : base(NavBarItemSelectionMode.Selected)
+ protected WalletViewModelBase(Wallet wallet)
{
Wallet = Guard.NotNull(nameof(wallet), wallet);

Rename and refactor selection mode