Make Dialog view mdoel compatible with IRoutableViewModel
MODIFY
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
@@ -58,7 +58,7 @@ namespace WalletWasabi.Fluent.ViewModels
PasswordInteraction = new Interaction<string, string?>();
PasswordInteraction.RegisterHandler(
- async interaction => interaction.SetOutput(await new EnterPasswordViewModel().ShowDialogAsync()));
+ async interaction => interaction.SetOutput(await new EnterPasswordViewModel(navigationState, NavigationTarget.Default).ShowDialogAsync()));
this.ValidateProperty(x => x.WalletName, errors => ValidateWalletName(errors, walletManager, WalletName));
}

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBase.cs
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBase.cs
@@ -6,10 +6,14 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
/// <summary>
/// CommonBase class.
/// </summary>
- public abstract class DialogViewModelBase : ViewModelBase
+ public abstract class DialogViewModelBase : RoutableViewModel
{
private bool _isDialogOpen;
+ public DialogViewModelBase(NavigationStateViewModel navigationState, NavigationTarget navigationTarget) : base(navigationState, navigationTarget)
+ {
+ }
+
/// <summary>
/// Gets or sets if the dialog is opened/closed.
/// </summary>

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBaseOfTResult.cs
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBaseOfTResult.cs
@@ -16,7 +16,7 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
private readonly IDisposable _disposable;
private readonly TaskCompletionSource<TResult> _currentTaskCompletionSource;
- protected DialogViewModelBase()
+ protected DialogViewModelBase(NavigationStateViewModel navigationState, NavigationTarget navigationTarget) : base(navigationState, navigationTarget)
{
_currentTaskCompletionSource = new TaskCompletionSource<TResult>();

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/EnterPasswordViewModel.cs
WalletWasabi.Fluent/ViewModels/Dialogs/EnterPasswordViewModel.cs
@@ -12,7 +12,7 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
private string? _password;
private string? _confirmPassword;
- public EnterPasswordViewModel()
+ public EnterPasswordViewModel(NavigationStateViewModel navigationState, NavigationTarget navigationTarget) : base(navigationState, navigationTarget)
{
// This means pressing continue will make the password empty string.
// pressing cancel will return null.
@@ -52,8 +52,6 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
public ICommand ContinueCommand { get; }
- public ICommand CancelCommand { get; }
-
protected override void OnDialogClosed()
{
Password = "";

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/TestDialogViewModel.cs
WalletWasabi.Fluent/ViewModels/Dialogs/TestDialogViewModel.cs
@@ -8,7 +8,7 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
private NavigationStateViewModel _navigationState;
private string _message;
- public TestDialogViewModel(NavigationStateViewModel navigationState, string message)
+ public TestDialogViewModel(NavigationStateViewModel navigationState, NavigationTarget navigationTarget, string message) : base(navigationState, navigationTarget)
{
_navigationState = navigationState;
_message = message;
@@ -23,7 +23,6 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
set => this.RaiseAndSetIfChanged(ref _message, value);
}
- public ICommand CancelCommand { get; }
public ICommand NextCommand { get; }
protected override void OnDialogClosed()

MODIFY
WalletWasabi.Fluent/ViewModels/RoutableViewModel.cs
WalletWasabi.Fluent/ViewModels/RoutableViewModel.cs
@@ -60,7 +60,7 @@ namespace WalletWasabi.Fluent.ViewModels
public ICommand BackCommand { get; protected set; }
- public ICommand CancelCommand { get; }
+ public ICommand CancelCommand { get; protected set; }
public void GoBack()
{

MODIFY
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
@@ -30,7 +30,7 @@ namespace WalletWasabi.Fluent.ViewModels
ConfirmSetting.RegisterHandler(
async interaction =>
{
- var x = new TestDialogViewModel(navigationState, interaction.Input);
+ var x = new TestDialogViewModel(navigationState, NavigationTarget.Default, interaction.Input);
var result = await x.ShowDialogAsync(navigationState.DialogHost());
interaction.SetOutput(result);
});
@@ -52,6 +52,7 @@ namespace WalletWasabi.Fluent.ViewModels
}
});
}
+
public ICommand NextCommand { get; }
public ICommand OpenDialogCommand { get; }

Make Dialog view mdoel compatible with IRoutableViewModel