Added demo Interaction
MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/TestDialogViewModel.cs
WalletWasabi.Fluent/ViewModels/Dialogs/TestDialogViewModel.cs
+using System.Windows.Input;
+using ReactiveUI;
+
namespace WalletWasabi.Fluent.ViewModels.Dialogs
{
- public class TestDialogViewModel : DialogViewModelBase<string>
+ public class TestDialogViewModel : DialogViewModelBase<bool>
{
+ private string _message;
+
+ public TestDialogViewModel(string message)
+ {
+ _message = message;
+
+ CancelCommand = ReactiveCommand.Create(() => Close(false));
+ ConfirmCommand = ReactiveCommand.Create(() => Close(true));
+ }
+
+ public string Message
+ {
+ get => _message;
+ set => this.RaiseAndSetIfChanged(ref _message, value);
+ }
+
+ public ICommand CancelCommand { get; }
+ public ICommand ConfirmCommand { get; }
+
protected override void OnDialogClosed()
{
}

MODIFY
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
using ReactiveUI;
+using System.Reactive.Threading.Tasks;
using System.Windows.Input;
using WalletWasabi.Fluent.ViewModels.Dialogs;
@@ -14,13 +15,24 @@ namespace WalletWasabi.Fluent.ViewModels
OpenDialogCommand = ReactiveCommand.Create(async () =>
{
- var x = new TestDialogViewModel();
+ var result = await ConfirmSetting.Handle("Please confirm the setting:").ToTask();
+ });
+
+ ConfirmSetting = new Interaction<string, bool>();
+
+ // NOTE: In ReactiveUI docs this is registered in view ctor.
+ ConfirmSetting.RegisterHandler(
+ async interaction =>
+ {
+ var x = new TestDialogViewModel(interaction.Input);
var result = await x.ShowDialogAsync(MainViewModel.Instance);
+ interaction.SetOutput(result);
});
}
public ICommand NextCommand { get; }
public ICommand OpenDialogCommand { get; }
+ public Interaction<string, bool> ConfirmSetting { get; }
public override string IconName => "settings_regular";
}

MODIFY
WalletWasabi.Fluent/Views/Dialogs/TestDialogView.axaml
WalletWasabi.Fluent/Views/Dialogs/TestDialogView.axaml
mc:Ignorable="d" Width="450" Height="200"
x:Class="WalletWasabi.Fluent.Views.Dialogs.TestDialogView">
<Panel Margin="10">
- <Button Classes="invisible" Command="{Binding Close}" HorizontalAlignment="Left" VerticalAlignment="Top">
+ <Button Classes="invisible" Command="{Binding CancelCommand}" HorizontalAlignment="Left" VerticalAlignment="Top">
<PathIcon Data="{StaticResource arrow_left_regular}" />
</Button>
<StackPanel HorizontalAlignment="Center"
VerticalAlignment="Center">
- <TextBlock Text="Hi, I'm a dialog!" />
+ <TextBlock Text="{Binding Message}" />
+ <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
+ <Button Content="Cancel" Margin="10" Command="{Binding CancelCommand}" />
+ <Button Content="Confirm" Margin="10" Command="{Binding ConfirmCommand}" />
+ </StackPanel>
</StackPanel>
</Panel>
</UserControl>
\ No newline at end of file

Added demo Interaction