handle case where background running disabled.. but the user hides.
MODIFY
WalletWasabi.Fluent/ViewModels/ApplicationViewModel.cs
WalletWasabi.Fluent/ViewModels/ApplicationViewModel.cs
@@ -28,7 +28,10 @@ public partial class ApplicationViewModel : ViewModelBase, ICanShutdownProvider
.Where(x => x == false)
.Subscribe(async x =>
{
- if (!Services.UiConfig.HideOnClose)
+ if (!Services.UiConfig.HideOnClose && Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime
+ {
+ MainWindow: null
+ })
{
DoQuit();
}
@@ -39,22 +42,30 @@ public partial class ApplicationViewModel : ViewModelBase, ICanShutdownProvider
ShowCommand = ReactiveCommand.Create(() =>
{
if (IsMainWindowShown)
+ {
+ if (Services.UiConfig.HideOnClose)
{
_mainWindowService.Close();
+ }
+ else
+ {
+ MainViewModel.Instance.WindowState = WindowState.Minimized;
+ }
+
IsMainWindowShown = false;
}
else
{
_mainWindowService.Show();
IsMainWindowShown = true;
+
+ MainViewModel.Instance.WindowState = WindowState.Normal;
}
});
- var dialogScreen = MainViewModel.Instance.DialogScreen;
-
AboutCommand = ReactiveCommand.Create(
- () => dialogScreen.To(new AboutViewModel(navigateBack: dialogScreen.CurrentPage is not null)),
- canExecute: dialogScreen.WhenAnyValue(x => x.CurrentPage)
+ () => MainViewModel.Instance.DialogScreen.To(new AboutViewModel(navigateBack: MainViewModel.Instance.DialogScreen.CurrentPage is not null)),
+ canExecute: MainViewModel.Instance.DialogScreen.WhenAnyValue(x => x.CurrentPage)
.SelectMany(x =>
{
return x switch
@@ -117,6 +128,7 @@ public partial class ApplicationViewModel : ViewModelBase, ICanShutdownProvider
public bool CanShutdown()
{
+ return true;
var cjManager = Services.HostedServices.GetOrDefault<CoinJoinManager>();
if (cjManager is { })

MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -100,6 +100,19 @@ public partial class MainViewModel : ViewModelBase
Services.UiConfig.WindowWidth = width;
Services.UiConfig.WindowHeight = height;
+
+ switch (state)
+ {
+ case WindowState.Normal:
+ case WindowState.Maximized:
+ case WindowState.FullScreen:
+ if (Application.Current?.DataContext is ApplicationViewModel avm)
+ {
+ avm.IsMainWindowShown = true;
+ }
+
+ break;
+ }
});
this.WhenAnyValue(

MODIFY
WalletWasabi.Fluent/Views/MainWindow.axaml.cs
WalletWasabi.Fluent/Views/MainWindow.axaml.cs
@@ -26,9 +26,7 @@ public class MainWindow : Window
{
base.OnClosing(e);
- if (Application.Current?.DataContext is ApplicationViewModel avm)
- {
- if (!Services.UiConfig.HideOnClose)
+ if (!Services.UiConfig.HideOnClose && Application.Current?.DataContext is ApplicationViewModel avm)
{
e.Cancel = !avm.CanShutdown();
@@ -39,4 +37,3 @@ public class MainWindow : Window
}
}
}
-}

handle case where background running disabled.. but the user hides.