Initial prototype, will polish this a little bit
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Advanced/WalletStatsViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Advanced/WalletStatsViewModel.cs
-using System;
-using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Reactive.Disposables;
+using System.Reactive.Linq;
+using NBitcoin;
using ReactiveUI;
using WalletWasabi.Fluent.ViewModels.Navigation;
+using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Wallets.Advanced;
[NavigationMetaData(Title = "Wallet Stats")]
public partial class WalletStatsViewModel : RoutableViewModel
{
+ [AutoNotify] private int _coinCount;
+ [AutoNotify] private bool _showSensitiveData = true;
+ [AutoNotify] private Money _balance;
+ [AutoNotify] private Money _confirmedBalance;
+ [AutoNotify] private Money _unconfirmedBalance;
+
+ private readonly Wallet _wallet;
+
public WalletStatsViewModel(WalletViewModelBase walletViewModelBase)
{
- var wallet = walletViewModelBase.Wallet;
+ _wallet = walletViewModelBase.Wallet;
+
+ UpdateProps();
+
+ NextCommand = ReactiveCommand.Create(() => Navigate().Clear());
+ SetupCancel(enableCancel: true, enableCancelOnEscape: true, enableCancelOnPressed: true);
+ }
+
+ protected override void OnNavigatedTo(bool isInHistory, CompositeDisposable disposables)
+ {
+ base.OnNavigatedTo(isInHistory, disposables);
+ Observable.FromEventPattern(_wallet, nameof(_wallet.WalletRelevantTransactionProcessed))
+ .Subscribe(_ => UpdateProps())
+ .DisposeWith(disposables);
+ }
+
+ private void UpdateProps()
+ {
// Number of coins in the wallet.
- // Changes to wallet.WalletRelevantTransactionProcessed
- var coinCount = wallet.Coins.Unspent().Count();
+ CoinCount = _wallet.Coins.Unspent().Count();
// Total amount of money in the wallet.
- // Changes to wallet.WalletRelevantTransactionProcessed
- var balance = wallet.Coins.Unspent().TotalAmount();
+ Balance = _wallet.Coins.Unspent().TotalAmount();
// Total amount of confirmed money in the wallet.
- // Changes to wallet.WalletRelevantTransactionProcessed
- var confirmedBalance = wallet.Coins.Confirmed().TotalAmount();
+ ConfirmedBalance = _wallet.Coins.Confirmed().TotalAmount();
// Total amount of unconfirmed money in the wallet.
- // Changes to wallet.WalletRelevantTransactionProcessed
- var unconfirmedBalance = wallet.Coins.Unconfirmed().TotalAmount();
+ UnconfirmedBalance = _wallet.Coins.Unconfirmed().TotalAmount();
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
@@ -137,6 +137,11 @@ public partial class WalletViewModel : WalletViewModelBase
Navigate(NavigationTarget.DialogScreen).To(new WalletInfoViewModel(this));
});
+ WalletStatisticsCommand = ReactiveCommand.CreateFromTask( async () =>
+ {
+ Navigate(NavigationTarget.DialogScreen).To(new WalletStatsViewModel(this));
+ });
+
WalletSettingsCommand = ReactiveCommand.Create((Action)(() => RoutableViewModel.Navigate((Fluent.NavigationTarget)Fluent.NavigationTarget.DialogScreen).To(Settings)));
}
@@ -152,6 +157,8 @@ public partial class WalletViewModel : WalletViewModelBase
public ICommand WalletSettingsCommand { get; }
+ public ICommand WalletStatisticsCommand { get; }
+
private CompositeDisposable Disposables { get; set; }
public HistoryViewModel History { get; }

ADD
WalletWasabi.Fluent/Views/Wallets/Advanced/WalletStatsView.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="using:WalletWasabi.Fluent.Controls"
+ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+ xmlns:advanced="clr-namespace:WalletWasabi.Fluent.ViewModels.Wallets.Advanced"
+ xmlns:conv="clr-namespace:WalletWasabi.Fluent.Converters"
+ x:DataType="advanced:WalletStatsViewModel"
+ x:CompileBindings="True"
+ x:Class="WalletWasabi.Fluent.Views.Wallets.Advanced.WalletStatsView">
+ <c:ContentArea Title="{Binding Title}"
+ EnableNext="True" NextContent="Done">
+ <StackPanel>
+ <c:PreviewItem Icon="{StaticResource private_key_regular}"
+ Text="Extended Master Private Key"
+ CopyParameter="{Binding CoinCount}"
+ PrivacyModeEnabled="{Binding !ShowSensitiveData}">
+ <TextBlock Classes="monoSpaced" Text="{Binding CoinCount}" />
+ </c:PreviewItem>
+
+ <c:PreviewItem Icon="{StaticResource private_key_regular}"
+ Text="Extended Master Private Key"
+ CopyParameter="{Binding Balance}"
+ PrivacyModeEnabled="{Binding !ShowSensitiveData}">
+ <TextBlock Classes="monoSpaced" Text="{Binding Balance}" />
+ </c:PreviewItem>
+
+ <c:PreviewItem Icon="{StaticResource private_key_regular}"
+ Text="Extended Master Private Key"
+ CopyParameter="{Binding ConfirmedBalance}"
+ PrivacyModeEnabled="{Binding !ShowSensitiveData}">
+ <TextBlock Classes="monoSpaced" Text="{Binding ConfirmedBalance}" />
+ </c:PreviewItem>
+
+ <c:PreviewItem Icon="{StaticResource private_key_regular}"
+ Text="Extended Master Private Key"
+ CopyParameter="{Binding UnconfirmedBalance}"
+ PrivacyModeEnabled="{Binding !ShowSensitiveData}">
+ <TextBlock Classes="monoSpaced" Text="{Binding UnconfirmedBalance}" />
+ </c:PreviewItem>
+ </StackPanel>
+ </c:ContentArea>
+</UserControl>
\ No newline at end of file

ADD
WalletWasabi.Fluent/Views/Wallets/Advanced/WalletStatsView.axaml.cs
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace WalletWasabi.Fluent.Views.Wallets.Advanced;
+
+public class WalletStatsView : UserControl
+{
+ public WalletStatsView()
+ {
+ InitializeComponent();
+ }
+
+ private void InitializeComponent()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+}

MODIFY
WalletWasabi.Fluent/Views/Wallets/WalletView.axaml
WalletWasabi.Fluent/Views/Wallets/WalletView.axaml
<PathIcon Data="{StaticResource settings_wallet_regular}" />
</MenuItem.Icon>
</MenuItem>
+ <MenuItem Header="Wallet Statistics" Command="{Binding WalletStatisticsCommand}">
+ <MenuItem.Icon>
+ <PathIcon Data="{StaticResource settings_wallet_regular}" />
+ </MenuItem.Icon>
+ </MenuItem>
</MenuFlyout>
</Button.Flyout>
<PathIcon Data="{StaticResource more_regular}" Foreground="{DynamicResource TextForegroundColor}" />

Initial prototype, will polish this a little bit