add a warning dialog so user knows why shutdown was no allowed in rare case that happens.
MODIFY
WalletWasabi.Fluent/App.axaml
WalletWasabi.Fluent/App.axaml
<TrayIcon Icon="/Assets/WasabiLogo.ico">
<NativeMenu.Menu>
<NativeMenu>
- <NativeMenuItem Header="Show Wasabi Wallet" />
<NativeMenuItem Header="Quit Wasabi Wallet" Command="{Binding QuitCommand}" />
</NativeMenu>
</NativeMenu.Menu>

MODIFY
WalletWasabi.Fluent/ViewModels/ApplicationViewModel.cs
WalletWasabi.Fluent/ViewModels/ApplicationViewModel.cs
@@ -4,6 +4,7 @@ using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using ReactiveUI;
using WalletWasabi.Fluent.Providers;
+using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.WabiSabi.Client;
namespace WalletWasabi.Fluent.ViewModels
@@ -12,7 +13,7 @@ namespace WalletWasabi.Fluent.ViewModels
{
public ApplicationViewModel()
{
- QuitCommand = ReactiveCommand.Create(() =>
+ QuitCommand = ReactiveCommand.CreateFromTask(async () =>
{
if (CanShutdown())
{
@@ -21,6 +22,13 @@ namespace WalletWasabi.Fluent.ViewModels
{
desktopLifetime.Shutdown();
}
+ else
+ {
+ await MainViewModel.Instance!.CompactDialogScreen.NavigateDialogAsync(new Dialogs.ShowErrorDialogViewModel(
+ "Wasabi is currently anonimising your wallet. Please try again in a few seconds.",
+ "Warning",
+ "Unable to close"));
+ }
}
});
}
@@ -29,12 +37,19 @@ namespace WalletWasabi.Fluent.ViewModels
public bool CanShutdown()
{
- return Services.HostedServices.Get<CoinJoinManager>().HighestCoinJoinClientState switch
+ var cjManager = Services.HostedServices.GetOrDefault<CoinJoinManager>();
+
+ if (cjManager is { })
+ {
+ return cjManager.HighestCoinJoinClientState switch
{
CoinJoinClientState.InCriticalPhase => false,
CoinJoinClientState.Idle or CoinJoinClientState.InProgress => true,
_ => throw new ArgumentOutOfRangeException(),
};
}
+
+ return true;
+ }
}
}

add a warning dialog so user knows why shutdown was no allowed in rare case that happens.