simplify IsMainContentEnabled
MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -26,7 +26,6 @@ public partial class MainViewModel : ViewModelBase
private readonly SettingsPageViewModel _settingsPage;
private readonly PrivacyModeViewModel _privacyMode;
private readonly AddWalletPageViewModel _addWalletPage;
- [AutoNotify] private bool _isMainContentEnabled;
[AutoNotify] private bool _isDialogScreenEnabled;
[AutoNotify] private bool _isFullScreenEnabled;
[AutoNotify] private DialogScreenViewModel _dialogScreen;
@@ -53,7 +52,6 @@ public partial class MainViewModel : ViewModelBase
NavigationState.Register(MainScreen, DialogScreen, FullScreen, CompactDialogScreen);
- _isMainContentEnabled = true;
_isDialogScreenEnabled = true;
_isFullScreenEnabled = true;
@@ -76,17 +74,12 @@ public partial class MainViewModel : ViewModelBase
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(state => Services.UiConfig.WindowState = state.ToString());
- this.WhenAnyValue(
- x => x.DialogScreen!.IsDialogOpen,
- x => x.FullScreen!.IsDialogOpen,
- x => x.CompactDialogScreen!.IsDialogOpen)
+ IsMainContentEnabled = this.WhenAnyValue(
+ x => x.DialogScreen.IsDialogOpen,
+ x => x.FullScreen.IsDialogOpen,
+ x => x.CompactDialogScreen.IsDialogOpen)
.ObserveOn(RxApp.MainThreadScheduler)
- .Subscribe(tup =>
- {
- var (dialogScreenIsOpen, fullScreenIsOpen, compactDialogScreenIsOpen) = tup;
-
- IsMainContentEnabled = !(dialogScreenIsOpen || fullScreenIsOpen || compactDialogScreenIsOpen);
- });
+ .Select(tup => !(tup.Item1 || tup.Item2 || tup.Item3));
this.WhenAnyValue(
x => x.DialogScreen.CurrentPage,
@@ -129,6 +122,8 @@ public partial class MainViewModel : ViewModelBase
SearchBar = new SearchBarViewModel(source.Changes);
}
+ public IObservable<bool> IsMainContentEnabled { get; }
+
public IObservable<WalletViewModel> CurrentWallet { get; }
public TargettedNavigationStack MainScreen { get; }

MODIFY
WalletWasabi.Fluent/Views/Shell/MainView.axaml
WalletWasabi.Fluent/Views/Shell/MainView.axaml
d:DesignWidth="1000" d:DesignHeight="1000"
x:CompileBindings="True">
- <DockPanel IsEnabled="{Binding IsMainContentEnabled}">
+ <DockPanel IsEnabled="{Binding IsMainContentEnabled^}">
<shell:TitleBarView DockPanel.Dock="Top" />
<DockPanel>
<navbar:NavBar DockPanel.Dock="Left" DataContext="{Binding NavBar}" />

MODIFY
WalletWasabi.Fluent/Views/Shell/ShellView.axaml
WalletWasabi.Fluent/Views/Shell/ShellView.axaml
x:Class="WalletWasabi.Fluent.Views.Shell.ShellView">
<Panel>
<shell:BackgroundView />
- <shell:MainView x:CompileBindings="False" IsHitTestVisible="{Binding $parent.DataContext.IsMainContentEnabled, FallbackValue=True}" />
+ <shell:MainView x:CompileBindings="False" IsHitTestVisible="{Binding $parent.DataContext.IsMainContentEnabled^, FallbackValue=True}" />
<shell:DialogsView />
</Panel>
</UserControl>

simplify IsMainContentEnabled