Restore MainViewModel
MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -23,18 +23,18 @@ namespace WalletWasabi.Fluent.ViewModels;
public partial class MainViewModel : ViewModelBase
{
- private readonly AddWalletPageViewModel _addWalletPage;
- private readonly PrivacyModeViewModel _privacyMode;
private readonly SettingsPageViewModel _settingsPage;
- [AutoNotify] private DialogScreenViewModel _compactDialogScreen;
+ private readonly PrivacyModeViewModel _privacyMode;
+ private readonly AddWalletPageViewModel _addWalletPage;
[AutoNotify] private DialogScreenViewModel _dialogScreen;
[AutoNotify] private DialogScreenViewModel _fullScreen;
- [AutoNotify] private bool _isCoinJoinActive;
- [AutoNotify] private bool _isOobeBackgroundVisible;
+ [AutoNotify] private DialogScreenViewModel _compactDialogScreen;
[AutoNotify] private NavBarViewModel _navBar;
[AutoNotify] private StatusIconViewModel _statusIcon;
[AutoNotify] private string _title = "Wasabi Wallet";
[AutoNotify] private WindowState _windowState;
+ [AutoNotify] private bool _isOobeBackgroundVisible;
+ [AutoNotify] private bool _isCoinJoinActive;
public MainViewModel()
{
@@ -77,8 +77,7 @@ public partial class MainViewModel : ViewModelBase
x => x.CompactDialogScreen.CurrentPage,
x => x.FullScreen.CurrentPage,
x => x.MainScreen.CurrentPage,
- (dialog, compactDialog, fullScreenDialog, mainScreen) =>
- compactDialog ?? dialog ?? fullScreenDialog ?? mainScreen)
+ (dialog, compactDialog, fullScreenDialog, mainScreen) => compactDialog ?? dialog ?? fullScreenDialog ?? mainScreen)
.WhereNotNull()
.ObserveOn(RxApp.MainThreadScheduler)
.Do(page => page.SetActive())
@@ -91,8 +90,7 @@ public partial class MainViewModel : ViewModelBase
IsOobeBackgroundVisible = Services.UiConfig.Oobe;
- RxApp.MainThreadScheduler.Schedule(
- async () =>
+ RxApp.MainThreadScheduler.Schedule(async () =>
{
if (!Services.WalletManager.HasWallet() || Services.UiConfig.Oobe)
{
@@ -121,7 +119,7 @@ public partial class MainViewModel : ViewModelBase
public TargettedNavigationStack MainScreen { get; }
- public SearchBarViewModel SearchBar { get; set; }
+ public SearchBarViewModel SearchBar { get; }
public static MainViewModel Instance { get; } = new();
@@ -154,53 +152,25 @@ public partial class MainViewModel : ViewModelBase
}
}
- public void ApplyUiConfigWindowSate()
- {
- WindowState = (WindowState) Enum.Parse(typeof(WindowState), Services.UiConfig.WindowState);
- }
-
- private SearchBarViewModel CreateSearchBar()
- {
- // This subject is created to solve the circular dependency between the sources and SearchBarViewModel
- var filterChanged = new Subject<string>();
-
- var source = new CompositeSearchSource(
- new ActionsSearchSource(filterChanged),
- new SettingsSearchSource(_settingsPage, filterChanged),
- new TransactionsSearchSource(filterChanged));
-
- var searchBar = new SearchBarViewModel(source.Changes);
-
- searchBar
- .WhenAnyValue(a => a.SearchText)
- .WhereNotNull()
- .Subscribe(filterChanged);
-
- return searchBar;
- }
-
private void RegisterViewModels()
{
PrivacyModeViewModel.Register(_privacyMode);
AddWalletPageViewModel.Register(_addWalletPage);
SettingsPageViewModel.Register(_settingsPage);
- GeneralSettingsTabViewModel.RegisterLazy(
- () =>
+ GeneralSettingsTabViewModel.RegisterLazy(() =>
{
_settingsPage.SelectedTab = 0;
return _settingsPage;
});
- BitcoinTabSettingsViewModel.RegisterLazy(
- () =>
+ BitcoinTabSettingsViewModel.RegisterLazy(() =>
{
_settingsPage.SelectedTab = 1;
return _settingsPage;
});
- AdvancedSettingsTabViewModel.RegisterLazy(
- () =>
+ AdvancedSettingsTabViewModel.RegisterLazy(() =>
{
_settingsPage.SelectedTab = 2;
return _settingsPage;
@@ -218,4 +188,29 @@ public partial class MainViewModel : ViewModelBase
OpenTorLogsViewModel.RegisterLazy(() => new OpenTorLogsViewModel());
OpenConfigFileViewModel.RegisterLazy(() => new OpenConfigFileViewModel());
}
+
+ public void ApplyUiConfigWindowSate()
+ {
+ WindowState = (WindowState)Enum.Parse(typeof(WindowState), Services.UiConfig.WindowState);
+ }
+
+ private SearchBarViewModel CreateSearchBar()
+ {
+ // This subject is created to solve the circular dependency between the sources and SearchBarViewModel
+ var filterChanged = new Subject<string>();
+
+ var source = new CompositeSearchSource(
+ new ActionsSearchSource(filterChanged),
+ new SettingsSearchSource(_settingsPage, filterChanged),
+ new TransactionsSearchSource(filterChanged));
+
+ var searchBar = new SearchBarViewModel(source.Changes);
+
+ searchBar
+ .WhenAnyValue(a => a.SearchText)
+ .WhereNotNull()
+ .Subscribe(filterChanged);
+
+ return searchBar;
+ }
}

Restore MainViewModel