Dont require passing MainViewModel.Instance everytime you show a dialog.
MODIFY
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
using ReactiveUI;
-using Splat;
using System;
using System.Windows.Input;
using System.Reactive.Linq;
using WalletWasabi.Fluent.AddWallet.Common;
-using WalletWasabi.Gui;
using System.Reactive.Threading.Tasks;
using WalletWasabi.Blockchain.Keys;
using WalletWasabi.Fluent.AddWallet.CreateWallet;
@@ -29,7 +27,8 @@ namespace WalletWasabi.Fluent.ViewModels
RecoverWalletCommand = ReactiveCommand.Create(() => screen.Router.Navigate.Execute(new RecoveryPageViewModel(screen)));
- CreateWalletCommand = ReactiveCommand.CreateFromTask(async () =>
+ CreateWalletCommand = ReactiveCommand.CreateFromTask(
+ async () =>
{
var result = await PasswordInteraction.Handle("").ToTask();
@@ -40,12 +39,14 @@ namespace WalletWasabi.Fluent.ViewModels
TipHeight = store.SmartHeaderChain.TipHeight
};
var (km, mnemonic) = walletGenerator.GenerateWallet(WalletName, password);
- await screen.Router.Navigate.Execute(new RecoveryWordsViewModel(screen, km, mnemonic, walletManager));
+ await screen.Router.Navigate.Execute(
+ new RecoveryWordsViewModel(screen, km, mnemonic, walletManager));
}
});
PasswordInteraction = new Interaction<string, string>();
- PasswordInteraction.RegisterHandler(async interaction => interaction.SetOutput(await new EnterPasswordViewModel(screen).ShowDialogAsync(MainViewModel.Instance)));
+ PasswordInteraction.RegisterHandler(
+ async interaction => interaction.SetOutput(await new EnterPasswordViewModel(screen).ShowDialogAsync()));
}
public override string IconName => "add_circle_regular";

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBaseOfTResult.cs
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBaseOfTResult.cs
@@ -70,8 +70,13 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
/// Shows the dialog.
/// </summary>
/// <returns>The value to be returned when the dialog is finished.</returns>
- public Task<TResult> ShowDialogAsync(IDialogHost host)
+ public Task<TResult> ShowDialogAsync(IDialogHost host = null)
{
+ if (host is null)
+ {
+ host = MainViewModel.Instance;
+ }
+
host.CurrentDialog = this;
IsDialogOpen = true;

MODIFY
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
@@ -27,7 +27,7 @@ namespace WalletWasabi.Fluent.ViewModels
async interaction =>
{
var x = new TestDialogViewModel(screen, interaction.Input);
- var result = await x.ShowDialogAsync(MainViewModel.Instance);
+ var result = await x.ShowDialogAsync();
interaction.SetOutput(result);
});

Dont require passing MainViewModel.Instance everytime you show a dialog.