Refactor TransactionBroadcasting commands execute to methods
MODIFY
WalletWasabi.Fluent/ViewModels/TransactionBroadcasting/BroadcastTransactionViewModel.cs
WalletWasabi.Fluent/ViewModels/TransactionBroadcasting/BroadcastTransactionViewModel.cs
using System;
using System.Linq;
using System.Reactive.Linq;
+using System.Threading.Tasks;
using NBitcoin;
using ReactiveUI;
using WalletWasabi.Blockchain.TransactionBroadcasting;
@@ -79,7 +80,13 @@ namespace WalletWasabi.Fluent.ViewModels.TransactionBroadcasting
.Select(x => !x);
NextCommand = ReactiveCommand.CreateFromTask(
- async () =>
+ async () => await NextExecute(broadcaster, transaction),
+ nextCommandCanExecute);
+
+ EnableAutoBusyOn(NextCommand);
+ }
+
+ private async Task NextExecute(TransactionBroadcaster broadcaster, SmartTransaction transaction)
{
try
{
@@ -91,10 +98,6 @@ namespace WalletWasabi.Fluent.ViewModels.TransactionBroadcasting
Logger.LogError(ex);
await ShowErrorAsync(Title, ex.ToUserFriendlyString(), "It was not possible to broadcast the transaction.");
}
- },
- nextCommandCanExecute);
-
- EnableAutoBusyOn(NextCommand);
}
}
}

MODIFY
WalletWasabi.Fluent/ViewModels/TransactionBroadcasting/LoadTransactionViewModel.cs
WalletWasabi.Fluent/ViewModels/TransactionBroadcasting/LoadTransactionViewModel.cs
@@ -46,7 +46,10 @@ namespace WalletWasabi.Fluent.ViewModels.TransactionBroadcasting
},
outputScheduler: RxApp.MainThreadScheduler);
- PasteCommand = ReactiveCommand.CreateFromTask(async () =>
+ PasteCommand = ReactiveCommand.CreateFromTask(async () => await PasteExecute());
+ }
+
+ private async Task PasteExecute()
{
try
{
@@ -76,7 +79,6 @@ namespace WalletWasabi.Fluent.ViewModels.TransactionBroadcasting
Logger.LogError(ex);
await ShowErrorAsync(Title, ex.ToUserFriendlyString(), "It was not possible to paste the transaction.");
}
- });
}
private Network Network { get; }

Refactor TransactionBroadcasting commands execute to methods