Add WalletStateChanged event to WalletManager
MODIFY
WalletWasabi/Wallets/WalletManager.cs
WalletWasabi/Wallets/WalletManager.cs
@@ -40,10 +40,21 @@ namespace WalletWasabi.Wallets
}
}
+ /// <summary>
+ /// Triggered if any of the Wallets processes a transaction. The sender argumentum of the event will be the Wallet.
+ /// </summary>
public event EventHandler<ProcessedResult> WalletRelevantTransactionProcessed;
+ /// <summary>
+ /// Triggered if any of the Wallets dequeues one or more coins. The sender argumentum of the event will be the Wallet.
+ /// </summary>
public event EventHandler<DequeueResult> OnDequeue;
+ /// <summary>
+ /// Triggered if any of the Wallets changes its state. The sender argumentum of the event will be the Wallet.
+ /// </summary>
+ public event EventHandler<WalletState> WalletStateChanged;
+
private CancellationTokenSource CancelAllInitialization { get; }
private Dictionary<Wallet, HashSet<uint256>> Wallets { get; }
@@ -250,6 +261,7 @@ namespace WalletWasabi.Wallets
wallet.WalletRelevantTransactionProcessed += TransactionProcessor_WalletRelevantTransactionProcessed;
wallet.OnDequeue += ChaumianClient_OnDequeue;
+ wallet.StateChanged += Wallet_StateChanged;
}
public async Task DequeueAllCoinsGracefullyAsync(DequeueReason reason, CancellationToken token)
@@ -272,6 +284,11 @@ namespace WalletWasabi.Wallets
WalletRelevantTransactionProcessed?.Invoke(sender, e);
}
+ private void Wallet_StateChanged(object sender, WalletState e)
+ {
+ WalletStateChanged?.Invoke(sender, e);
+ }
+
public async Task RemoveAndStopAllAsync(CancellationToken cancel)
{
try
@@ -300,6 +317,7 @@ namespace WalletWasabi.Wallets
wallet.WalletRelevantTransactionProcessed -= TransactionProcessor_WalletRelevantTransactionProcessed;
wallet.OnDequeue -= ChaumianClient_OnDequeue;
+ wallet.StateChanged -= Wallet_StateChanged;
lock (Lock)
{

Add WalletStateChanged event to WalletManager