Refactor Login commands execute to methods
MODIFY
WalletWasabi.Fluent/ViewModels/Login/LoginViewModel.cs
WalletWasabi.Fluent/ViewModels/Login/LoginViewModel.cs
@@ -7,6 +7,7 @@ using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Fluent.ViewModels.Wallets;
using WalletWasabi.Services;
using WalletWasabi.Userfacing;
+using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Login
{
@@ -27,7 +28,16 @@ namespace WalletWasabi.Fluent.ViewModels.Login
WalletIcon = wallet.KeyManager.Icon;
IsHardwareWallet = wallet.KeyManager.IsHardwareWallet;
- NextCommand = ReactiveCommand.CreateFromTask(async () =>
+ NextCommand = ReactiveCommand.CreateFromTask(async () => await NextExecute(walletManagerViewModel, closedWalletViewModel, wallet));
+
+ OkCommand = ReactiveCommand.Create(OkExecute);
+
+ ForgotPasswordCommand = ReactiveCommand.Create(() => ForgotPasswordExecute(wallet));
+
+ EnableAutoBusyOn(NextCommand);
+ }
+
+ private async Task NextExecute(WalletManagerViewModel walletManagerViewModel, ClosedWalletViewModel closedWalletViewModel, Wallet wallet)
{
string? compatibilityPasswordUsed = null;
@@ -55,18 +65,17 @@ namespace WalletWasabi.Fluent.ViewModels.Login
wallet.Logout();
ErrorMessage = "You must accept the Terms and Conditions!";
}
- });
+ }
- OkCommand = ReactiveCommand.Create(() =>
+ private void OkExecute()
{
Password = "";
ErrorMessage = "";
- });
-
- ForgotPasswordCommand = ReactiveCommand.Create(() =>
- Navigate(NavigationTarget.DialogScreen).To(new PasswordFinderIntroduceViewModel(wallet)));
+ }
- EnableAutoBusyOn(NextCommand);
+ private void ForgotPasswordExecute(Wallet wallet)
+ {
+ Navigate(NavigationTarget.DialogScreen).To(new PasswordFinderIntroduceViewModel(wallet));
}
public string? WalletIcon { get; }

MODIFY
WalletWasabi.Fluent/ViewModels/Login/PasswordFinder/PasswordFinderIntroduceViewModel.cs
WalletWasabi.Fluent/ViewModels/Login/PasswordFinder/PasswordFinderIntroduceViewModel.cs
+using System.Threading.Tasks;
using ReactiveUI;
using WalletWasabi.Fluent.ViewModels.Dialogs;
using WalletWasabi.Fluent.ViewModels.Dialogs.Base;
@@ -12,10 +13,14 @@ namespace WalletWasabi.Fluent.ViewModels.Login.PasswordFinder
{
public PasswordFinderIntroduceViewModel(Wallet wallet)
{
- NextCommand = ReactiveCommand.CreateFromTask(async () =>
+ NextCommand = ReactiveCommand.CreateFromTask(async () => await NextExecute(wallet));
+ }
+
+ private async Task NextExecute(Wallet wallet)
{
var dialogResult =
- await NavigateDialog(new CreatePasswordDialogViewModel("Type in your most likely password", enableEmpty: false));
+ await NavigateDialog(
+ new CreatePasswordDialogViewModel("Type in your most likely password", enableEmpty: false));
if (dialogResult.Result is { } password)
{
@@ -27,7 +32,6 @@ namespace WalletWasabi.Fluent.ViewModels.Login.PasswordFinder
{
Navigate().Clear();
}
- });
}
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Login/PasswordFinder/PasswordNotFoundViewModel.cs
WalletWasabi.Fluent/ViewModels/Login/PasswordFinder/PasswordNotFoundViewModel.cs
@@ -9,7 +9,10 @@ namespace WalletWasabi.Fluent.ViewModels.Login.PasswordFinder
{
public PasswordNotFoundViewModel(Wallet wallet)
{
- NextCommand = ReactiveCommand.Create(() =>
+ NextCommand = ReactiveCommand.Create(() => NextExecute(wallet));
+ }
+
+ private void NextExecute(Wallet wallet)
{
var page = new PasswordFinderIntroduceViewModel(wallet);
Navigate().To(page, NavigationMode.Clear);
@@ -17,7 +20,6 @@ namespace WalletWasabi.Fluent.ViewModels.Login.PasswordFinder
{
cmd.Execute(default);
}
- });
}
}
}
\ No newline at end of file

Refactor Login commands execute to methods