From d2c5b365faf5b1c6eef17998c0708e79243a94af Mon Sep 17 00:00:00 2001 From: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> Date: Thu, 10 Aug 2023 10:02:50 +0200 Subject: [PATCH] [settings] Support launching settings app directly (#27881) * Support launching settings app directly * Update src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs Co-authored-by: Davide Giacometti * Update src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs Co-authored-by: Jaime Bernardo --------- Co-authored-by: Davide Giacometti Co-authored-by: Jaime Bernardo --- src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs index 98103dc833..a96e73d674 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs @@ -7,6 +7,7 @@ using System.Diagnostics; using System.Globalization; using System.Linq; using System.Threading.Tasks; +using Common.UI; using interop; using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Helpers; @@ -208,17 +209,18 @@ namespace Microsoft.PowerToys.Settings.UI } else { +#if DEBUG // For debugging purposes // Window is also needed to show MessageDialog settingsWindow = new MainWindow(isDark); settingsWindow.ExtendsContentIntoTitleBar = true; settingsWindow.Activate(); settingsWindow.NavigateToSection(StartupPage); - -#if !DEBUG - ShowMessageDialogAndExit("The application cannot be run as a standalone process. Please start the application through the runner.", "Forbidden"); + ShowMessageDialog("The application is running in Debug mode.", "DEBUG"); #else - ShowMessageDialog("The application cannot be run as a standalone process. Please start the application through the runner.", "Forbidden"); + /* If we try to run Settings as a standalone app, it will start PowerToys.exe if not running and open Settings again through it in the General page. */ + SettingsDeepLink.OpenSettings(SettingsDeepLink.SettingsWindow.Overview, true); + Exit(); #endif } }