add extension method to make routing as a dialog very simple.
MODIFY
WalletWasabi.Fluent/ViewModels/AddWallet/RecoverWalletViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWallet/RecoverWalletViewModel.cs
@@ -80,17 +80,11 @@ namespace WalletWasabi.Fluent.ViewModels.AddWallet
try
{
- var enterPassword = new EnterPasswordViewModel(
+ var result = await this.NavigateDialog(
+ new EnterPasswordViewModel(
navigationState,
NavigationTarget.DialogScreen,
- "Type the password of the wallet to be able to recover and click Continue.");
-
- string? result = null;
-
- using (NavigateTo(enterPassword, NavigationTarget.DialogScreen))
- {
- result = await enterPassword.GetDialogResultAsync();
- }
+ "Type the password of the wallet to be able to recover and click Continue."));
if (result is { } password)
{

MODIFY
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
@@ -55,13 +55,7 @@ namespace WalletWasabi.Fluent.ViewModels
NavigationTarget.DialogScreen,
"Type the password of the wallet and click Continue.");
-
- string? result = null;
-
- using (NavigateTo(enterPassword, NavigationTarget.DialogScreen))
- {
- result = await enterPassword.GetDialogResultAsync();
- }
+ var result = await this.NavigateDialog(enterPassword);
if (result is { } password)
{

ADD
WalletWasabi.Fluent/ViewModels/RoutableExtensions.cs
+using System.Threading.Tasks;
+using WalletWasabi.Fluent.ViewModels.Dialogs;
+
+namespace WalletWasabi.Fluent.ViewModels
+{
+ public static class RoutableExtensions
+ {
+ public static async Task<TResult> NavigateDialog<TResult>(this RoutableViewModel vm, DialogViewModelBase<TResult> dialog)
+ {
+ TResult result;
+
+ using (vm.NavigateTo(dialog, NavigationTarget.DialogScreen))
+ {
+ result = await dialog.GetDialogResultAsync();
+ }
+
+ return result;
+ }
+ }
+}
\ No newline at end of file

add extension method to make routing as a dialog very simple.