initial implementation of legal docs navigation.
ADD
WalletWasabi.Fluent/ViewModels/AddWallet/TermsAndConditionsViewModel.cs
+using System.Reactive;
+using System.Windows.Input;
+using ReactiveUI;
+using WalletWasabi.Fluent.ViewModels.Dialogs;
+
+namespace WalletWasabi.Fluent.ViewModels.AddWallet
+{
+ public class LegalDocumentsViewModel : DialogViewModelBase<Unit>
+ {
+ public LegalDocumentsViewModel(NavigationStateViewModel navigationState, NavigationTarget navigationTarget, string content) :
+ base(navigationState, navigationTarget)
+ {
+ }
+
+ protected override void OnDialogClosed()
+ {
+ }
+ }
+
+ public class TermsAndConditionsViewModel : DialogViewModelBase<bool>
+ {
+ private bool _isAgreed;
+
+ public TermsAndConditionsViewModel(NavigationStateViewModel navigationState) : base(navigationState, NavigationTarget.DialogScreen)
+ {
+ ViewTermsCommand = ReactiveCommand.CreateFromTask(
+ async () =>
+ {
+ var legalDocs = new LegalDocumentsViewModel(
+ navigationState,
+ NavigationTarget.DialogScreen,
+ "Lorem ipsum dolar ipsamet");
+
+ navigationState.DialogScreen.Invoke().Router.Navigate.Execute(legalDocs);
+
+ var result = await legalDocs.GetDialogResultAsync();
+ });
+
+ NextCommand = ReactiveCommand.Create(
+ () => Close(true),
+ this.WhenAnyValue(x => x.IsAgreed));
+ }
+
+ public bool IsAgreed
+ {
+ get => _isAgreed;
+ set => this.RaiseAndSetIfChanged(ref _isAgreed, value);
+ }
+
+ public ICommand ViewTermsCommand { get; }
+ protected override void OnDialogClosed()
+ {
+
+ }
+ }
+}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
WalletWasabi.Fluent/ViewModels/AddWalletPageViewModel.cs
@@ -26,6 +26,9 @@ namespace WalletWasabi.Fluent.ViewModels
{
Title = "Add Wallet";
+ OpenCommand = ReactiveCommand.CreateFromTask(
+ async () => await ShowTermsAndConditionsAsync());
+
this.WhenAnyValue(x => x.WalletName)
.Select(x => !string.IsNullOrWhiteSpace(x))
.Subscribe(x => OptionsEnabled = x && !Validations.Any);
@@ -72,6 +75,22 @@ namespace WalletWasabi.Fluent.ViewModels
this.ValidateProperty(x => x.WalletName, errors => ValidateWalletName(errors, walletManager, WalletName));
}
+ private async Task ShowTermsAndConditionsAsync()
+ {
+ var termsAndConditions = new TermsAndConditionsViewModel(NavigationState);
+
+ termsAndConditions.Navigate();
+
+ if (await termsAndConditions.GetDialogResultAsync())
+ {
+ Navigate();
+ }
+ else
+ {
+ GoBack();
+ }
+ }
+
private void ValidateWalletName(IValidationErrors errors, WalletManager walletManager, string walletName)
{
string walletFilePath = Path.Combine(walletManager.WalletDirectories.WalletsDir, $"{walletName}.json");

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBase.cs
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBase.cs
+using System.Windows.Input;
using ReactiveUI;
using WalletWasabi.Gui.ViewModels;
@@ -12,8 +13,11 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
public DialogViewModelBase(NavigationStateViewModel navigationState, NavigationTarget navigationTarget) : base(navigationState, navigationTarget)
{
+
}
+ public ICommand NextCommand { get; protected set; }
+
/// <summary>
/// Gets or sets if the dialog is opened/closed.
/// </summary>

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBaseOfTResult.cs
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBaseOfTResult.cs
@@ -24,6 +24,8 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
.Skip(1) // Skip the initial value change (which is false).
.DistinctUntilChanged()
.Subscribe(OnIsDialogOpenChanged);
+
+ CancelCommand = ReactiveCommand.Create(() => Close());
}
private void OnIsDialogOpenChanged(bool dialogState)

MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/EnterPasswordViewModel.cs
WalletWasabi.Fluent/ViewModels/Dialogs/EnterPasswordViewModel.cs
@@ -58,8 +58,6 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
set => this.RaiseAndSetIfChanged(ref _confirmPassword, value);
}
- public ICommand NextCommand { get; }
-
public string Subtitle { get; }
protected override void OnDialogClosed()

MODIFY
WalletWasabi.Fluent/ViewModels/NavBar/NavBarItemViewModel.cs
WalletWasabi.Fluent/ViewModels/NavBar/NavBarItemViewModel.cs
@@ -45,6 +45,6 @@ namespace WalletWasabi.Fluent.ViewModels.NavBar
set => this.RaiseAndSetIfChanged(ref _isSelected, value);
}
- public ICommand OpenCommand { get; }
+ public ICommand OpenCommand { get; protected set; }
}
}
\ No newline at end of file

ADD
WalletWasabi.Fluent/Views/AddWallet/TermsAndConditionsView.axaml
+<UserControl xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:c="clr-namespace:WalletWasabi.Fluent.Controls"
+ mc:Ignorable="d"
+ xmlns:behaviors="clr-namespace:WalletWasabi.Fluent.Behaviors;assembly=WalletWasabi.Fluent"
+ xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity"
+ d:DesignWidth="600" d:DesignHeight="500"
+ x:Class="WalletWasabi.Fluent.Views.AddWallet.TermsAndConditionsView">
+ <c:ContentArea Title="Terms and Conditions"
+ Caption="Please read the small print."
+ EnableCancel="True" CancelContent="Cancel"
+ EnableNext="True" NextContent="Continue" FocusNext="True">
+ <CheckBox IsChecked="{Binding IsAgreed}">
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Text="I agree to the " />
+ <Button Classes="plain" Content="Terms and Conditions" />
+ </StackPanel>
+ </CheckBox>
+ </c:ContentArea>
+</UserControl>
\ No newline at end of file

ADD
WalletWasabi.Fluent/Views/AddWallet/TermsAndConditionsView.xaml.cs
+using Avalonia.Markup.Xaml;
+using Avalonia.ReactiveUI;
+using WalletWasabi.Fluent.ViewModels.AddWallet;
+
+namespace WalletWasabi.Fluent.Views.AddWallet
+{
+ public class TermsAndConditionsView : ReactiveUserControl<TermsAndConditionsViewModel>
+ {
+ public TermsAndConditionsView()
+ {
+ InitializeComponent();
+ }
+
+ private void InitializeComponent()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+ }
+}

MODIFY
WalletWasabi.Fluent/Views/AddWalletPageView.axaml
WalletWasabi.Fluent/Views/AddWalletPageView.axaml
x:CompileBindings="True"
x:Class="WalletWasabi.Fluent.Views.AddWalletPageView">
- <c:ContentArea Title="Add Wallet" Caption="Type in your wallet's name and select an option:"
- EnableBack="True">
+ <c:ContentArea Title="Add Wallet" Caption="Type in your wallet's name and select an option:">
<DockPanel>
<StackPanel DockPanel.Dock="Top" Margin="0 0 0 20">
<Label Content="Wallet _Name:" Target="walletNameTb" />

initial implementation of legal docs navigation.