Remove walletservice singleton from MainWindow
MODIFY
WalletWasabi.Gui/MainWindow.xaml.cs
WalletWasabi.Gui/MainWindow.xaml.cs
@@ -83,10 +83,8 @@ namespace WalletWasabi.Gui
bool closeApplication = false;
try
{
- if (Global.WalletService?.ChaumianClient != null)
- {
- Global.WalletService.ChaumianClient.IsQuitPending = true; // indicate -> do not add any more alices to the coinjoin
- }
+ // Indicate -> do not add any more alices to the coinjoin.
+ Global.WalletManager.SignalQuitPending(true);
if (!MainWindowViewModel.Instance.CanClose)
{
@@ -143,10 +141,8 @@ namespace WalletWasabi.Gui
if (!closeApplication) //we are not closing the application for some reason
{
Interlocked.Exchange(ref _closingState, 0);
- if (Global.WalletService?.ChaumianClient != null)
- {
- Global.WalletService.ChaumianClient.IsQuitPending = false; //re-enable enqueuing coins
- }
+ // Re-enable enqueuing coins.
+ Global.WalletManager.SignalQuitPending(false);
}
}
}

MODIFY
WalletWasabi/Wallets/WalletManager.cs
WalletWasabi/Wallets/WalletManager.cs
@@ -52,6 +52,18 @@ namespace WalletWasabi.Wallets
private NodesGroup Nodes { get; set; }
private string DataDir { get; set; }
private ServiceConfiguration ServiceConfiguration { get; set; }
+
+ public void SignalQuitPending(bool isQuitPending)
+ {
+ lock (Lock)
+ {
+ foreach (var client in Wallets.Keys.Select(x => x.ChaumianClient))
+ {
+ client.IsQuitPending = isQuitPending;
+ }
+ }
+ }
+
private IFeeProvider FeeProvider { get; set; }
private CoreNode BitcoinCoreNode { get; set; }

Remove walletservice singleton from MainWindow