[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 <davide.giacometti@outlook.it>

* Update src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs

Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>

---------

Co-authored-by: Davide Giacometti <davide.giacometti@outlook.it>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
This commit is contained in:
Stefan Markovic
2023-08-10 10:02:50 +02:00
committed by GitHub
parent 3fe2a2459d
commit d2c5b365fa

View File

@@ -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
}
}