simplify closing of dialogs when dismissed.
MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/DialogScreenViewModel.cs
WalletWasabi.Fluent/ViewModels/Dialogs/DialogScreenViewModel.cs
@@ -49,11 +49,6 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
_isClosing = true;
if (Router.NavigationStack.Count >= 1)
{
- if (Router.GetCurrentViewModel() is DialogViewModelBase vmb)
- {
- vmb.Close();
- }
-
Router.NavigationStack.Clear();
}
_isClosing = false;

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBase.cs
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBase.cs
+using System.Reactive;
using System.Windows.Input;
using ReactiveUI;
-using WalletWasabi.Gui.ViewModels;
+using System;
namespace WalletWasabi.Fluent.ViewModels.Dialogs
{
@@ -15,8 +16,6 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
{
}
- public abstract void Close();
-
public ICommand NextCommand { get; protected set; }
/// <summary>

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBaseOfTResult.cs
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBaseOfTResult.cs
using ReactiveUI;
using System;
+using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Threading.Tasks;
@@ -26,6 +27,8 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
.Subscribe(OnIsDialogOpenChanged);
CancelCommand = ReactiveCommand.Create(() => Close());
+
+ this.WhenNavigatedTo(() => Disposable.Create(() => Close()));
}
private void OnIsDialogOpenChanged(bool dialogState)
@@ -58,11 +61,6 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
OnDialogClosed();
}
- public override void Close()
- {
- Close(default(TResult));
- }
-
/// <summary>
/// Shows the dialog.
/// </summary>

simplify closing of dialogs when dismissed.