Simplify XAML and ViewModel
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs
@@ -34,9 +34,9 @@ public partial class HistoryViewModel : ActivatableViewModel
[AutoNotify] private HistoryItemViewModelBase? _selectedItem;
[AutoNotify(SetterModifier = AccessModifier.Private)]
- private bool _isTransactionHistoryLoaded;
+ private bool _isTransactionHistoryEmpty;
[AutoNotify(SetterModifier = AccessModifier.Private)]
- private bool _isTransactionHistoryLoadedAndEmpty;
+ private bool _isTransactionHistoryLoaded;
public HistoryViewModel(WalletViewModel walletViewModel, IObservable<Unit> updateTrigger)
{
@@ -46,6 +46,9 @@ public partial class HistoryViewModel : ActivatableViewModel
_transactions = new ObservableCollectionExtended<HistoryItemViewModelBase>();
_unfilteredTransactions = new ObservableCollectionExtended<HistoryItemViewModelBase>();
+ this.WhenAnyValue(x => x.UnfilteredTransactions.Count)
+ .Subscribe(x => IsTransactionHistoryEmpty = x <= 0);
+
_transactionSourceList
.Connect()
.ObserveOn(RxApp.MainThreadScheduler)
@@ -222,12 +225,13 @@ public partial class HistoryViewModel : ActivatableViewModel
var rawHistoryList = await Task.Run(historyBuilder.BuildHistorySummary);
var orderedRawHistoryList = rawHistoryList.OrderBy(x => x.DateTime).ThenBy(x => x.Height).ThenBy(x => x.BlockIndex).ToList();
var newHistoryList = GenerateHistoryList(orderedRawHistoryList).ToArray();
+
_transactionSourceList.Edit(x =>
{
x.Clear();
x.AddRange(newHistoryList);
});
- IsTransactionHistoryLoadedAndEmpty = _transactionSourceList.Count <= 0;
+
IsTransactionHistoryLoaded = true;
}
catch (Exception ex)

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
@@ -89,13 +89,8 @@ public partial class WalletViewModel : WalletViewModelBase
.DisposeWith(Disposables);
}
- this.WhenAnyValue(x => x.History.IsTransactionHistoryLoaded, x => x.History.IsTransactionHistoryLoadedAndEmpty)
- .Do(tuple =>
- {
- var (isTransactionHistoryLoaded, isTransactionHistoryLoadedAndEmpty) = tuple;
- IsEmptyWallet = !isTransactionHistoryLoaded || isTransactionHistoryLoadedAndEmpty;
- })
- .Subscribe();
+ this.WhenAnyValue(x => x.History.IsTransactionHistoryEmpty)
+ .Subscribe(x => IsEmptyWallet = x);
_smallLayoutHeightBreakpoint = double.MaxValue;
_wideLayoutWidthBreakpoint = double.MaxValue;

MODIFY
WalletWasabi.Fluent/Views/Wallets/Home/History/HistoryTable.axaml
WalletWasabi.Fluent/Views/Wallets/Home/History/HistoryTable.axaml
</TreeDataGrid.Styles>
</TreeDataGrid>
- <Panel IsVisible="{Binding !IsTransactionHistoryLoaded}">
+ <Panel IsVisible="{Binding IsTransactionHistoryEmpty}">
<c:HistoryPlaceholderPanel Margin="{StaticResource HistoryTablePlaceholderPanelMargin}"
RowHeight="{StaticResource HistoryTableRowHeight}" />
<Panel Background="{DynamicResource RegionColor}" Opacity="0.75" />
- </Panel>
- <Panel IsVisible="{Binding IsTransactionHistoryLoadedAndEmpty}"
- Margin="{StaticResource HistoryTablePlaceholderPanelMargin}">
- <c:HistoryPlaceholderPanel RowHeight="{StaticResource HistoryTableRowHeight}" />
- <Panel Background="{DynamicResource RegionColor}" Opacity="0.75" />
- <Grid RowDefinitions="26,1*,1.5*">
+ <Grid RowDefinitions="26,1*,1.5*" IsVisible="{Binding IsTransactionHistoryLoaded}">
<Panel Grid.Row="1">
<c:InfoMessage VerticalAlignment="Center"
HorizontalAlignment="Center">

Simplify XAML and ViewModel