Show balance in send
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
@@ -22,6 +22,11 @@ using WalletWasabi.WebClients.PayJoin;
using Constants = WalletWasabi.Helpers.Constants;
using WalletWasabi.Fluent.ViewModels.Dialogs;
using WalletWasabi.WabiSabi.Client;
+using WalletWasabi.Fluent.Helpers;
+using WalletWasabi.Fluent.ViewModels.Wallets.Home.Tiles;
+using System.Reactive;
+using System.Collections.ObjectModel;
+using WalletWasabi.Fluent.ViewModels.Wallets.Home.History.HistoryItems;
namespace WalletWasabi.Fluent.ViewModels.Wallets.Send;
@@ -47,7 +52,7 @@ public partial class SendViewModel : RoutableViewModel
private bool _parsingUrl;
- public SendViewModel(Wallet wallet)
+ public SendViewModel(Wallet wallet, IObservable<Unit> balanceChanged, ObservableCollection<HistoryItemViewModelBase> history)
{
_to = "";
_wallet = wallet;
@@ -58,6 +63,8 @@ public partial class SendViewModel : RoutableViewModel
ExchangeRate = _wallet.Synchronizer.UsdExchangeRate;
+ Balance = new WalletBalanceTileViewModel(wallet, balanceChanged, history);
+
SetupCancel(enableCancel: true, enableCancelOnEscape: true, enableCancelOnPressed: true);
EnableBack = false;
@@ -130,6 +137,8 @@ public partial class SendViewModel : RoutableViewModel
public ICommand AdvancedOptionsCommand { get; }
+ public WalletBalanceTileViewModel Balance { get; }
+
private async Task OnAutoPasteAsync()
{
var isAutoPasteEnabled = Services.UiConfig.AutoPaste;
@@ -301,6 +310,8 @@ public partial class SendViewModel : RoutableViewModel
RxApp.MainThreadScheduler.Schedule(async () => await OnAutoPasteAsync());
+ Balance.Activate(disposables);
+
base.OnNavigatedTo(inHistory, disposables);
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
@@ -116,7 +116,7 @@ public partial class WalletViewModel : WalletViewModelBase
this.WhenAnyValue(x => x.IsWalletBalanceZero)
.Subscribe(_ => IsSendButtonVisible = !IsWalletBalanceZero && (!wallet.KeyManager.IsWatchOnly || wallet.KeyManager.IsHardwareWallet));
- SendCommand = ReactiveCommand.Create(() => Navigate(NavigationTarget.DialogScreen).To(new SendViewModel(wallet)));
+ SendCommand = ReactiveCommand.Create(() => Navigate(NavigationTarget.DialogScreen).To(new SendViewModel(wallet, balanceChanged, History.UnfilteredTransactions)));
ReceiveCommand = ReactiveCommand.Create(() => Navigate(NavigationTarget.DialogScreen).To(new ReceiveViewModel(wallet)));

MODIFY
WalletWasabi.Fluent/Views/Wallets/Send/SendView.axaml
WalletWasabi.Fluent/Views/Wallets/Send/SendView.axaml
</DockPanel>
</DockPanel>
+ <!-- Balance -->
+ <c:PrivacyContentControl PrivacyReplacementMode="Text" DataContext="{Binding Balance}" DockPanel.Dock="Top" HorizontalAlignment="Center" NumberOfPrivacyChars="0">
+ <StackPanel Spacing="5" Orientation="Horizontal">
+ <TextBlock Text="{Binding BalanceBtc, StringFormat=Current Balance: {0}}" Opacity="0.6"/>
+ <TextBlock Text="{Binding BalanceFiat}" Opacity="0.6"/>
+ </StackPanel>
+ </c:PrivacyContentControl>
+
<!-- Advanced -->
<Button Classes="h8 plain activeHyperLink" Margin="0 10 0 0"
Command="{Binding AdvancedOptionsCommand}"

Show balance in send