[skip ci] Added select all functionality to coinlist
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml
<TextBlock Text="Privacy" Grid.Column="4" Margin="20 0 0 0" />
<TextBlock Text="History" Grid.Column="5" />
</Grid>
+ <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" >
+ <CheckBox Content = "Select All" IsThreeState="true" IsChecked = "{Binding SelectAllCheckBoxState}" Command="{Binding SelectAllCheckBoxCommand}" ToolTip.Tip="Select All"/>
+ </StackPanel>
<ListBox Items="{Binding Coins}" VirtualizationMode="None" SelectedItem="{Binding Path=SelectedCoin, Mode=TwoWay}">
<ListBox.ContextMenu>
<ContextMenu>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
+
</DockPanel>
+
</UserControl>

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinListViewModel.cs
@@ -10,9 +10,11 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
#pragma warning disable CS0618 // Type or member is obsolete
private IReactiveDerivedList<CoinViewModel> _coins;
private CoinViewModel _selectedCoin;
+ private bool? _selectAllCheckBoxState;
public ReactiveCommand EnqueueCoin { get; }
public ReactiveCommand DequeueCoin { get; }
+ public ReactiveCommand SelectAllCheckBoxCommand { get; }
public CoinViewModel SelectedCoin
{
get => _selectedCoin;
@@ -32,6 +34,44 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
}
+ public bool? SelectAllCheckBoxState
+ {
+ get
+ {
+ return _selectAllCheckBoxState;
+ }
+ set
+ {
+ var changed = _selectAllCheckBoxState != value;
+ this.RaiseAndSetIfChanged(ref _selectAllCheckBoxState,value);
+ }
+ }
+
+ private bool? GetCheckBoxesSelectedState()
+ {
+ bool IsAllSelected = true;
+ foreach (CoinViewModel coin in Coins)
+ if (!coin.IsSelected)
+ {
+ IsAllSelected = false;
+ break;
+ }
+ bool IsAllDeselected = true;
+ foreach (CoinViewModel coin in Coins)
+ if (coin.IsSelected)
+ {
+ IsAllDeselected = false;
+ break;
+ }
+ if (IsAllSelected) return true;
+ if (IsAllDeselected) return false;
+ return null;
+ }
+ private void SelectAllCoins(bool valueOfSelected)
+ {
+ foreach (var c in Coins) c.IsSelected = valueOfSelected;
+ }
+
public CoinListViewModel(IReactiveDerivedList<CoinViewModel> coins, Money preSelectMinAmountIncludingCondition = null, int? preSelectMaxAnonSetExcludingCondition = null)
{
Coins = coins;
@@ -46,16 +86,47 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
}
}
+
+ foreach (CoinViewModel coin in Coins)
+ coin.PropertyChanged += Coin_PropertyChanged;
+
EnqueueCoin = ReactiveCommand.Create(() =>
{
if (SelectedCoin == null) return;
//await Global.ChaumianClient.QueueCoinsToMixAsync()
});
+
DequeueCoin = ReactiveCommand.Create(async () =>
{
if (SelectedCoin == null) return;
await Global.ChaumianClient.DequeueCoinsFromMixAsync(SelectedCoin.Model);
}, this.WhenAnyValue(x => x.CanDeqeue));
+
+ SelectAllCheckBoxCommand = ReactiveCommand.Create(() =>
+ {
+ switch (SelectAllCheckBoxState)
+ {
+ case true:
+ SelectAllCoins(true);
+ break;
+ case false:
+ SelectAllCoins(false);
+ break;
+ case null:
+ SelectAllCoins(false);
+ SelectAllCheckBoxState = false;
+ break;
+ }
+ });
+ SelectAllCheckBoxState = GetCheckBoxesSelectedState();
+ }
+
+ void Coin_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName == nameof(CoinViewModel.IsSelected))
+ {
+ SelectAllCheckBoxState = GetCheckBoxesSelectedState();
+ }
}
public IReactiveDerivedList<CoinViewModel> Coins

[skip ci] Added select all functionality to coinlist