Skip to content

Commit

Permalink
[skip ci] Make dequeue enqueue apis consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
nopara73 committed Dec 16, 2018
1 parent ef99438 commit a92415a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,11 @@ public CoinJoinTabViewModel(WalletViewModel walletViewModel)

EnqueueCommand = ReactiveCommand.Create(async () =>
{
await DoEnqueueAsync();
await DoEnqueueAsync(CoinsList.Coins.Where(c => c.IsSelected));
});

DequeueCommand = ReactiveCommand.Create(async () =>
{
if (!CoinsList.Coins.Any(c => c.IsSelected))
{
SetWarningMessage("No coins are selected to dequeue.");
return;
}
await DoDequeueAsync(CoinsList.Coins.Where(c => c.IsSelected));
});

Expand All @@ -117,7 +112,7 @@ public CoinJoinTabViewModel(WalletViewModel walletViewModel)
if (lastChar == '\r' || lastChar == '\n') // If the last character is cr or lf then act like it'd be a sign to do the job.
{
Password = x.TrimEnd('\r', '\n');
await DoEnqueueAsync();
await DoEnqueueAsync(CoinsList.Coins.Where(c => c.IsSelected));
}
}
});
Expand Down Expand Up @@ -154,6 +149,12 @@ private async Task DoDequeueAsync(IEnumerable<CoinViewModel> selectedCoins)
{
WarningMessage = "";

if (!selectedCoins.Any())
{
SetWarningMessage("No coins are selected to dequeue.");
return;
}

try
{
await Global.ChaumianClient.DequeueCoinsFromMixAsync(selectedCoins.Select(c => c.Model).ToArray());
Expand All @@ -179,14 +180,13 @@ private async Task DoDequeueAsync(IEnumerable<CoinViewModel> selectedCoins)
}
}

private async Task DoEnqueueAsync()
private async Task DoEnqueueAsync(IEnumerable<CoinViewModel> selectedCoins)
{
IsEnqueueBusy = true;
try
{
WarningMessage = "";
Password = Guard.Correct(Password);
var selectedCoins = CoinsList.Coins.Where(c => c.IsSelected).ToList();

if (!selectedCoins.Any())
{
Expand Down

0 comments on commit a92415a

Please sign in to comment.