[skip ci] ordering coinlist finish
MODIFY
WalletWasabi.Gui/Controls/SortingArrow.cs
WalletWasabi.Gui/Controls/SortingArrow.cs
@@ -15,29 +15,26 @@ using Avalonia.Data;
namespace WalletWasabi.Gui.Controls
{
- public class SortingArrow : Button, IStyleable
- {
- public SortingArrow()
+ public enum SortOrder
{
- MinWidth = 15;
- MinHeight = 15;
- Background = Brushes.Transparent;
- BorderBrush = Brushes.Transparent;
+ None,
+ Increasing,
+ Decreasing
}
-
+ public class SortingArrow : Button, IStyleable
+ {
Type IStyleable.StyleKey => typeof(Button);
-
static readonly Geometry UpArrow = Geometry.Parse("M13.889,11.611c-0.17,0.17-0.443,0.17-0.612,0l-3.189-3.187l-3.363,3.36c-0.171,0.171-0.441,0.171-0.612,0c-0.172-0.169-0.172-0.443,0-0.611l3.667-3.669c0.17-0.17,0.445-0.172,0.614,0l3.496,3.493C14.058,11.167,14.061,11.443,13.889,11.611 M18.25,10c0,4.558-3.693,8.25-8.25,8.25c-4.557,0-8.25-3.692-8.25-8.25c0-4.557,3.693-8.25,8.25-8.25C14.557,1.75,18.25,5.443,18.25,10 M17.383,10c0-4.07-3.312-7.382-7.383-7.382S2.618,5.93,2.618,10S5.93,17.381,10,17.381S17.383,14.07,17.383,10");
static readonly Geometry DownArrow = Geometry.Parse("M13.962,8.885l-3.736,3.739c-0.086,0.086-0.201,0.13-0.314,0.13S9.686,12.71,9.6,12.624l-3.562-3.56C5.863,8.892,5.863,8.611,6.036,8.438c0.175-0.173,0.454-0.173,0.626,0l3.25,3.247l3.426-3.424c0.173-0.172,0.451-0.172,0.624,0C14.137,8.434,14.137,8.712,13.962,8.885 M18.406,10c0,4.644-3.763,8.406-8.406,8.406S1.594,14.644,1.594,10S5.356,1.594,10,1.594S18.406,5.356,18.406,10 M17.521,10c0-4.148-3.373-7.521-7.521-7.521c-4.148,0-7.521,3.374-7.521,7.521c0,4.147,3.374,7.521,7.521,7.521C14.148,17.521,17.521,14.147,17.521,10");
static readonly Geometry NoArrow = Geometry.Parse("M10,0.562c-5.195,0-9.406,4.211-9.406,9.406c0,5.195,4.211,9.406,9.406,9.406c5.195,0,9.406-4.211,9.406-9.406C19.406,4.774,15.195,0.562,10,0.562 M10,18.521c-4.723,0-8.551-3.829-8.551-8.552S5.277,1.418,10,1.418s8.552,3.828,8.552,8.551S14.723,18.521,10,18.521");
-
Path _iconPath;
- protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
+ public SortingArrow()
{
- base.OnTemplateApplied(e);
- Click += SortingArrow_Click;
-
+ MinWidth = 15;
+ MinHeight = 15;
+ Background = Brushes.Transparent;
+ BorderBrush = Brushes.Transparent;
_iconPath = new Path()
{
Data = NoArrow,
@@ -48,39 +45,44 @@ namespace WalletWasabi.Gui.Controls
Height = 10
};
-
Canvas stackPnl = new Canvas();
stackPnl.Children.Add(_iconPath);
stackPnl.Width = 10;
stackPnl.Height = 10;
Content = stackPnl;
+ this.GetObservable(SortDirectionProperty).Subscribe(x =>
+ {
+ SortDirection = x;
+ });
+ }
+
+ protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
+ {
+ base.OnTemplateApplied(e);
+ Click += SortingArrow_Click;
}
void SortingArrow_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
{
switch (SortDirection)
{
- case null:
- SortDirection = true;
-
+ case SortOrder.None:
+ SortDirection = SortOrder.Increasing;
break;
- case true:
- SortDirection = false;
-
+ case SortOrder.Increasing:
+ SortDirection = SortOrder.Decreasing;
break;
- case false:
- SortDirection = null;
-
+ case SortOrder.Decreasing:
+ SortDirection = SortOrder.Increasing;
break;
}
- RefreshArrowIcon();
}
- public static readonly StyledProperty<bool?> SortDirectionProperty =
- AvaloniaProperty.Register<SortingArrow, bool?>(nameof(SortDirection), defaultBindingMode: BindingMode.TwoWay);
+ public static readonly StyledProperty<SortOrder> SortDirectionProperty =
+ AvaloniaProperty.Register<SortingArrow, SortOrder>(nameof(SortDirection), defaultBindingMode: BindingMode.TwoWay);
- public bool? SortDirection
+ public SortOrder SortDirection
{
get => GetValue(SortDirectionProperty);
set
@@ -90,23 +92,20 @@ namespace WalletWasabi.Gui.Controls
}
}
-
-
private void RefreshArrowIcon()
{
switch (SortDirection)
{
- case null:
+ case SortOrder.None:
_iconPath.Data = NoArrow;
break;
- case true:
+ case SortOrder.Increasing:
_iconPath.Data = DownArrow;
break;
- case false:
+ case SortOrder.Decreasing:
_iconPath.Data = UpArrow;
break;
}
}
-
}
}
\ No newline at end of file

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml
<DataTemplate>
<Grid>
<Expander Name="coinExpander" ExpandDirection="Down" Classes="coloredExpander" Background="{Binding ElementName=coinExpander, Path=IsExpanded, Converter={StaticResource CoinItemExpanderColorConverter}}">
-
<StackPanel>
<Grid HorizontalAlignment="Left" ColumnDefinitions="150, *" RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto" MaxWidth="800">
<TextBlock Text="Transaction Id:" Grid.Row="0" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
-
</DockPanel>
-
</UserControl>

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
@@ -14,9 +14,9 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private IReactiveDerivedList<CoinViewModel> _rootcoinlist;
private CoinViewModel _selectedCoin;
private bool? _selectAllCheckBoxState;
- private bool? _statusSortDirection;
- private bool? _privacySortDirection;
- private bool? _amountSortDirection;
+ private SortOrder _statusSortDirection;
+ private SortOrder _privacySortDirection;
+ private SortOrder _amountSortDirection;
public ReactiveCommand EnqueueCoin { get; }
public ReactiveCommand DequeueCoin { get; }
@@ -52,70 +52,74 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
this.RaiseAndSetIfChanged(ref _selectAllCheckBoxState, value);
}
}
- public bool? StatusSortDirection
+ public SortOrder StatusSortDirection
{
get => _statusSortDirection;
set
{
this.RaiseAndSetIfChanged(ref _statusSortDirection, value);
- //switch (value)
- //{
- // case null:
- // break;
- // case true:
- // Coins = _rootcoinlist.CreateDerivedCollection(x => x, x => true, (x, y) => x.Status.CompareTo(y.Amount));
- // break;
- // case false:
- // Coins = _rootcoinlist.CreateDerivedCollection(x => x, x => true, (x, y) => y.Status.CompareTo(x.Amount));
- // break;
- //}
+ if (value != SortOrder.None)
+ {
+ AmountSortDirection = SortOrder.None;
+ PrivacySortDirection = SortOrder.None;
+ }
+ switch (value)
+ {
+ case SortOrder.Increasing:
+ Coins = _rootcoinlist.CreateDerivedCollection(x => x, x => true, (x, y) => x.Status.CompareTo(y.Status));
+ break;
+ case SortOrder.Decreasing:
+ Coins = _rootcoinlist.CreateDerivedCollection(x => x, x => true, (x, y) => y.Status.CompareTo(x.Status));
+ break;
+ }
}
}
- public bool? AmountSortDirection
+ public SortOrder AmountSortDirection
{
get => _amountSortDirection;
set
{
this.RaiseAndSetIfChanged(ref _amountSortDirection, value);
- //switch (value)
- //{
- // case null:
- // break;
- // case true:
- // Coins = _rootcoinlist.CreateDerivedCollection(x => x, x => true, (x, y) => x.Amount.CompareTo(y.Amount));
- // break;
- // case false:
- // Coins = _rootcoinlist.CreateDerivedCollection(x => x, x => true, (x, y) => y.Amount.CompareTo(x.Amount));
- // break;
- //}
- //if (value != null)
- //{
- // PrivacySortDirection = true;
- // //AmountSortDirection = null;
- // StatusSortDirection = true;
- //}
- }
- }
- public bool? PrivacySortDirection
+ if (value != SortOrder.None)
+ {
+ PrivacySortDirection = SortOrder.None;
+ StatusSortDirection = SortOrder.None;
+ }
+
+ switch (value)
+ {
+ case SortOrder.Increasing:
+ Coins = _rootcoinlist.CreateDerivedCollection(x => x, x => true, (x, y) => x.Amount.CompareTo(y.Amount));
+ break;
+ case SortOrder.Decreasing:
+ Coins = _rootcoinlist.CreateDerivedCollection(x => x, x => true, (x, y) => y.Amount.CompareTo(x.Amount));
+ break;
+ }
+
+ }
+ }
+ public SortOrder PrivacySortDirection
{
get => _privacySortDirection;
set
{
-
- //switch (value)
- //{
- // case null:
- // break;
- // case true:
- // Coins = _rootcoinlist.CreateDerivedCollection(x => x, x => true, (x, y) => x.AnonymitySet.CompareTo(y.AnonymitySet));
- // break;
- // case false:
- // Coins = _rootcoinlist.CreateDerivedCollection(x => x, x => true, (x, y) => y.AnonymitySet.CompareTo(x.AnonymitySet));
- // break;
- //}
this.RaiseAndSetIfChanged(ref _privacySortDirection, value);
+ if (value != SortOrder.None)
+ {
+ AmountSortDirection = SortOrder.None;
+ StatusSortDirection = SortOrder.None;
+ }
+ switch (value)
+ {
+ case SortOrder.Increasing:
+ Coins = _rootcoinlist.CreateDerivedCollection(x => x, x => true, (x, y) => x.AnonymitySet.CompareTo(y.AnonymitySet));
+ break;
+ case SortOrder.Decreasing:
+ Coins = _rootcoinlist.CreateDerivedCollection(x => x, x => true, (x, y) => y.AnonymitySet.CompareTo(x.AnonymitySet));
+ break;
+ }
}
}
@@ -192,9 +196,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
});
SelectAllCheckBoxState = GetCheckBoxesSelectedState();
- PrivacySortDirection = true;
- AmountSortDirection = true;
- StatusSortDirection = true;
+ AmountSortDirection = SortOrder.Decreasing;
}
void Coin_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)

[skip ci] ordering coinlist finish