use IDialogHost and hide out the api from MainView.
MODIFY
WalletWasabi.Fluent/ViewModels/Dialog/DialogViewModelBase.cs
WalletWasabi.Fluent/ViewModels/Dialog/DialogViewModelBase.cs
@@ -10,11 +10,11 @@ namespace WalletWasabi.Fluent.ViewModels.Dialog
{
public abstract class DialogViewModelBase : ReactiveObject
{
- public MainViewModel MainView { get; }
+ public IDialogHost DialogHost { get; }
- public DialogViewModelBase(MainViewModel mainViewModel)
+ public DialogViewModelBase(IDialogHost dialogHost)
{
- this.MainView = mainViewModel;
+ this.DialogHost = dialogHost;
}
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Dialog/DialogViewModelBase`1.cs
WalletWasabi.Fluent/ViewModels/Dialog/DialogViewModelBase`1.cs
@@ -3,8 +3,6 @@ using System.Collections.Generic;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
-using ReactiveUI;
-using WalletWasabi.Fluent.ViewModels.Dialog;
namespace WalletWasabi.Fluent.ViewModels.Dialog
{
@@ -21,7 +19,7 @@ namespace WalletWasabi.Fluent.ViewModels.Dialog
{
var tcs = new TaskCompletionSource<TResult>();
- MainView.ShowDialog(this);
+ DialogHost.ShowDialog(this);
DialogShown(tcs);
return tcs.Task;

ADD
WalletWasabi.Fluent/ViewModels/Dialog/IDialogHost.cs
+namespace WalletWasabi.Fluent.ViewModels.Dialog
+{
+ public interface IDialogHost
+ {
+ void CloseDialog();
+ void ShowDialog<TDialog>(TDialog dialogViewModel) where TDialog : DialogViewModelBase;
+ DialogViewModelBase CurrentDialog { get; set; }
+ }
+}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -8,14 +8,14 @@ using WalletWasabi.Fluent.ViewModels.Dialog;
namespace WalletWasabi.Fluent.ViewModels
{
- public class MainViewModel : ViewModelBase
+ public class MainViewModel : ViewModelBase, IDialogHost
{
private DialogViewModelBase _currentDialog;
- public DialogViewModelBase CurrentDialog
+ DialogViewModelBase IDialogHost.CurrentDialog
{
get => _currentDialog;
- private set => this.RaiseAndSetIfChanged(ref _currentDialog, value, nameof(CurrentDialog));
+ set => this.RaiseAndSetIfChanged(ref _currentDialog, value, nameof(IDialogHost.CurrentDialog));
}
public MainViewModel()
@@ -23,14 +23,14 @@ namespace WalletWasabi.Fluent.ViewModels
}
- public void ShowDialog<TDialog>(TDialog dialogViewModel) where TDialog : DialogViewModelBase
+ void IDialogHost.ShowDialog<TDialog>(TDialog dialogViewModel)
{
- CurrentDialog = dialogViewModel;
+ (this as IDialogHost).CurrentDialog = dialogViewModel;
}
- public void CloseDialog()
+ void IDialogHost.CloseDialog()
{
- CurrentDialog = null;
+ (this as IDialogHost).CurrentDialog = null;
}
}
}
\ No newline at end of file

use IDialogHost and hide out the api from MainView.