From 494c5b405419e316fad1404bb35efe387d74381f Mon Sep 17 00:00:00 2001 From: Robert Date: Sun, 26 Mar 2023 13:05:19 +0200 Subject: [PATCH] Don't show UI when silently updating --- .../ApplicationStateManager.cs | 4 ++-- src/Artemis.UI/Screens/Root/RootViewModel.cs | 20 ++++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/Artemis.UI.Windows/ApplicationStateManager.cs b/src/Artemis.UI.Windows/ApplicationStateManager.cs index 531eeb870..fd32bf74b 100644 --- a/src/Artemis.UI.Windows/ApplicationStateManager.cs +++ b/src/Artemis.UI.Windows/ApplicationStateManager.cs @@ -95,8 +95,8 @@ public class ApplicationStateManager private void UtilitiesOnUpdateRequested(object? sender, UpdateEventArgs e) { List argsList = new(StartupArguments); - if (e.Silent) - argsList.Add("--autorun"); + if (e.Silent && !argsList.Contains("--minimized")) + argsList.Add("--minimized"); // Retain startup arguments after update by providing them to the script string script = Path.Combine(Constants.UpdatingFolder, "installing", "scripts", "update.ps1"); diff --git a/src/Artemis.UI/Screens/Root/RootViewModel.cs b/src/Artemis.UI/Screens/Root/RootViewModel.cs index 373fd22f1..d8abba43a 100644 --- a/src/Artemis.UI/Screens/Root/RootViewModel.cs +++ b/src/Artemis.UI/Screens/Root/RootViewModel.cs @@ -46,7 +46,7 @@ public class RootViewModel : ActivatableViewModelBase, IScreen, IMainWindowProvi { Router = new RoutingState(); WindowSizeSetting = settingsService.GetSetting("WindowSize"); - + _coreService = coreService; _settingsService = settingsService; _windowService = windowService; @@ -56,17 +56,17 @@ public class RootViewModel : ActivatableViewModelBase, IScreen, IMainWindowProvi _defaultTitleBarViewModel = defaultTitleBarViewModel; _sidebarVmFactory = sidebarVmFactory; _lifeTime = (IClassicDesktopStyleApplicationLifetime) Application.Current!.ApplicationLifetime!; - + mainWindowService.ConfigureMainWindowProvider(this); mainWindowService.HostScreen = this; - + DisplayAccordingToSettings(); Router.CurrentViewModel.Subscribe(UpdateTitleBarViewModel); Task.Run(() => { if (_updateService.Initialize()) return; - + coreService.Initialize(); registrationService.RegisterBuiltInDataModelDisplays(); registrationService.RegisterBuiltInDataModelInputs(); @@ -110,14 +110,10 @@ public class RootViewModel : ActivatableViewModelBase, IScreen, IMainWindowProvi bool showOnAutoRun = _settingsService.GetSetting("UI.ShowOnStartup", true).Value; if ((autoRunning && !showOnAutoRun) || minimized) - { - // TODO: Auto-update - } - else - { - ShowSplashScreen(); - _coreService.Initialized += (_, _) => Dispatcher.UIThread.InvokeAsync(OpenMainWindow); - } + return; + + ShowSplashScreen(); + _coreService.Initialized += (_, _) => Dispatcher.UIThread.InvokeAsync(OpenMainWindow); } private void ShowSplashScreen()