Skip to content
Permalink
Browse files

[skip ci] Hide CoinJoin status when appropriate

  • Loading branch information...
nopara73 committed Nov 24, 2018
1 parent 566e286 commit bb8e90b1f5e522f1c59f7f0261023e0a1b1ff4af
@@ -158,12 +158,7 @@ private async Task DoDequeueAsync()
{
WarningMessage = "";

var selectedCoins = CoinsList.Coins.Where(c => c.IsSelected).ToList();

foreach (var coin in selectedCoins)
{
coin.IsSelected = false;
}
var selectedCoins = CoinsList.Coins.Where(c => c.IsSelected);

try
{
@@ -24,10 +24,18 @@
<behaviors:ClearPropertyOnLostFocusBehavior TargetProperty="{Binding SelectedCoin}" />
</i:Interaction.Behaviors>
<DockPanel LastChildFill="True">
<Grid ColumnDefinitions="30,30,180,120,100,Auto" Margin="30 0" DockPanel.Dock="Top">
<Grid Margin="30 0" DockPanel.Dock="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width="{Binding CoinJoinStatusWidth, Mode=OneWay}" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="" Width="0" />
<TextBlock Text="" Grid.Column="1" />
<TextBlock Text="CoinJoin Status" Grid.Column="2" Margin="10 0 0 0" />
<TextBlock Text="" Grid.Column="2" Margin="10 0 0 0" />
<TextBlock Text="Amount (BTC)" Grid.Column="3" Margin="10 0 0 0" />
<TextBlock Text="Privacy" Grid.Column="4" Margin="20 0 0 0" />
<TextBlock Text="History" Grid.Column="5" />
@@ -90,7 +98,16 @@
</StackPanel>
</Expander>

<Grid ColumnDefinitions="30,30,180,113,100,Auto" Margin="30 0 0 0" VerticalAlignment="Top">
<Grid Margin="30 0 0 0" VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width="{Binding CoinJoinStatusWidth, Mode=OneWay}" />
<ColumnDefinition Width="113" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<CheckBox HorizontalContentAlignment="Left" IsChecked="{Binding IsSelected}" Background="{DynamicResource ThemeBackgroundBrush}" />
<Border Background="Transparent" IsVisible="{Binding Confirmed}" Grid.Column="1" ToolTip.Tip="Confirmed">
<Path HorizontalAlignment="Left" Data="F1 M 23.7501,33.25L 34.8334,44.3333L 52.2499,22.1668L 56.9999,26.9168L 34.8334,53.8333L 19.0001,38L 23.7501,33.25 Z" Fill="#22B14C" Height="16" Width="16" Stretch="Fill" />
@@ -1,8 +1,10 @@
using NBitcoin;
using Avalonia.Controls;
using NBitcoin;
using ReactiveUI;
using ReactiveUI.Legacy;
using System;
using System.Linq;
using WalletWasabi.Gui.Models;
using WalletWasabi.Gui.ViewModels;

namespace WalletWasabi.Gui.Controls.WalletExplorer
@@ -15,6 +17,7 @@ public class CoinListViewModel : ViewModelBase
private bool? _selectAllCheckBoxState;
private bool? _selectPrivateCheckBoxState;
private bool? _selectNonPrivateCheckBoxState;
private GridLength _coinJoinStatusWidth;

public ReactiveCommand EnqueueCoin { get; }
public ReactiveCommand DequeueCoin { get; }
@@ -32,49 +35,30 @@ public CoinViewModel SelectedCoin
}
}

public bool CanDeqeue
{
get
{
if (SelectedCoin == null) return false;
return SelectedCoin.CoinJoinInProgress;
}
}
public bool CanDeqeue => SelectedCoin is null ? false : SelectedCoin.CoinJoinInProgress;

public bool? SelectAllCheckBoxState
{
get
{
return _selectAllCheckBoxState;
}
set
{
this.RaiseAndSetIfChanged(ref _selectAllCheckBoxState, value);
}
get => _selectAllCheckBoxState;
set => this.RaiseAndSetIfChanged(ref _selectAllCheckBoxState, value);
}

public bool? SelectPrivateCheckBoxState
{
get
{
return _selectPrivateCheckBoxState;
}
set
{
this.RaiseAndSetIfChanged(ref _selectPrivateCheckBoxState, value);
}
get => _selectPrivateCheckBoxState;
set => this.RaiseAndSetIfChanged(ref _selectPrivateCheckBoxState, value);
}

public bool? SelectNonPrivateCheckBoxState
{
get
{
return _selectNonPrivateCheckBoxState;
}
set
{
this.RaiseAndSetIfChanged(ref _selectNonPrivateCheckBoxState, value);
}
get => _selectNonPrivateCheckBoxState;
set => this.RaiseAndSetIfChanged(ref _selectNonPrivateCheckBoxState, value);
}

public GridLength CoinJoinStatusWidth
{
get => _coinJoinStatusWidth;
set => this.RaiseAndSetIfChanged(ref _coinJoinStatusWidth, value);
}

private bool? GetCheckBoxesSelectedState(Func<CoinViewModel, bool> coinFilterPredicate)
@@ -198,6 +182,7 @@ public CoinListViewModel(IReactiveDerivedList<CoinViewModel> coins, Money preSel
}
});
SetSelections();
SetCoinJoinStatusWidth();
}

private void SetSelections()
@@ -207,6 +192,24 @@ private void SetSelections()
SelectNonPrivateCheckBoxState = GetCheckBoxesSelectedState(x => x.AnonymitySet < 50);
}

private void SetCoinJoinStatusWidth()
{
if (Coins.Any(x => x.Status == SmartCoinStatus.MixingConnectionConfirmation
|| x.Status == SmartCoinStatus.MixingInputRegistration
|| x.Status == SmartCoinStatus.MixingOnWaitingList
|| x.Status == SmartCoinStatus.MixingOutputRegistration
|| x.Status == SmartCoinStatus.MixingSigning
|| x.Status == SmartCoinStatus.MixingWaitingForConfirmation
|| x.Status == SmartCoinStatus.SpentAccordingToBackend))
{
CoinJoinStatusWidth = new GridLength(180);
}
else
{
CoinJoinStatusWidth = new GridLength(0);
}
}

private void Coins_CollectionChanging(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
foreach (CoinViewModel coin in Coins)
@@ -230,6 +233,10 @@ private void Coin_PropertyChanged(object sender, System.ComponentModel.PropertyC
{
SetSelections();
}
if (e.PropertyName == nameof(CoinViewModel.Status))
{
SetCoinJoinStatusWidth();
}
}

public IReactiveDerivedList<CoinViewModel> Coins

0 comments on commit bb8e90b

Please sign in to comment.
You can’t perform that action at this time.