fix dialog focus scopes.
MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBase.cs
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBase.cs
+using ReactiveUI;
using WalletWasabi.Gui.ViewModels;
namespace WalletWasabi.Fluent.ViewModels.Dialogs
@@ -7,6 +8,16 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
/// </summary>
public abstract class DialogViewModelBase : ViewModelBase
{
+ private bool _isDialogOpen;
+
// Intended to be empty.
+ /// <summary>
+ /// Gets or sets if the dialog is opened/closed.
+ /// </summary>
+ public bool IsDialogOpen
+ {
+ get => _isDialogOpen;
+ set => this.RaiseAndSetIfChanged(ref _isDialogOpen, value);
+ }
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBaseOfTResult.cs
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBaseOfTResult.cs
@@ -15,7 +15,6 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
{
private readonly IDisposable Disposable;
private readonly TaskCompletionSource<TResult> CurrentTaskCompletionSource;
- private bool _isDialogOpen;
protected DialogViewModelBase()
{
@@ -27,15 +26,6 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
.Subscribe(OnIsDialogOpenChanged);
}
- /// <summary>
- /// Gets or sets if the dialog is opened/closed.
- /// </summary>
- public bool IsDialogOpen
- {
- get => _isDialogOpen;
- set => this.RaiseAndSetIfChanged(ref _isDialogOpen, value);
- }
-
private void OnIsDialogOpenChanged(bool dialogState)
{
// Triggered when closed abruptly (via the dialog overlay or the back button).

MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
+using System;
using NBitcoin;
using ReactiveUI;
using System.Reactive;
@@ -13,9 +14,10 @@ namespace WalletWasabi.Fluent.ViewModels
private StatusBarViewModel _statusBar;
private string _title = "Wasabi Wallet";
private DialogViewModelBase? _currentDialog;
- private NavigationStateViewModel _navigationState;
- private DialogScreenViewModel _dialogScreen;
+ private DialogScreenViewModel? _dialogScreen;
private NavBarViewModel _navBar;
+ private bool _isMainContentEnabled;
+ private bool _isDialogEnabled;
public MainViewModel(Global global)
{
@@ -23,7 +25,7 @@ namespace WalletWasabi.Fluent.ViewModels
_dialogScreen = new DialogScreenViewModel();
- _navigationState = new NavigationStateViewModel()
+ var navigationState = new NavigationStateViewModel()
{
HomeScreen = () => this,
DialogScreen = () => _dialogScreen,
@@ -34,13 +36,36 @@ namespace WalletWasabi.Fluent.ViewModels
_currentDialog = null;
+ _isMainContentEnabled = true;
+ _isDialogEnabled = true;
+
_statusBar = new StatusBarViewModel(global.DataDir, global.Network, global.Config, global.HostedServices, global.BitcoinStore.SmartHeaderChain, global.Synchronizer, global.LegalDocuments);
- var walletManager = new WalletManagerViewModel(_navigationState, global.WalletManager, global.UiConfig);
+ var walletManager = new WalletManagerViewModel(navigationState, global.WalletManager, global.UiConfig);
+
+ var addWalletPage = new AddWalletPageViewModel(navigationState, global.WalletManager, global.BitcoinStore, global.Network);
+
+ _navBar = new NavBarViewModel(navigationState, Router, walletManager, addWalletPage);
- var addWalletPage = new AddWalletPageViewModel(_navigationState, global.WalletManager, global.BitcoinStore, global.Network);
+ this.WhenAnyValue(x => x.DialogScreen!.IsDialogVisible)
+ .Subscribe(
+ x => IsMainContentEnabled = !x);
+
+ this.WhenAnyValue(x => x.CurrentDialog!.IsDialogOpen)
+ .Subscribe(
+ x => IsDialogEnabled = !x);
+ }
- _navBar = new NavBarViewModel(_navigationState, Router, walletManager, addWalletPage);
+ public bool IsMainContentEnabled
+ {
+ get => _isMainContentEnabled;
+ set => this.RaiseAndSetIfChanged(ref _isMainContentEnabled, value);
+ }
+
+ public bool IsDialogEnabled
+ {
+ get => _isDialogEnabled;
+ set => this.RaiseAndSetIfChanged(ref _isDialogEnabled, value);
}
public static MainViewModel? Instance { get; internal set; }
@@ -51,7 +76,7 @@ namespace WalletWasabi.Fluent.ViewModels
private Network Network { get; }
- public DialogScreenViewModel DialogScreen
+ public DialogScreenViewModel? DialogScreen
{
get => _dialogScreen;
set => this.RaiseAndSetIfChanged(ref _dialogScreen, value);

MODIFY
WalletWasabi.Fluent/Views/MainView.axaml
WalletWasabi.Fluent/Views/MainView.axaml
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="WalletWasabi.Fluent.Views.MainView">
<Panel>
- <SplitView IsPaneOpen="{Binding NavBar.IsOpen, Mode=TwoWay}">
+ <SplitView IsEnabled="{Binding IsMainContentEnabled}" IsPaneOpen="{Binding NavBar.IsOpen, Mode=TwoWay}">
<i:Interaction.Behaviors>
<behaviors:SplitViewAutoBehavior ToggleAction="{Binding NavBar.ToggleAction, Mode=OneWayToSource}"
CollapseOnClickAction="{Binding NavBar.CollapseOnClickAction, Mode=OneWayToSource}"
</DockPanel>
</Panel>
</SplitView>
- <c:Dialog MaxContentWidth="800" MaxContentHeight="700" DataContext="{Binding DialogScreen}" IsDialogOpen="{Binding IsDialogVisible, Mode=TwoWay}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
+ <c:Dialog IsEnabled="{Binding $parent.DataContext.IsDialogEnabled}" MaxContentWidth="800" MaxContentHeight="700" DataContext="{Binding DialogScreen}" IsDialogOpen="{Binding IsDialogVisible, Mode=TwoWay}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<rxui:RoutedViewHost Router="{Binding Router}">
<rxui:RoutedViewHost.ViewLocator>
<vl:ScreenViewLocator />
</rxui:RoutedViewHost.PageTransition>
</rxui:RoutedViewHost>
</c:Dialog>
- <c:Dialog HorizontalAlignment="Center" VerticalAlignment="Center"
+ <c:Dialog HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
DataContext="{Binding CurrentDialog}"
Content="{Binding }"
IsDialogOpen="{Binding IsDialogOpen, Mode=TwoWay}" />

fix dialog focus scopes.