ordering optimalization
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml
<TextBlock Text="" Width="0" />
<TextBlock Text="" Grid.Column="1" />
- <controls:SortingArrow Grid.Column="2" Text="Status" SortDirection="{Binding StatusSortDirection} " />
+ <controls:SortingArrow Grid.Column="2" Text="Status" Command="{Binding SortCommand}" SortDirection="{Binding StatusSortDirection} " />
- <controls:SortingArrow Grid.Column="3" Text="Amount (BTC)" SortDirection="{Binding AmountSortDirection}" />
+ <controls:SortingArrow Grid.Column="3" Text="Amount (BTC)" Command="{Binding SortCommand}" SortDirection="{Binding AmountSortDirection}" />
- <controls:SortingArrow Grid.Column="4" Text="Privacy" SortDirection="{Binding PrivacySortDirection}" />
+ <controls:SortingArrow Grid.Column="4" Text="Privacy" Command="{Binding SortCommand}" SortDirection="{Binding PrivacySortDirection}" />
- <controls:SortingArrow Grid.Column="5" Text="History" SortDirection="{Binding HistorySortDirection}" />
+ <controls:SortingArrow Grid.Column="5" Text="History" Command="{Binding SortCommand}" SortDirection="{Binding HistorySortDirection}" />
</Grid>
<StackPanel Margin="0 10 0 0" Spacing="10" DockPanel.Dock="Bottom" Orientation="Horizontal">
<CheckBox Content = "Select All" IsThreeState="True" IsChecked = "{Binding SelectAllCheckBoxState}" Command="{Binding SelectAllCheckBoxCommand}" />

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
@@ -52,6 +52,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
public ReactiveCommand SelectAllCheckBoxCommand { get; }
public ReactiveCommand SelectPrivateCheckBoxCommand { get; }
public ReactiveCommand SelectNonPrivateCheckBoxCommand { get; }
+ public ReactiveCommand SortCommand { get; }
public event Action DequeueCoinsPressed;
@@ -222,8 +223,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
StatusSortDirection = SortOrder.None;
HistorySortDirection = SortOrder.None;
}
- if (x != SortOrder.None)
- RefreshOrdering();
}).DisposeWith(_disposables);
this.WhenAnyValue(x => x.HistorySortDirection).Subscribe(x =>
@@ -234,8 +233,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
StatusSortDirection = SortOrder.None;
PrivacySortDirection = SortOrder.None;
}
- if (x != SortOrder.None)
- RefreshOrdering();
}).DisposeWith(_disposables);
this.WhenAnyValue(x => x.StatusSortDirection).Subscribe(x =>
@@ -246,8 +243,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
PrivacySortDirection = SortOrder.None;
HistorySortDirection = SortOrder.None;
}
- if (x != SortOrder.None)
- RefreshOrdering();
}).DisposeWith(_disposables);
this.WhenAnyValue(x => x.PrivacySortDirection).Subscribe(x =>
@@ -258,8 +253,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
StatusSortDirection = SortOrder.None;
HistorySortDirection = SortOrder.None;
}
- if (x != SortOrder.None)
- RefreshOrdering();
}).DisposeWith(_disposables);
EnqueueCoin = ReactiveCommand.Create(() =>
@@ -331,6 +324,9 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
break;
}
}).DisposeWith(_disposables);
+
+ SortCommand = ReactiveCommand.Create(() => RefreshOrdering()).DisposeWith(_disposables);
+
SetSelections();
SetCoinJoinStatusWidth();
}

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabView.xaml
<DockPanel LastChildFill="True" DockPanel.Dock="Bottom">
<Grid ColumnDefinitions="40, 160, 150, *" Margin="10 0 0 0" DockPanel.Dock="Top">
<TextBlock Text="" />
- <controls:SortingArrow Grid.Column="1" Text="Date" SortDirection="{Binding DateSortDirection}"/>
- <controls:SortingArrow Grid.Column="2" Text="Amount (BTC)" SortDirection="{Binding AmountSortDirection}"/>
- <controls:SortingArrow Grid.Column="3" Text="Transaction ID" SortDirection="{Binding TransactionSortDirection}"/>
+ <controls:SortingArrow Grid.Column="1" Command="{Binding SortCommand}" Text="Date" SortDirection="{Binding DateSortDirection}" />
+ <controls:SortingArrow Grid.Column="2" Command="{Binding SortCommand}" Text="Amount (BTC)" SortDirection="{Binding AmountSortDirection}" />
+ <controls:SortingArrow Grid.Column="3" Command="{Binding SortCommand}" Text="Transaction ID" SortDirection="{Binding TransactionSortDirection}" />
</Grid>
<ListBox Items="{Binding Transactions}" SelectedItem="{Binding SelectedTransaction, Mode=TwoWay}">
<ListBox.ItemTemplate>

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
@@ -31,6 +31,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private SortOrder _transactionSortDirection;
private CompositeDisposable _disposables = new CompositeDisposable();
+ public ReactiveCommand SortCommand { get; }
+
public HistoryTabViewModel(WalletViewModel walletViewModel)
: base("History", walletViewModel)
{
@@ -45,7 +47,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
coinsChanged
.Merge(newBlockProcessed)
.Merge(coinSpent)
- .Throttle(TimeSpan.FromSeconds(10))
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(o =>
{
@@ -75,6 +76,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
}).DisposeWith(_disposables);
+ SortCommand = ReactiveCommand.Create(() => RefreshOrdering()).DisposeWith(_disposables);
+
DateSortDirection = SortOrder.Decreasing;
}
@@ -220,7 +223,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
AmountSortDirection = SortOrder.None;
TransactionSortDirection = SortOrder.None;
}
- RefreshOrdering();
}
}
@@ -235,7 +237,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
DateSortDirection = SortOrder.None;
TransactionSortDirection = SortOrder.None;
}
- RefreshOrdering();
}
}
@@ -250,23 +251,21 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
AmountSortDirection = SortOrder.None;
DateSortDirection = SortOrder.None;
}
- RefreshOrdering();
}
}
private void RefreshOrdering()
{
- ObservableCollection<TransactionViewModel> newTrs = null;
if (TransactionSortDirection != SortOrder.None)
{
switch (TransactionSortDirection)
{
case SortOrder.Increasing:
- newTrs = new ObservableCollection<TransactionViewModel>(_transactions.OrderBy(t => t.TransactionId));
+ Transactions = new ObservableCollection<TransactionViewModel>(_transactions.OrderBy(t => t.TransactionId));
break;
case SortOrder.Decreasing:
- newTrs = new ObservableCollection<TransactionViewModel>(_transactions.OrderByDescending(t => t.TransactionId));
+ Transactions = new ObservableCollection<TransactionViewModel>(_transactions.OrderByDescending(t => t.TransactionId));
break;
}
}
@@ -275,11 +274,11 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
switch (AmountSortDirection)
{
case SortOrder.Increasing:
- newTrs = new ObservableCollection<TransactionViewModel>(_transactions.OrderBy(t => t.Amount));
+ Transactions = new ObservableCollection<TransactionViewModel>(_transactions.OrderBy(t => t.Amount));
break;
case SortOrder.Decreasing:
- newTrs = new ObservableCollection<TransactionViewModel>(_transactions.OrderByDescending(t => t.Amount));
+ Transactions = new ObservableCollection<TransactionViewModel>(_transactions.OrderByDescending(t => t.Amount));
break;
}
}
@@ -288,22 +287,14 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
switch (DateSortDirection)
{
case SortOrder.Increasing:
- newTrs = new ObservableCollection<TransactionViewModel>(_transactions.OrderBy(t => t.DateTime));
+ Transactions = new ObservableCollection<TransactionViewModel>(_transactions.OrderBy(t => t.DateTime));
break;
case SortOrder.Decreasing:
- newTrs = new ObservableCollection<TransactionViewModel>(_transactions.OrderByDescending(t => t.DateTime));
+ Transactions = new ObservableCollection<TransactionViewModel>(_transactions.OrderByDescending(t => t.DateTime));
break;
}
}
- if (newTrs != null)
- {
- foreach (var tr in Transactions)
- {
- tr.Dispose();
- }
- Transactions = newTrs;
- }
}
#region IDisposable Support

ordering optimalization