diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt
index 46d9c64ce6..39553e3913 100644
--- a/.github/actions/spell-check/expect.txt
+++ b/.github/actions/spell-check/expect.txt
@@ -839,6 +839,7 @@ IIO
IItem
IJson
IKs
+Ijwhost
IList
ILogon
IMAGEHLP
@@ -1061,6 +1062,7 @@ lhs
lhwnd
lia
LIBID
+Lifecycle
LIGHTORANGE
LIGHTTURQUOISE
lindex
@@ -1655,6 +1657,7 @@ regkey
REGPINTYPES
regsvr
reimplementing
+REINSTALLMODE
reloadable
Remapper
remappings
@@ -2243,6 +2246,8 @@ WINDOWPLACEMENT
WINDOWPOSCHANGED
WINDOWPOSCHANGING
Windowsapp
+windowsappsdk
+windowsappruntimeinstall
WINDOWSBUILDNUMBER
Windowscodecs
windowsdesktop
diff --git a/.pipelines/ESRPSigning_core.json b/.pipelines/ESRPSigning_core.json
index 37eda37735..576f38511b 100644
--- a/.pipelines/ESRPSigning_core.json
+++ b/.pipelines/ESRPSigning_core.json
@@ -114,7 +114,6 @@
"modules\\VideoConference\\PowerToys.VideoConferenceProxyFilter_x86.dll",
"modules\\VideoConference\\PowerToys.VideoConferenceProxyFilter_x64.dll",
- "Settings\\PowerToys.Settings.UI.exe",
"Settings\\PowerToys.Settings.dll",
"Settings\\PowerToys.Settings.exe"
],
@@ -192,6 +191,7 @@
"modules\\launcher\\SQLitePCLRaw.batteries_v2.dll",
"modules\\launcher\\SQLitePCLRaw.core.dll",
"modules\\launcher\\SQLitePCLRaw.provider.e_sqlite3.dll",
+ "Settings\\Microsoft.Graphics.Canvas.Interop.dll",
"ColorCode.Core.dll",
"ColorCode.UWP.dll",
"UnitsNet.dll"
diff --git a/.pipelines/release.yml b/.pipelines/release.yml
index 917e28bc84..2112bfd27a 100644
--- a/.pipelines/release.yml
+++ b/.pipelines/release.yml
@@ -169,7 +169,7 @@ jobs:
- task: VSBuild@1
displayName: Publish Settings for Packaging
inputs:
- solution: 'src/settings-ui/PowerToys.Settings/PowerToys.Settings.csproj'
+ solution: 'src/settings-ui/Settings.UI/PowerToys.Settings.csproj'
vsVersion: 17.0
msbuildArgs: >-
/target:Publish
diff --git a/.pipelines/versionAndSignCheck.ps1 b/.pipelines/versionAndSignCheck.ps1
index 1dd784e3e8..4c26b00526 100644
--- a/.pipelines/versionAndSignCheck.ps1
+++ b/.pipelines/versionAndSignCheck.ps1
@@ -28,8 +28,20 @@ if($items.Count -eq 0)
$items | ForEach-Object {
if($_.VersionInfo.FileVersion -eq "1.0.0.0" )
{
- Write-Host "Version not set: " + $_.FullName
- $totalFailure++;
+ # These items are exceptions that actually have the 1.0.0.0 version.
+ if ((-not $_.Name.EndsWith("Microsoft.Windows.ApplicationModel.DynamicDependency.Projection.dll")) -and
+ (-not $_.Name.EndsWith("Microsoft.Windows.ApplicationModel.Resources.Projection.dll")) -and
+ (-not $_.Name.EndsWith("Microsoft.Windows.ApplicationModel.WindowsAppRuntime.Projection.dll")) -and
+ (-not $_.Name.EndsWith("Microsoft.Windows.AppLifecycle.Projection.dll")) -and
+ (-not $_.Name.EndsWith("Microsoft.Windows.System.Power.Projection.dll")) -and
+ (-not $_.Name.EndsWith("Microsoft.WindowsAppRuntime.Bootstrap.Net.dll")) -and
+ (-not $_.Name.EndsWith("Microsoft.Xaml.Interactions.dll")) -and
+ (-not $_.Name.EndsWith("Microsoft.Xaml.Interactivity.dll"))
+ )
+ {
+ Write-Host "Version not set: " + $_.FullName
+ $totalFailure++;
+ }
}
}
diff --git a/PowerToys.sln b/PowerToys.sln
index df9e2661e0..fe4fd615a6 100644
--- a/PowerToys.sln
+++ b/PowerToys.sln
@@ -18,7 +18,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "runner", "src\runner\runner
{69E1EE8D-143A-4060-9129-4658ACF14AAF} = {69E1EE8D-143A-4060-9129-4658ACF14AAF}
{DA425894-6E13-404F-8DCB-78584EC0557A} = {DA425894-6E13-404F-8DCB-78584EC0557A}
{2BE46397-4DFA-414C-9BD4-41E4BBF8CB34} = {2BE46397-4DFA-414C-9BD4-41E4BBF8CB34}
- {A7D5099E-F0FD-4BF3-8522-5A682759F915} = {A7D5099E-F0FD-4BF3-8522-5A682759F915}
{0B43679E-EDFA-4DA0-AD30-F4628B308B1B} = {0B43679E-EDFA-4DA0-AD30-F4628B308B1B}
{B25AC7A5-FB9F-4789-B392-D5C85E948670} = {B25AC7A5-FB9F-4789-B392-D5C85E948670}
{5E7360A8-D048-4ED3-8F09-0BFD64C5529A} = {5E7360A8-D048-4ED3-8F09-0BFD64C5529A}
@@ -171,8 +170,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "powerpreview", "src\modules
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "settings-ui", "settings-ui", "{C3081D9A-1586-441A-B5F4-ED815B3719C1}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Settings.UI", "src\settings-ui\Settings.UI\Settings.UI.csproj", "{A7D5099E-F0FD-4BF3-8522-5A682759F915}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4981CCD1-4CD9-4A49-B240-00AA46493FF8}"
ProjectSection(SolutionItems) = preProject
src\.editorconfig = src\.editorconfig
@@ -278,14 +275,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "utils", "utils", "{B39DC643
src\common\utils\modulesRegistry.h = src\common\utils\modulesRegistry.h
src\common\utils\MsiUtils.h = src\common\utils\MsiUtils.h
src\common\utils\os-detect.h = src\common\utils\os-detect.h
- src\common\utils\ProcessWaiter.h = src\common\utils\ProcessWaiter.h
src\common\utils\process_path.h = src\common\utils\process_path.h
+ src\common\utils\ProcessWaiter.h = src\common\utils\ProcessWaiter.h
src\common\utils\registry.h = src\common\utils\registry.h
src\common\utils\resources.h = src\common\utils\resources.h
src\common\utils\string_utils.h = src\common\utils\string_utils.h
src\common\utils\timeutil.h = src\common\utils\timeutil.h
- src\common\utils\winapi_error.h = src\common\utils\winapi_error.h
src\common\utils\UnhandledExceptionHandler.h = src\common\utils\UnhandledExceptionHandler.h
+ src\common\utils\winapi_error.h = src\common\utils\winapi_error.h
src\common\utils\window.h = src\common\utils\window.h
EndProjectSection
EndProject
@@ -306,8 +303,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Run.Plu
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Run.Plugin.Registry.UnitTests", "src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Registry.UnitTest\Microsoft.PowerToys.Run.Plugin.Registry.UnitTests.csproj", "{0648DF05-5DDA-4BE1-B5F2-584926EBDB65}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerToys.Settings", "src\settings-ui\PowerToys.Settings\PowerToys.Settings.csproj", "{6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KeyboardManagerEngine", "src\modules\keyboardmanager\KeyboardManagerEngine\KeyboardManagerEngine.vcxproj", "{BA661F5B-1D5A-4FFC-9BF1-FC39DF280BDD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KeyboardManagerEngineLibrary", "src\modules\keyboardmanager\KeyboardManagerEngineLibrary\KeyboardManagerEngineLibrary.vcxproj", "{E496B7FC-1E99-4BAB-849B-0E8367040B02}"
@@ -408,6 +403,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Run.Plu
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.WindowWalker.UnitTests", "src\modules\launcher\Plugins\Microsoft.Plugin.WindowWalker.UnitTests\Microsoft.Plugin.WindowWalker.UnitTests.csproj", "{8FE5A5EE-1B59-401C-9FB3-B04ECD3E29C1}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerToys.Settings", "src\settings-ui\Settings.UI\PowerToys.Settings.csproj", "{020A7474-3601-4160-A159-D7B70B77B15F}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
@@ -768,18 +765,6 @@ Global
{217DF501-135C-4E38-BFC8-99D4821032EA}.Release|x64.ActiveCfg = Release|x64
{217DF501-135C-4E38-BFC8-99D4821032EA}.Release|x64.Build.0 = Release|x64
{217DF501-135C-4E38-BFC8-99D4821032EA}.Release|x86.ActiveCfg = Release|x64
- {A7D5099E-F0FD-4BF3-8522-5A682759F915}.Debug|ARM64.ActiveCfg = Debug|x64
- {A7D5099E-F0FD-4BF3-8522-5A682759F915}.Debug|ARM64.Build.0 = Debug|x64
- {A7D5099E-F0FD-4BF3-8522-5A682759F915}.Debug|x64.ActiveCfg = Debug|x64
- {A7D5099E-F0FD-4BF3-8522-5A682759F915}.Debug|x64.Build.0 = Debug|x64
- {A7D5099E-F0FD-4BF3-8522-5A682759F915}.Debug|x86.ActiveCfg = Debug|x64
- {A7D5099E-F0FD-4BF3-8522-5A682759F915}.Release|ARM64.ActiveCfg = Release|x64
- {A7D5099E-F0FD-4BF3-8522-5A682759F915}.Release|ARM64.Build.0 = Release|x64
- {A7D5099E-F0FD-4BF3-8522-5A682759F915}.Release|x64.ActiveCfg = Release|x64
- {A7D5099E-F0FD-4BF3-8522-5A682759F915}.Release|x64.Build.0 = Release|x64
- {A7D5099E-F0FD-4BF3-8522-5A682759F915}.Release|x86.ActiveCfg = Release|Win32
- {A7D5099E-F0FD-4BF3-8522-5A682759F915}.Release|x86.Build.0 = Release|Win32
- {A7D5099E-F0FD-4BF3-8522-5A682759F915}.Release|x86.Deploy.0 = Release|Win32
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|ARM64.ActiveCfg = Debug|x64
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|ARM64.Build.0 = Debug|x64
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A}.Debug|x64.ActiveCfg = Debug|x64
@@ -1140,16 +1125,6 @@ Global
{0648DF05-5DDA-4BE1-B5F2-584926EBDB65}.Release|x64.ActiveCfg = Release|x64
{0648DF05-5DDA-4BE1-B5F2-584926EBDB65}.Release|x64.Build.0 = Release|x64
{0648DF05-5DDA-4BE1-B5F2-584926EBDB65}.Release|x86.ActiveCfg = Release|x64
- {6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A}.Debug|ARM64.ActiveCfg = Debug|x64
- {6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A}.Debug|ARM64.Build.0 = Debug|x64
- {6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A}.Debug|x64.ActiveCfg = Debug|x64
- {6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A}.Debug|x64.Build.0 = Debug|x64
- {6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A}.Debug|x86.ActiveCfg = Debug|x64
- {6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A}.Release|ARM64.ActiveCfg = Release|x64
- {6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A}.Release|ARM64.Build.0 = Release|x64
- {6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A}.Release|x64.ActiveCfg = Release|x64
- {6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A}.Release|x64.Build.0 = Release|x64
- {6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A}.Release|x86.ActiveCfg = Release|x64
{BA661F5B-1D5A-4FFC-9BF1-FC39DF280BDD}.Debug|ARM64.ActiveCfg = Debug|x64
{BA661F5B-1D5A-4FFC-9BF1-FC39DF280BDD}.Debug|ARM64.Build.0 = Debug|x64
{BA661F5B-1D5A-4FFC-9BF1-FC39DF280BDD}.Debug|x64.ActiveCfg = Debug|x64
@@ -1583,6 +1558,18 @@ Global
{8FE5A5EE-1B59-401C-9FB3-B04ECD3E29C1}.Release|x64.Build.0 = Release|x64
{8FE5A5EE-1B59-401C-9FB3-B04ECD3E29C1}.Release|x86.ActiveCfg = Release|x64
{8FE5A5EE-1B59-401C-9FB3-B04ECD3E29C1}.Release|x86.Build.0 = Release|x64
+ {020A7474-3601-4160-A159-D7B70B77B15F}.Debug|ARM64.ActiveCfg = Debug|x64
+ {020A7474-3601-4160-A159-D7B70B77B15F}.Debug|ARM64.Build.0 = Debug|x64
+ {020A7474-3601-4160-A159-D7B70B77B15F}.Debug|x64.ActiveCfg = Debug|x64
+ {020A7474-3601-4160-A159-D7B70B77B15F}.Debug|x64.Build.0 = Debug|x64
+ {020A7474-3601-4160-A159-D7B70B77B15F}.Debug|x86.ActiveCfg = Debug|x64
+ {020A7474-3601-4160-A159-D7B70B77B15F}.Debug|x86.Build.0 = Debug|x64
+ {020A7474-3601-4160-A159-D7B70B77B15F}.Release|ARM64.ActiveCfg = Release|x64
+ {020A7474-3601-4160-A159-D7B70B77B15F}.Release|ARM64.Build.0 = Release|x64
+ {020A7474-3601-4160-A159-D7B70B77B15F}.Release|x64.ActiveCfg = Release|x64
+ {020A7474-3601-4160-A159-D7B70B77B15F}.Release|x64.Build.0 = Release|x64
+ {020A7474-3601-4160-A159-D7B70B77B15F}.Release|x86.ActiveCfg = Release|x64
+ {020A7474-3601-4160-A159-D7B70B77B15F}.Release|x86.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1628,7 +1615,6 @@ Global
{060D75DA-2D1C-48E6-A4A1-6F0718B64661} = {2F305555-C296-497E-AC20-5FA1B237996A}
{748417CA-F17E-487F-9411-CAFB6D3F4877} = {2F305555-C296-497E-AC20-5FA1B237996A}
{217DF501-135C-4E38-BFC8-99D4821032EA} = {2F305555-C296-497E-AC20-5FA1B237996A}
- {A7D5099E-F0FD-4BF3-8522-5A682759F915} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
{B1BCC8C6-46B5-4BFA-8F22-20F32D99EC6A} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
{F055103B-F80B-4D0C-BF48-057C55620033} = {5A7818A8-109C-4E1C-850D-1A654E234B0E}
{787B8AA6-CA93-4C84-96FE-DF31110AD1C4} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
@@ -1671,7 +1657,6 @@ Global
{ECC20689-002A-4354-95A6-B58DF089C6FF} = {2F305555-C296-497E-AC20-5FA1B237996A}
{4BABF3FE-3451-42FD-873F-3C332E18DCEF} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
{0648DF05-5DDA-4BE1-B5F2-584926EBDB65} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
- {6ED2F4FC-E122-4CEE-90F1-97E4CCC8BC7A} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
{BA661F5B-1D5A-4FFC-9BF1-FC39DF280BDD} = {38BDB927-829B-4C65-9CD9-93FB05D66D65}
{E496B7FC-1E99-4BAB-849B-0E8367040B02} = {38BDB927-829B-4C65-9CD9-93FB05D66D65}
{7F4B3A60-BC27-45A7-8000-68B0B6EA7466} = {38BDB927-829B-4C65-9CD9-93FB05D66D65}
@@ -1718,6 +1703,7 @@ Global
{5BDBD6C9-A31F-4CEB-871A-5E9E709197EF} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
{FD464B4C-2F68-4D06-91E7-4208146C41F5} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
{8FE5A5EE-1B59-401C-9FB3-B04ECD3E29C1} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
+ {020A7474-3601-4160-A159-D7B70B77B15F} = {C3081D9A-1586-441A-B5F4-ED815B3719C1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
diff --git a/README.md b/README.md
index dc0476917a..d3a1567bc4 100644
--- a/README.md
+++ b/README.md
@@ -31,6 +31,7 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline
- [.NET Core 3.1.23 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-desktop-3.1.23-windows-x64-installer) or a newer 3.1.x runtime. This is needed currently for the Settings application.
- [.NET 6.0.3 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-desktop-6.0.3-windows-x64-installer) or a newer 6.0.x runtime.
- [Microsoft Edge WebView2 Runtime](https://go.microsoft.com/fwlink/p/?LinkId=2124703) bootstrapper. This will install the latest version.
+ - [Windows App SDK Runtime 1.0.1](https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads). This will install version 1.0.1 if this or newer version is not installed already.
### Via GitHub with EXE [Recommended]
diff --git a/doc/devdocs/readme.md b/doc/devdocs/readme.md
index be7d7f572d..c8f001d86b 100644
--- a/doc/devdocs/readme.md
+++ b/doc/devdocs/readme.md
@@ -39,7 +39,8 @@ Once you've discussed your proposed feature/fix/etc. with a team member, and you
1. Windows 10 April 2018 Update (version 1803) or newer
2. Visual Studio Community/Professional/Enterprise 2022
-3. Once you've cloned and started the `PowerToys.sln`, in the solution explorer, if you see a dialog that says `install extra components`, click `install`
+3. Install the [Windows App SDK 1.0.1 C# Visual Studio 2022 extension](https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads)
+4. Once you've cloned and started the `PowerToys.sln`, in the solution explorer, if you see a dialog that says `install extra components`, click `install`
### Get Submodules to compile
We have submodules that need to be initialized before you can compile most parts of PowerToys. This should be a one time step.
diff --git a/doc/devdocs/settingsv2/project-overview.md b/doc/devdocs/settingsv2/project-overview.md
index c978c2029e..d01f820717 100644
--- a/doc/devdocs/settingsv2/project-overview.md
+++ b/doc/devdocs/settingsv2/project-overview.md
@@ -1,17 +1,17 @@
# Overview
-`Settingsv2` is WPF .net core desktop application. It uses the `WindowsXamlHost` control from the Windows Community Toolkit to host UWP controls from `WinUI3` library. More details about WinUI can be found [here](https://microsoft.github.io/microsoft-ui-xaml/about.html#what-is-it).
+`Settings` is Windows App Sdk WinUI3 .Net Unpackaged desktop application. More details about Windows App Sdk can be found [here](https://github.com/microsoft/WindowsAppSDK#windows-app-sdk---calling-all-windows-developers). More details about WinUI can be found [here](https://microsoft.github.io/microsoft-ui-xaml/about.html#what-is-it).
## Settings V2 Project structure
-The Settings project is a XAML island based project which
+The Settings project .Net WinUI3 based project which
follows the [MVVM architectural pattern][MVVM] where the graphical user interface is separated from the view models.
-#### [UI Components:](/src/settings-ui/Settings.UI)
-The Settings.UI project contains the xaml files for each of the UI components. It also contains the Hotkey logic for the settings control.
+#### [UI Components:](/src/settings-ui/Settings.UI/)
+The UI Components are part of PowerToys.Settings project. It contains the xaml files for each of the UI components. It also contains the Hotkey logic for the settings control.
#### [Viewmodels:](/src/settings-ui/Settings.UI.Library)
The Settings.UI.Library project contains the data that is to be rendered by the UI components.
-#### [Settings Runner:](/src/settings-ui/PowerToys.Settings)
+#### [Settings Runner:](/src/settings-ui/Settings.UI)
The function of the settings runner project is to communicate all changes that the user makes in the user interface, to the runner so that it can be dispatched and reflected in all the modules.
[MVVM]: https://docs.microsoft.com/en-us/windows/uwp/data-binding/data-binding-and-mvvm
\ No newline at end of file
diff --git a/doc/devdocs/settingsv2/runner-ipc.md b/doc/devdocs/settingsv2/runner-ipc.md
index 21ae6db1ec..7b5d759c7b 100644
--- a/doc/devdocs/settingsv2/runner-ipc.md
+++ b/doc/devdocs/settingsv2/runner-ipc.md
@@ -4,7 +4,7 @@ The Settings v2 process uses two way IPC to communicate with the runner process.
## Initialization
- On the settings' side, the two way IPC delegates are contained with the [`ShellPage.xaml.cs`](/src/settings-ui/Settings.UI/Views/ShellPage.xaml.cs) file. The delegates are static and the views for all the powerToys send the ipc information to the viewmodels as `ShellPage.DefaultSndMSGCallBack`.
-- These delegates are initialized within the [`Mainwindow.xaml.cs`](/src/settings-ui/PowerToys.Settings/MainWindow.xaml.cs) file in the `Settings.Runner` project.
+- These delegates are initialized within the [`Mainwindow.xaml.cs`](/src/settings-ui/Settings.UI/MainWindow.xaml.cs) file in the `Settings.Runner` project.
## Types of IPC delegates
diff --git a/doc/devdocs/settingsv2/ui-architecture.md b/doc/devdocs/settingsv2/ui-architecture.md
index a6d8ce927a..929f81386e 100644
--- a/doc/devdocs/settingsv2/ui-architecture.md
+++ b/doc/devdocs/settingsv2/ui-architecture.md
@@ -1,9 +1,7 @@
# UI Architecture
- The UI code is distributed between two projects: [`PowerToys.Settings`](/src/settings-ui/PowerToys.Settings) and [`Settings.UI`](/src/settings-ui/Settings.UI.Library). [`PowerToys.Settings`](/src/settings-ui/PowerToys.Settings) is a WPF .net core application. It contains the parent display window and corresponding code is present in [`MainWindow.xaml.`](/src/settings-ui/PowerToys.Settings/MainWindow.xaml) [`Settings.UI`](/src/settings-ui/Settings.UI.Library) is UWP applications and contains views for base navigation and modules. Fig 1 provides a description of the UI controls hierarchy and each of the controls have been summarized below :
-- [`MainWindow.xaml`](/src/settings-ui/PowerToys.Settings/MainWindow.xaml) is the parent WPF control.
-- `WindowsXamlHost` control is used to host UWP control to [`MainWindow.xaml`](/src/settings-ui/PowerToys.Settings/MainWindow.xaml) parent control.
-- [`ShellPage.xaml`](/src/settings-ui/Settings.UI/Views/ShellPage.xaml) is a UWP control, consisting of a side navigation panel with an icon for each module. Clicking on a module icon loads the corresponding `setting.json` file and displays the data in the UI.
+ The UI code is distributed between two projects: [`PowerToys.Settings`](/src/settings-ui/Settings.UI) and [`Settings.UI`](/src/settings-ui/Settings.UI.Library). [`PowerToys.Settings`](/src/settings-ui/Settings.UI) is a Windows App Sdk .net Unpackaged application. It contains the views for base navigation and modules. Parent display window and corresponding code is present in [`MainWindow.xaml.`](/src/settings-ui/Settings.UI/MainWindow.xaml). Fig 1 provides a description of the UI controls hierarchy and each of the controls have been summarized below :
+- [`ShellPage.xaml`](/src/settings-ui/Settings.UI/Views/ShellPage.xaml) is a WinUI control, consisting of a side navigation panel with an icon for each module. Clicking on a module icon loads the corresponding `setting.json` file and displays the data in the UI.

**Fig 1: UI Architecture for settingsv2**
diff --git a/doc/devdocs/settingsv2/xaml-island-tweaks.md b/doc/devdocs/settingsv2/xaml-island-tweaks.md
deleted file mode 100644
index e63c879302..0000000000
--- a/doc/devdocs/settingsv2/xaml-island-tweaks.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# XAML Island Tweaks
-Few tweaks were made to fix issues with Xaml Islands. These tweaks should be removed after migrating to WINUI3. The tweaks are listed below:
-1. Workaround to ensure XAML Island application terminates if attempted to close from taskbar while minimized:
-```
-private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
-{
- isOpen = false;
-
- // XAML Islands: If the window is closed while minimized, exit the process. Required to avoid process not terminating issue - https://github.com/microsoft/PowerToys/issues/4430
- if (WindowState == WindowState.Minimized)
- {
- // Run Environment.Exit on a separate task to avoid performance impact
- System.Threading.Tasks.Task.Run(() => { Environment.Exit(0); });
- }
-}
-```
-2. Workaround to hide the XAML Island blank icon in the taskbar when the XAML Island application is loading:
-```
-var coreWindow = Windows.UI.Core.CoreWindow.GetForCurrentThread();
-var coreWindowInterop = Interop.GetInterop(coreWindow);
-Interop.ShowWindow(coreWindowInterop.WindowHandle, Interop.SW_HIDE);
-```
-3. Workaround to prevent XAML Island failing to render on Nvidia workstation graphics cards:
-```
- // XAML Islands: If the window is open, explicitly force it to be shown to solve the blank dialog issue https://github.com/microsoft/PowerToys/issues/3384
- if (isOpen)
- {
- Show();
- }
- ```
diff --git a/installer/PowerToysSetup/PowerToys.wxs b/installer/PowerToysSetup/PowerToys.wxs
index 40daa1ace2..11c48956d3 100644
--- a/installer/PowerToysSetup/PowerToys.wxs
+++ b/installer/PowerToysSetup/PowerToys.wxs
@@ -92,6 +92,21 @@
PerMachine="yes"
UninstallCommand="/silent /uninstall">
+
+
+
+
-
+
-
+
-
+
-
+
+
+
@@ -48,13 +50,11 @@
-
-
-
+
@@ -66,7 +66,7 @@
-
+
@@ -123,6 +123,7 @@
+
@@ -505,18 +506,16 @@
-
-
-
-
-
-
+
+
+
+
@@ -833,7 +832,7 @@
-
+
@@ -853,7 +852,7 @@
-
+
@@ -898,17 +897,10 @@
-
+
-
-
-
-
-
-
-
@@ -957,42 +949,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1068,8 +1031,11 @@
-
+
+
+
+
@@ -1078,7 +1044,6 @@
-
@@ -1088,13 +1053,6 @@
-
-
-
-
-
-
-
@@ -1408,7 +1366,7 @@
-
+
diff --git a/installer/PowerToysSetup/publish.cmd b/installer/PowerToysSetup/publish.cmd
index 43eab51a3c..586bd66771 100644
--- a/installer/PowerToysSetup/publish.cmd
+++ b/installer/PowerToysSetup/publish.cmd
@@ -3,7 +3,7 @@ setlocal enableDelayedExpansion
IF NOT DEFINED PTRoot (SET PTRoot=..\..)
rem In case of Release we should not use Debug CRT in VCRT forwarders
-msbuild !PTRoot!\src\settings-ui\PowerToys.Settings\PowerToys.Settings.csproj -t:Publish -p:Configuration="Release" -p:Platform="x64" -p:PowerToysRoot=!PTRoot! -p:AppxBundle=Never -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=InstallationPublishProfile.pubxml
+msbuild !PTRoot!\src\settings-ui\Settings.UI\PowerToys.Settings.csproj -t:Publish -p:Configuration="Release" -p:Platform="x64" -p:PowerToysRoot=!PTRoot! -p:AppxBundle=Never -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=InstallationPublishProfile.pubxml
rem In case of Release we should not use Debug CRT in VCRT forwarders
msbuild !PTRoot!\src\modules\launcher\PowerLauncher\PowerLauncher.csproj -t:Publish -p:Configuration="Release" -p:Platform="x64" -p:AppxBundle=Never -p:PowerToysRoot=!PTRoot! -p:VCRTForwarders-IncludeDebugCRT=false -p:PublishProfile=InstallationPublishProfile.pubxml
diff --git a/installer/PowerToysSetupCustomActions/CustomAction.cpp b/installer/PowerToysSetupCustomActions/CustomAction.cpp
index c4362e3bb5..8a942d3348 100644
--- a/installer/PowerToysSetupCustomActions/CustomAction.cpp
+++ b/installer/PowerToysSetupCustomActions/CustomAction.cpp
@@ -942,7 +942,6 @@ UINT __stdcall TerminateProcessesCA(MSIHANDLE hInstall)
L"PowerToys.Settings.exe",
L"PowerToys.Awake.exe",
L"PowerToys.FancyZones.exe",
- L"PowerToys.Settings.UI.exe",
L"PowerToys.FancyZonesEditor.exe",
L"PowerToys.ColorPickerUI.exe",
L"PowerToys.AlwaysOnTop.exe",
diff --git a/src/ActionRunner/actionRunner.vcxproj b/src/ActionRunner/actionRunner.vcxproj
index eedd9d223f..5d252ba64b 100644
--- a/src/ActionRunner/actionRunner.vcxproj
+++ b/src/ActionRunner/actionRunner.vcxproj
@@ -65,6 +65,7 @@
+
@@ -72,5 +73,6 @@
+
\ No newline at end of file
diff --git a/src/ActionRunner/packages.config b/src/ActionRunner/packages.config
index 81f107b8bc..d758b61ef1 100644
--- a/src/ActionRunner/packages.config
+++ b/src/ActionRunner/packages.config
@@ -1,4 +1,5 @@
+
\ No newline at end of file
diff --git a/src/Update/PowerToys.Update.vcxproj b/src/Update/PowerToys.Update.vcxproj
index c8c554d3f9..d945960542 100644
--- a/src/Update/PowerToys.Update.vcxproj
+++ b/src/Update/PowerToys.Update.vcxproj
@@ -71,6 +71,7 @@
+
@@ -78,5 +79,6 @@
+
\ No newline at end of file
diff --git a/src/Update/packages.config b/src/Update/packages.config
index 81f107b8bc..d758b61ef1 100644
--- a/src/Update/packages.config
+++ b/src/Update/packages.config
@@ -1,4 +1,5 @@
+
\ No newline at end of file
diff --git a/src/common/ManagedCommon/ManagedCommon.csproj b/src/common/ManagedCommon/ManagedCommon.csproj
index 14159b692f..5176b4afcb 100644
--- a/src/common/ManagedCommon/ManagedCommon.csproj
+++ b/src/common/ManagedCommon/ManagedCommon.csproj
@@ -3,7 +3,7 @@
- netstandard2.0
+ net6.0-windows
x64
x64
$(Version).0
diff --git a/src/common/ManagedTelemetry/Telemetry/ManagedTelemetry.csproj b/src/common/ManagedTelemetry/Telemetry/ManagedTelemetry.csproj
index 48817408b0..17e44a11fb 100644
--- a/src/common/ManagedTelemetry/Telemetry/ManagedTelemetry.csproj
+++ b/src/common/ManagedTelemetry/Telemetry/ManagedTelemetry.csproj
@@ -2,7 +2,7 @@
- netstandard2.0
+ net6.0-windows
x64
x64
$(Version).0
diff --git a/src/common/interop/PowerToys.Interop.vcxproj b/src/common/interop/PowerToys.Interop.vcxproj
index 30dfc6715a..23dff3dc93 100644
--- a/src/common/interop/PowerToys.Interop.vcxproj
+++ b/src/common/interop/PowerToys.Interop.vcxproj
@@ -9,7 +9,7 @@
16.0
{F055103B-F80B-4D0C-BF48-057C55620033}
- v4.7.2
+ net6.0-windows
ManagedCProj
PowerToysInterop
PowerToys.Interop
@@ -17,7 +17,7 @@
DynamicLibrary
- true
+ NetCore
v143
@@ -119,11 +119,6 @@
-
-
-
-
-
diff --git a/src/common/utils/elevation.h b/src/common/utils/elevation.h
index ffcc42355b..e9dcfe8f8c 100644
--- a/src/common/utils/elevation.h
+++ b/src/common/utils/elevation.h
@@ -15,15 +15,19 @@
#include
#include
+#include
+
#include
#include
+#include
+#include
-namespace
+namespace
{
inline std::wstring GetErrorString(HRESULT handle)
{
- _com_error err(handle);
- return err.ErrorMessage();
+ _com_error err(handle);
+ return err.ErrorMessage();
}
inline bool FindDesktopFolderView(REFIID riid, void** ppv)
@@ -51,7 +55,7 @@ namespace
CComPtr spBrowser;
result = CComQIPtr(spdisp)->QueryService(SID_STopLevelBrowser,
- IID_PPV_ARGS(&spBrowser));
+ IID_PPV_ARGS(&spBrowser));
if (result != S_OK)
{
Logger::warn(L"Failed to query service. {}", GetErrorString(result));
@@ -104,7 +108,8 @@ namespace
inline bool ShellExecuteFromExplorer(
PCWSTR pszFile,
- PCWSTR pszParameters = nullptr)
+ PCWSTR pszParameters = nullptr,
+ PCWSTR workingDir = L"")
{
CComPtr spFolderView;
if (!GetDesktopAutomationObject(IID_PPV_ARGS(&spFolderView)))
@@ -121,11 +126,11 @@ namespace
}
CComQIPtr(spdispShell)
- ->ShellExecute(CComBSTR(pszFile),
- CComVariant(pszParameters ? pszParameters : L""),
- CComVariant(L""),
- CComVariant(L""),
- CComVariant(SW_SHOWNORMAL));
+ ->ShellExecuteW(CComBSTR(pszFile),
+ CComVariant(pszParameters ? pszParameters : L""),
+ CComVariant(workingDir),
+ CComVariant(L""),
+ CComVariant(SW_SHOWNORMAL));
return true;
}
@@ -205,7 +210,7 @@ inline HANDLE run_elevated(const std::wstring& file, const std::wstring& params)
}
// Run command as non-elevated user, returns true if succeeded, puts the process id into returnPid if returnPid != NULL
-inline bool run_non_elevated(const std::wstring& file, const std::wstring& params, DWORD* returnPid)
+inline bool run_non_elevated(const std::wstring& file, const std::wstring& params, DWORD* returnPid, const wchar_t* workingDir = nullptr)
{
Logger::info(L"run_non_elevated with params={}", params);
auto executable_args = L"\"" + file + L"\"";
@@ -225,7 +230,7 @@ inline bool run_non_elevated(const std::wstring& file, const std::wstring& param
{
Logger::error(L"GetShellWindow() failed. {}", get_last_error_or_default(GetLastError()));
}
-
+
return false;
}
DWORD pid;
@@ -280,7 +285,7 @@ inline bool run_non_elevated(const std::wstring& file, const std::wstring& param
FALSE,
EXTENDED_STARTUPINFO_PRESENT,
nullptr,
- nullptr,
+ workingDir,
&siex.StartupInfo,
&pi);
if (succeeded)
@@ -307,17 +312,17 @@ inline bool run_non_elevated(const std::wstring& file, const std::wstring& param
return succeeded;
}
-inline bool RunNonElevatedEx(const std::wstring& file, const std::wstring& params)
+inline bool RunNonElevatedEx(const std::wstring& file, const std::wstring& params, const std::wstring& working_dir)
{
try
{
CoInitialize(nullptr);
- if (!ShellExecuteFromExplorer(file.c_str(), params.c_str()))
+ if (!ShellExecuteFromExplorer(file.c_str(), params.c_str(), working_dir.c_str()))
{
return false;
}
}
- catch(...)
+ catch (...)
{
return false;
}
@@ -325,6 +330,44 @@ inline bool RunNonElevatedEx(const std::wstring& file, const std::wstring& param
return true;
}
+struct ProcessInfo
+{
+ wil::unique_process_handle processHandle;
+ DWORD processID = {};
+};
+
+inline std::optional RunNonElevatedFailsafe(const std::wstring& file, const std::wstring& params, const std::wstring& working_dir)
+{
+ bool launched = RunNonElevatedEx(file, params, working_dir);
+ if (!launched)
+ {
+ Logger::warn(L"RunNonElevatedEx() failed. Trying fallback");
+ std::wstring action_runner_path = get_module_folderpath() + L"\\PowerToys.ActionRunner.exe";
+ std::wstring newParams = fmt::format(L"-run-non-elevated -target \"{}\" {}", file, params);
+ launched = run_non_elevated(action_runner_path, newParams, nullptr, working_dir.c_str());
+ if (launched)
+ {
+ Logger::trace(L"Started {}", file);
+ }
+ else
+ {
+ Logger::warn(L"Failed to start {}", file);
+ return std::nullopt;
+ }
+ }
+
+ auto handles = getProcessHandlesByName(std::filesystem::path{ file }.filename().wstring(), PROCESS_QUERY_INFORMATION | SYNCHRONIZE);
+
+ if (handles.empty())
+ return std::nullopt;
+
+ ProcessInfo result;
+ result.processID = GetProcessId(handles[0].get());
+ result.processHandle = std::move(handles[0]);
+
+ return result;
+}
+
// Run command with the same elevation, returns true if succeeded
inline bool run_same_elevation(const std::wstring& file, const std::wstring& params, DWORD* returnPid)
{
diff --git a/src/modules/awake/AwakeModuleInterface/AwakeModuleInterface.vcxproj b/src/modules/awake/AwakeModuleInterface/AwakeModuleInterface.vcxproj
index 7701d32e14..b98a7a7b65 100644
--- a/src/modules/awake/AwakeModuleInterface/AwakeModuleInterface.vcxproj
+++ b/src/modules/awake/AwakeModuleInterface/AwakeModuleInterface.vcxproj
@@ -93,6 +93,7 @@
+
@@ -100,5 +101,6 @@
+
\ No newline at end of file
diff --git a/src/modules/awake/AwakeModuleInterface/packages.config b/src/modules/awake/AwakeModuleInterface/packages.config
index 6a0a5a1e09..f29ad9ef3e 100644
--- a/src/modules/awake/AwakeModuleInterface/packages.config
+++ b/src/modules/awake/AwakeModuleInterface/packages.config
@@ -1,4 +1,5 @@
+
\ No newline at end of file
diff --git a/src/modules/launcher/Microsoft.Launcher/Microsoft.Launcher.vcxproj b/src/modules/launcher/Microsoft.Launcher/Microsoft.Launcher.vcxproj
index 8458c5cc4b..4732b3c01a 100644
--- a/src/modules/launcher/Microsoft.Launcher/Microsoft.Launcher.vcxproj
+++ b/src/modules/launcher/Microsoft.Launcher/Microsoft.Launcher.vcxproj
@@ -87,6 +87,7 @@
+
@@ -94,5 +95,6 @@
+
\ No newline at end of file
diff --git a/src/modules/launcher/Microsoft.Launcher/dllmain.cpp b/src/modules/launcher/Microsoft.Launcher/dllmain.cpp
index c66c8818cb..8071c1c929 100644
--- a/src/modules/launcher/Microsoft.Launcher/dllmain.cpp
+++ b/src/modules/launcher/Microsoft.Launcher/dllmain.cpp
@@ -231,7 +231,18 @@ public:
unsigned long powertoys_pid = GetCurrentProcessId();
TerminateRunningInstance();
- if (!is_process_elevated(false))
+ if (is_process_elevated(false))
+ {
+ Logger::trace("Starting PowerToys Run from elevated process");
+ const auto modulePath = get_module_folderpath();
+ std::wstring runExecutablePath = modulePath;
+ std::wstring params;
+ params += L" -powerToysPid " + std::to_wstring(powertoys_pid) + L" ";
+ params += L"--started-from-runner ";
+ runExecutablePath += L"\\modules\\launcher\\PowerToys.PowerLauncher.exe";
+ processStarted = RunNonElevatedFailsafe(runExecutablePath, params, modulePath).has_value();
+ }
+ else
{
Logger::trace("Starting PowerToys Run from not elevated process");
std::wstring executable_args;
@@ -255,35 +266,6 @@ public:
Logger::error("Launcher failed to start");
}
}
- else
- {
- Logger::trace("Starting PowerToys Run from elevated process");
- std::wstring runExecutablePath = get_module_folderpath();
- std::wstring params;
- params += L" -powerToysPid " + std::to_wstring(powertoys_pid) + L" ";
- params += L"--started-from-runner ";
- runExecutablePath += L"\\modules\\launcher\\PowerToys.PowerLauncher.exe";
- if (RunNonElevatedEx(runExecutablePath, params))
- {
- processStarted = true;
- Logger::trace(L"The process started successfully");
- }
- else
- {
- Logger::warn(L"RunNonElevatedEx() failed. Trying fallback");
- std::wstring action_runner_path = get_module_folderpath() + L"\\PowerToys.ActionRunner.exe";
- std::wstring newParams = L"-run-non-elevated -target modules\\launcher\\PowerToys.PowerLauncher.exe " + params;
- if (run_non_elevated(action_runner_path, newParams, nullptr))
- {
- processStarted = true;
- Logger::trace("Started PowerToys Run Process");
- }
- else
- {
- Logger::warn("Failed to start PowerToys Run");
- }
- }
- }
processStarting = false;
m_enabled = true;
Logger::info("Microsoft_Launcher::enable() end");
@@ -343,7 +325,8 @@ public:
/* Now, PowerToys Run uses a global hotkey so that it can get focus.
* Activate it with the centralized keyboard hook only if the setting is on.*/
- if (m_use_centralized_keyboard_hook) {
+ if (m_use_centralized_keyboard_hook)
+ {
Logger::trace("Set POWER_LAUNCHER_SHARED_EVENT");
SetEvent(m_hCentralizedKeyboardHookEvent);
return true;
@@ -404,7 +387,7 @@ void Microsoft_Launcher::parse_hotkey(PowerToysSettings::PowerToyValues& setting
m_hotkey.ctrl = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_CTRL);
m_hotkey.key = static_cast(jsonHotkeyObject.GetNamedNumber(JSON_KEY_CODE));
}
- catch(...)
+ catch (...)
{
Logger::error("Failed to initialize PT Run start shortcut");
}
diff --git a/src/modules/launcher/Microsoft.Launcher/packages.config b/src/modules/launcher/Microsoft.Launcher/packages.config
index 81f107b8bc..d758b61ef1 100644
--- a/src/modules/launcher/Microsoft.Launcher/packages.config
+++ b/src/modules/launcher/Microsoft.Launcher/packages.config
@@ -1,4 +1,5 @@
+
\ No newline at end of file
diff --git a/src/modules/launcher/PowerLauncher.Telemetry/PowerLauncher.Telemetry.csproj b/src/modules/launcher/PowerLauncher.Telemetry/PowerLauncher.Telemetry.csproj
index 8925fb4718..87f712ca7c 100644
--- a/src/modules/launcher/PowerLauncher.Telemetry/PowerLauncher.Telemetry.csproj
+++ b/src/modules/launcher/PowerLauncher.Telemetry/PowerLauncher.Telemetry.csproj
@@ -1,7 +1,7 @@
- netstandard2.0
+ net6.0-windows
x64
x64
$(Version).0
diff --git a/src/modules/previewpane/powerpreview/packages.config b/src/modules/previewpane/powerpreview/packages.config
index 81f107b8bc..d758b61ef1 100644
--- a/src/modules/previewpane/powerpreview/packages.config
+++ b/src/modules/previewpane/powerpreview/packages.config
@@ -1,4 +1,5 @@
+
\ No newline at end of file
diff --git a/src/modules/previewpane/powerpreview/powerpreview.vcxproj b/src/modules/previewpane/powerpreview/powerpreview.vcxproj
index 9ffc9dfc34..c43c21f646 100644
--- a/src/modules/previewpane/powerpreview/powerpreview.vcxproj
+++ b/src/modules/previewpane/powerpreview/powerpreview.vcxproj
@@ -1,6 +1,7 @@
+
@@ -108,5 +109,6 @@
+
\ No newline at end of file
diff --git a/src/runner/settings_window.cpp b/src/runner/settings_window.cpp
index dcce81b874..5d84d6847d 100644
--- a/src/runner/settings_window.cpp
+++ b/src/runner/settings_window.cpp
@@ -334,24 +334,16 @@ void run_settings_window(bool show_oobe_window, bool show_scoobe_window, std::op
// 1. Run on start up.
PTSettingsHelper::save_general_settings(save_settings.to_json());
- std::wstring executable_args = L"\"";
- executable_args.append(executable_path);
- executable_args.append(L"\" ");
- executable_args.append(powertoys_pipe_name);
- executable_args.append(L" ");
- executable_args.append(settings_pipe_name);
- executable_args.append(L" ");
- executable_args.append(std::to_wstring(powertoys_pid));
- executable_args.append(L" ");
- executable_args.append(settings_theme);
- executable_args.append(L" ");
- executable_args.append(settings_elevatedStatus);
- executable_args.append(L" ");
- executable_args.append(settings_isUserAnAdmin);
- executable_args.append(L" ");
- executable_args.append(settings_showOobe);
- executable_args.append(L" ");
- executable_args.append(settings_showScoobe);
+ std::wstring executable_args = fmt::format(L"\"{}\" {} {} {} {} {} {} {} {}",
+ executable_path,
+ powertoys_pipe_name,
+ settings_pipe_name,
+ std::to_wstring(powertoys_pid),
+ settings_theme,
+ settings_elevatedStatus,
+ settings_isUserAnAdmin,
+ settings_showOobe,
+ settings_showScoobe);
if (settings_window.has_value())
{
@@ -363,10 +355,14 @@ void run_settings_window(bool show_oobe_window, bool show_scoobe_window, std::op
if (is_process_elevated())
{
- // TODO: Revisit this after switching to .NET 5
- // Due to a bug in .NET, running the Settings process as non-elevated
- // from an elevated process sometimes results in a crash.
- // process_created = run_settings_non_elevated(executable_path.c_str(), executable_args.data(), &process_info);
+ auto res = RunNonElevatedFailsafe(executable_path, executable_args, get_module_folderpath());
+ process_created = res.has_value();
+ if (process_created)
+ {
+ process_info.dwProcessId = res->processID;
+ process_info.hProcess = res->processHandle.release();
+ g_isLaunchInProgress = false;
+ }
}
if (FALSE == process_created)
diff --git a/src/runner/tray_icon.cpp b/src/runner/tray_icon.cpp
index 01b45f42e1..6fe32df61f 100644
--- a/src/runner/tray_icon.cpp
+++ b/src/runner/tray_icon.cpp
@@ -109,7 +109,7 @@ void handle_tray_command(HWND window, const WPARAM command_id, LPARAM lparam)
case ID_DOCUMENTATION_MENU_COMMAND:
{
- RunNonElevatedEx(L"https://aka.ms/PowerToysOverview", L"");
+ RunNonElevatedEx(L"https://aka.ms/PowerToysOverview", L"", L"");
break;
}
diff --git a/src/settings-ui/PowerToys.Settings/App.xaml b/src/settings-ui/PowerToys.Settings/App.xaml
deleted file mode 100644
index deedff2ed9..0000000000
--- a/src/settings-ui/PowerToys.Settings/App.xaml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
diff --git a/src/settings-ui/PowerToys.Settings/App.xaml.cs b/src/settings-ui/PowerToys.Settings/App.xaml.cs
deleted file mode 100644
index 50d0f989b5..0000000000
--- a/src/settings-ui/PowerToys.Settings/App.xaml.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) Microsoft Corporation
-// The Microsoft Corporation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Windows;
-using Microsoft.PowerToys.Settings.UI.Library.Telemetry.Events;
-using Microsoft.PowerToys.Telemetry;
-
-namespace PowerToys.Settings
-{
- ///
- /// Interaction logic for App.xaml.
- ///
- public partial class App : Application
- {
- private MainWindow settingsWindow;
-
- public bool ShowOobe { get; set; }
-
- public bool ShowScoobe { get; set; }
-
- public Type StartupPage { get; set; } = typeof(Microsoft.PowerToys.Settings.UI.Views.GeneralPage);
-
- public void OpenSettingsWindow(Type type)
- {
- if (settingsWindow == null)
- {
- settingsWindow = new MainWindow();
- }
- else if (settingsWindow.WindowState == WindowState.Minimized)
- {
- settingsWindow.WindowState = WindowState.Normal;
- }
-
- settingsWindow.Show();
- settingsWindow.NavigateToSection(type);
- }
-
- private void InitHiddenSettingsWindow()
- {
- settingsWindow = new MainWindow();
-
- Utils.ShowHide(settingsWindow);
- Utils.CenterToScreen(settingsWindow);
- }
-
- private void Application_Startup(object sender, StartupEventArgs e)
- {
- if (!ShowOobe && !ShowScoobe)
- {
- settingsWindow = new MainWindow();
- settingsWindow.Show();
- settingsWindow.NavigateToSection(StartupPage);
- }
- else
- {
- // Create the Settings window so that it's fully initialized and
- // it will be ready to receive the notification if the user opens
- // the Settings from the tray icon.
- InitHiddenSettingsWindow();
- if (ShowOobe)
- {
- PowerToysTelemetry.Log.WriteEvent(new OobeStartedEvent());
- OobeWindow oobeWindow = new OobeWindow(Microsoft.PowerToys.Settings.UI.OOBE.Enums.PowerToysModulesEnum.Overview);
- oobeWindow.Show();
- }
- else if (ShowScoobe)
- {
- PowerToysTelemetry.Log.WriteEvent(new ScoobeStartedEvent());
- OobeWindow scoobeWindow = new OobeWindow(Microsoft.PowerToys.Settings.UI.OOBE.Enums.PowerToysModulesEnum.WhatsNew);
- scoobeWindow.Show();
- }
- }
- }
- }
-}
diff --git a/src/settings-ui/PowerToys.Settings/Helpers/NativeMethods.cs b/src/settings-ui/PowerToys.Settings/Helpers/NativeMethods.cs
deleted file mode 100644
index ab7942fbe1..0000000000
--- a/src/settings-ui/PowerToys.Settings/Helpers/NativeMethods.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) Microsoft Corporation
-// The Microsoft Corporation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace PowerToys.Settings.Helpers
-{
- public static class NativeMethods
- {
- internal const int SW_SHOWNORMAL = 1;
- internal const int SW_SHOWMAXIMIZED = 3;
-
- [DllImport("user32.dll")]
- internal static extern bool SetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT lpwndpl);
-
- [DllImport("user32.dll")]
- internal static extern bool GetWindowPlacement(IntPtr hWnd, out WINDOWPLACEMENT lpwndpl);
- }
-}
diff --git a/src/settings-ui/PowerToys.Settings/MainWindow.xaml b/src/settings-ui/PowerToys.Settings/MainWindow.xaml
deleted file mode 100644
index 814dcda9c5..0000000000
--- a/src/settings-ui/PowerToys.Settings/MainWindow.xaml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
diff --git a/src/settings-ui/PowerToys.Settings/MainWindow.xaml.cs b/src/settings-ui/PowerToys.Settings/MainWindow.xaml.cs
deleted file mode 100644
index eedcb8c289..0000000000
--- a/src/settings-ui/PowerToys.Settings/MainWindow.xaml.cs
+++ /dev/null
@@ -1,203 +0,0 @@
-// Copyright (c) Microsoft Corporation
-// The Microsoft Corporation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.ComponentModel;
-using System.Drawing;
-using System.Windows;
-using System.Windows.Interop;
-using Microsoft.PowerLauncher.Telemetry;
-using Microsoft.PowerToys.Settings.UI.Library.Utilities;
-using Microsoft.PowerToys.Settings.UI.Views;
-using Microsoft.PowerToys.Telemetry;
-using Microsoft.Toolkit.Wpf.UI.XamlHost;
-using PowerToys.Settings.Helpers;
-using Windows.ApplicationModel.Resources;
-using Windows.Data.Json;
-
-namespace PowerToys.Settings
-{
- // Interaction logic for MainWindow.xaml.
- public partial class MainWindow : Window
- {
- private static Window inst;
-
- private bool isOpen = true;
-
- public MainWindow()
- {
- var bootTime = new System.Diagnostics.Stopwatch();
- bootTime.Start();
-
- this.InitializeComponent();
-
- Utils.FitToScreen(this);
-
- ResourceLoader loader = ResourceLoader.GetForViewIndependentUse();
- Title = loader.GetString("SettingsWindow_Title");
-
- bootTime.Stop();
-
- PowerToysTelemetry.Log.WriteEvent(new SettingsBootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds });
- }
-
- public static void CloseHiddenWindow()
- {
- if (inst != null && inst.Visibility == Visibility.Hidden)
- {
- inst.Close();
- }
- }
-
- public void NavigateToSection(Type type)
- {
- if (inst != null)
- {
- Activate();
- ShellPage.Navigate(type);
- }
- }
-
- protected override void OnSourceInitialized(EventArgs e)
- {
- base.OnSourceInitialized(e);
-
- var handle = new WindowInteropHelper(this).Handle;
- NativeMethods.GetWindowPlacement(handle, out var startupPlacement);
- var placement = Utils.DeserializePlacementOrDefault(handle);
- NativeMethods.SetWindowPlacement(handle, ref placement);
-
- var windowRect = new Rectangle((int)Left, (int)Top, (int)Width, (int)Height);
- var screenRect = new Rectangle((int)SystemParameters.VirtualScreenLeft, (int)SystemParameters.VirtualScreenTop, (int)SystemParameters.VirtualScreenWidth, (int)SystemParameters.VirtualScreenHeight);
- var intersection = Rectangle.Intersect(windowRect, screenRect);
-
- // Restore default position if 5% of width or height of the window is offscreen
- if (intersection.Width < (Width * 0.95) || intersection.Height < (Height * 0.95))
- {
- NativeMethods.SetWindowPlacement(handle, ref startupPlacement);
- }
- }
-
- protected override void OnClosing(CancelEventArgs e)
- {
- base.OnClosing(e);
- var handle = new WindowInteropHelper(this).Handle;
-
- Utils.SerializePlacement(handle);
- }
-
- private void WindowsXamlHost_ChildChanged(object sender, EventArgs e)
- {
- // If sender is null, it could lead to a NullReferenceException. This might occur on restarting as admin (check https://github.com/microsoft/PowerToys/issues/7393 for details)
- if (sender == null)
- {
- return;
- }
-
- // Hook up x:Bind source.
- WindowsXamlHost windowsXamlHost = sender as WindowsXamlHost;
- ShellPage shellPage = windowsXamlHost.GetUwpInternalObject() as ShellPage;
-
- if (shellPage != null)
- {
- // send IPC Message
- ShellPage.SetDefaultSndMessageCallback(msg =>
- {
- // IPC Manager is null when launching runner directly
- Program.GetTwoWayIPCManager()?.Send(msg);
- });
-
- // send IPC Message
- ShellPage.SetRestartAdminSndMessageCallback(msg =>
- {
- Program.GetTwoWayIPCManager()?.Send(msg);
- isOpen = false;
- System.Windows.Application.Current.Shutdown(); // close application
- });
-
- // send IPC Message
- ShellPage.SetCheckForUpdatesMessageCallback(msg =>
- {
- Program.GetTwoWayIPCManager()?.Send(msg);
- });
-
- // open oobe
- ShellPage.SetOpenOobeCallback(() =>
- {
- var oobe = new OobeWindow(Microsoft.PowerToys.Settings.UI.OOBE.Enums.PowerToysModulesEnum.Overview);
- oobe.Show();
- });
-
- // receive IPC Message
- Program.IPCMessageReceivedCallback = (string msg) =>
- {
- if (ShellPage.ShellHandler.IPCResponseHandleList != null)
- {
- var success = JsonObject.TryParse(msg, out JsonObject json);
- if (success)
- {
- foreach (Action handle in ShellPage.ShellHandler.IPCResponseHandleList)
- {
- handle(json);
- }
- }
- else
- {
- Logger.LogError("Failed to parse JSON from IPC message.");
- }
- }
- };
-
- ShellPage.SetElevationStatus(Program.IsElevated);
- ShellPage.SetIsUserAnAdmin(Program.IsUserAnAdmin);
- shellPage.Refresh();
- }
-
- // XAML Islands: If the window is open, explicitly force it to be shown to solve the blank dialog issue https://github.com/microsoft/PowerToys/issues/3384
- if (isOpen)
- {
- try
- {
- Show();
- }
- catch (InvalidOperationException)
- {
- }
- }
- }
-
- private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
- {
- if (OobeWindow.IsOpened)
- {
- e.Cancel = true;
- ((Window)sender).Hide();
- }
- else
- {
- isOpen = false;
- }
-
- // XAML Islands: If the window is closed while minimized, exit the process. Required to avoid process not terminating issue - https://github.com/microsoft/PowerToys/issues/4430
- if (WindowState == WindowState.Minimized)
- {
- // Run Environment.Exit on a separate task to avoid performance impact
- System.Threading.Tasks.Task.Run(() => { Environment.Exit(0); });
- }
- }
-
- private void MainWindow_Loaded(object sender, RoutedEventArgs e)
- {
- inst = (Window)sender;
- }
-
- private void MainWindow_Activated(object sender, EventArgs e)
- {
- if (((Window)sender).Visibility == Visibility.Hidden)
- {
- ((Window)sender).Visibility = Visibility.Visible;
- }
- }
- }
-}
diff --git a/src/settings-ui/PowerToys.Settings/OobeWindow.xaml b/src/settings-ui/PowerToys.Settings/OobeWindow.xaml
deleted file mode 100644
index bb8332631e..0000000000
--- a/src/settings-ui/PowerToys.Settings/OobeWindow.xaml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
diff --git a/src/settings-ui/PowerToys.Settings/OobeWindow.xaml.cs b/src/settings-ui/PowerToys.Settings/OobeWindow.xaml.cs
deleted file mode 100644
index fe21a6cf48..0000000000
--- a/src/settings-ui/PowerToys.Settings/OobeWindow.xaml.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (c) Microsoft Corporation
-// The Microsoft Corporation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Windows;
-using System.Windows.Interop;
-using interop;
-using Microsoft.PowerToys.Settings.UI.Helpers;
-using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
-using Microsoft.PowerToys.Settings.UI.OOBE.Views;
-using Microsoft.Toolkit.Wpf.UI.XamlHost;
-using Windows.ApplicationModel.Resources;
-
-namespace PowerToys.Settings
-{
- ///
- /// Interaction logic for OobeWindow.xaml
- ///
- public partial class OobeWindow : Window
- {
- private static Window inst;
- private OobeShellPage shellPage;
- private PowerToysModulesEnum initialModule;
-
- public static bool IsOpened
- {
- get
- {
- return inst != null;
- }
- }
-
- public OobeWindow(PowerToysModulesEnum initialModule)
- {
- InitializeComponent();
- Utils.FitToScreen(this);
- this.initialModule = initialModule;
-
- ResourceLoader loader = ResourceLoader.GetForViewIndependentUse();
- Title = loader.GetString("OobeWindow_Title");
- }
-
- private void Window_Closed(object sender, EventArgs e)
- {
- if (shellPage != null)
- {
- shellPage.OnClosing();
- }
-
- inst = null;
- MainWindow.CloseHiddenWindow();
- }
-
- private void Window_Loaded(object sender, RoutedEventArgs e)
- {
- if (inst != null)
- {
- inst.Close();
- }
-
- inst = this;
- }
-
- private void WindowsXamlHost_ChildChanged(object sender, EventArgs e)
- {
- if (sender == null)
- {
- return;
- }
-
- WindowsXamlHost windowsXamlHost = sender as WindowsXamlHost;
- shellPage = windowsXamlHost.GetUwpInternalObject() as OobeShellPage;
-
- if (shellPage != null)
- {
- shellPage.NavigateToModule(initialModule);
- }
-
- OobeShellPage.SetRunSharedEventCallback(() =>
- {
- return Constants.PowerLauncherSharedEvent();
- });
-
- OobeShellPage.SetColorPickerSharedEventCallback(() =>
- {
- return Constants.ShowColorPickerSharedEvent();
- });
-
- OobeShellPage.SetOpenMainWindowCallback((Type type) =>
- {
- ((App)Application.Current).OpenSettingsWindow(type);
- });
- }
-
- protected override void OnSourceInitialized(EventArgs e)
- {
- base.OnSourceInitialized(e);
- var hwnd = new WindowInteropHelper(this).Handle;
- NativeMethods.SetPopupStyle(hwnd);
- }
- }
-}
diff --git a/src/settings-ui/PowerToys.Settings/PowerToys.Settings.csproj b/src/settings-ui/PowerToys.Settings/PowerToys.Settings.csproj
deleted file mode 100644
index 375f01bea1..0000000000
--- a/src/settings-ui/PowerToys.Settings/PowerToys.Settings.csproj
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
-
-
- WinExe
- netcoreapp3.1
- true
- PowerToys.Settings.Program
- Microsoft Corporation
- PowerToys
- PowerToys Settings UI Runner
- logo.png
- $(Version).0
- x64
- icon.ico
- win-x64
- false
- false
-
-
- uap10.0.18362
-
-
-
- ..\..\..\$(Platform)\$(Configuration)\Settings
- false
- full
- true
- DEBUG;TRACE
-
-
-
- ..\..\..\$(Platform)\$(Configuration)\Settings
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/settings-ui/PowerToys.Settings/Program.cs b/src/settings-ui/PowerToys.Settings/Program.cs
deleted file mode 100644
index 8a3c72f051..0000000000
--- a/src/settings-ui/PowerToys.Settings/Program.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright (c) Microsoft Corporation
-// The Microsoft Corporation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics;
-using System.Windows;
-using interop;
-using ManagedCommon;
-
-namespace PowerToys.Settings
-{
- public static class Program
- {
- private enum Arguments
- {
- PTPipeName = 0,
- SettingsPipeName,
- PTPid,
- Theme, // used in the old settings
- ElevatedStatus,
- IsUserAdmin,
- ShowOobeWindow,
- ShowScoobeWindow,
- SettingsWindow,
- }
-
- // Quantity of arguments
- private const int RequiredArgumentsQty = 8;
- private const int RequiredAndOptionalArgumentsQty = 9;
-
- // Create an instance of the IPC wrapper.
- private static TwoWayPipeMessageIPCManaged ipcmanager;
-
- public static bool IsElevated { get; set; }
-
- public static bool IsUserAnAdmin { get; set; }
-
- public static int PowerToysPID { get; set; }
-
- public static Action IPCMessageReceivedCallback { get; set; }
-
- [STAThread]
- public static void Main(string[] args)
- {
- using (new Microsoft.PowerToys.Settings.UI.App())
- {
- App app = new App();
- app.InitializeComponent();
-
- if (args != null && args.Length >= RequiredArgumentsQty)
- {
- _ = int.TryParse(args[(int)Arguments.PTPid], out int powerToysPID);
- PowerToysPID = powerToysPID;
-
- IsElevated = args[(int)Arguments.ElevatedStatus] == "true";
- IsUserAnAdmin = args[(int)Arguments.IsUserAdmin] == "true";
- app.ShowOobe = args[(int)Arguments.ShowOobeWindow] == "true";
- app.ShowScoobe = args[(int)Arguments.ShowScoobeWindow] == "true";
-
- if (args.Length == RequiredAndOptionalArgumentsQty)
- {
- // open specific window
- switch (args[(int)Arguments.SettingsWindow])
- {
- case "Overview": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.GeneralPage); break;
- case "AlwaysOnTop": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.AlwaysOnTopPage); break;
- case "Awake": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.AwakePage); break;
- case "ColorPicker": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.ColorPickerPage); break;
- case "FancyZones": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.FancyZonesPage); break;
- case "Run": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.PowerLauncherPage); break;
- case "ImageResizer": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.ImageResizerPage); break;
- case "KBM": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.KeyboardManagerPage); break;
- case "MouseUtils": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.MouseUtilsPage); break;
- case "PowerRename": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.PowerRenamePage); break;
- case "FileExplorer": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.PowerPreviewPage); break;
- case "ShortcutGuide": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.ShortcutGuidePage); break;
- case "VideoConference": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.VideoConferencePage); break;
- default: Debug.Assert(false, "Unexpected SettingsWindow argument value"); break;
- }
- }
-
- RunnerHelper.WaitForPowerToysRunner(PowerToysPID, () =>
- {
- Environment.Exit(0);
- });
-
- ipcmanager = new TwoWayPipeMessageIPCManaged(args[(int)Arguments.SettingsPipeName], args[(int)Arguments.PTPipeName], (string message) =>
- {
- if (IPCMessageReceivedCallback != null && message.Length > 0)
- {
- Application.Current.Dispatcher.BeginInvoke(new System.Action(() =>
- {
- IPCMessageReceivedCallback(message);
- }));
- }
- });
- ipcmanager.Start();
- app.Run();
- }
- else
- {
- MessageBox.Show(
- "The application cannot be run as a standalone process. Please start the application through the runner.",
- "Forbidden",
- MessageBoxButton.OK);
- app.Shutdown();
- }
- }
- }
-
- public static TwoWayPipeMessageIPCManaged GetTwoWayIPCManager()
- {
- return ipcmanager;
- }
- }
-}
diff --git a/src/settings-ui/PowerToys.Settings/Utils.cs b/src/settings-ui/PowerToys.Settings/Utils.cs
deleted file mode 100644
index af7ae29777..0000000000
--- a/src/settings-ui/PowerToys.Settings/Utils.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright (c) Microsoft Corporation
-// The Microsoft Corporation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Text.Json;
-using System.Windows;
-using PowerToys.Settings.Helpers;
-
-namespace PowerToys.Settings
-{
- internal class Utils
- {
- private static string _placementPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Microsoft\PowerToys\settings-placement.json");
-
- public static void FitToScreen(Window window)
- {
- if (SystemParameters.WorkArea.Width < window.Width)
- {
- window.Width = SystemParameters.WorkArea.Width;
- }
-
- if (SystemParameters.WorkArea.Height < window.Height)
- {
- window.Height = SystemParameters.WorkArea.Height;
- }
- }
-
- public static void CenterToScreen(Window window)
- {
- if (SystemParameters.WorkArea.Height <= window.Height)
- {
- window.Top = 0;
- }
- else
- {
- window.Top = (SystemParameters.WorkArea.Height - window.Height) / 2;
- }
-
- if (SystemParameters.WorkArea.Width <= window.Width)
- {
- window.Left = 0;
- }
- else
- {
- window.Left = (SystemParameters.WorkArea.Width - window.Width) / 2;
- }
- }
-
- public static void ShowHide(Window window)
- {
- // To limit the visual flickering, show the window with a size of 0,0
- // and don't show it in the taskbar
- var originalHeight = window.Height;
- var originalWidth = window.Width;
- var originalMinHeight = window.MinHeight;
- var originalMinWidth = window.MinWidth;
-
- window.MinHeight = 0;
- window.MinWidth = 0;
- window.Height = 0;
- window.Width = 0;
- window.ShowInTaskbar = false;
-
- window.Show();
- window.Hide();
-
- window.Height = originalHeight;
- window.Width = originalWidth;
- window.MinHeight = originalMinHeight;
- window.MinWidth = originalMinWidth;
- window.ShowInTaskbar = true;
- }
-
- public static WINDOWPLACEMENT DeserializePlacementOrDefault(IntPtr handle)
- {
- if (File.Exists(_placementPath))
- {
- try
- {
- var json = File.ReadAllText(_placementPath);
- var placement = JsonSerializer.Deserialize(json);
-
- placement.Length = Marshal.SizeOf(typeof(WINDOWPLACEMENT));
- placement.Flags = 0;
- placement.ShowCmd = placement.ShowCmd == NativeMethods.SW_SHOWMAXIMIZED ? NativeMethods.SW_SHOWMAXIMIZED : NativeMethods.SW_SHOWNORMAL;
- return placement;
- }
-#pragma warning disable CA1031 // Do not catch general exception types
- catch (Exception)
-#pragma warning restore CA1031 // Do not catch general exception types
- {
- }
- }
-
- _ = NativeMethods.GetWindowPlacement(handle, out var defaultPlacement);
- return defaultPlacement;
- }
-
- public static void SerializePlacement(IntPtr handle)
- {
- _ = NativeMethods.GetWindowPlacement(handle, out var placement);
- try
- {
- var json = JsonSerializer.Serialize(placement);
- File.WriteAllText(_placementPath, json);
- }
-#pragma warning disable CA1031 // Do not catch general exception types
- catch (Exception)
-#pragma warning restore CA1031 // Do not catch general exception types
- {
- }
- }
- }
-}
diff --git a/src/settings-ui/PowerToys.Settings/app.manifest b/src/settings-ui/PowerToys.Settings/app.manifest
deleted file mode 100644
index 256260e61b..0000000000
--- a/src/settings-ui/PowerToys.Settings/app.manifest
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/settings-ui/Settings.UI.Library/Settings.UI.Library.csproj b/src/settings-ui/Settings.UI.Library/Settings.UI.Library.csproj
index 7b51779199..94be3205fa 100644
--- a/src/settings-ui/Settings.UI.Library/Settings.UI.Library.csproj
+++ b/src/settings-ui/Settings.UI.Library/Settings.UI.Library.csproj
@@ -3,7 +3,7 @@
- netstandard2.0
+ net6.0-windows
x64
$(Version).0
Microsoft Corporation
diff --git a/src/settings-ui/Settings.UI.Library/ViewModels/ImageResizerViewModel.cs b/src/settings-ui/Settings.UI.Library/ViewModels/ImageResizerViewModel.cs
index b1dbb86b63..533245e942 100644
--- a/src/settings-ui/Settings.UI.Library/ViewModels/ImageResizerViewModel.cs
+++ b/src/settings-ui/Settings.UI.Library/ViewModels/ImageResizerViewModel.cs
@@ -389,7 +389,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
if (name.StartsWith(namePrefix, StringComparison.InvariantCulture))
{
- if (int.TryParse(name.Substring(namePrefix.Length), out int number))
+ if (int.TryParse(name.AsSpan(namePrefix.Length), out int number))
{
if (newSizeCounter < number)
{
diff --git a/src/settings-ui/Settings.UI.Library/ViewModels/KeyboardManagerViewModel.cs b/src/settings-ui/Settings.UI.Library/ViewModels/KeyboardManagerViewModel.cs
index 1964cfb2ec..635d35ad3b 100644
--- a/src/settings-ui/Settings.UI.Library/ViewModels/KeyboardManagerViewModel.cs
+++ b/src/settings-ui/Settings.UI.Library/ViewModels/KeyboardManagerViewModel.cs
@@ -222,7 +222,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
Logger.LogInfo($"Starting {PowerToyName} editor from {path}");
// InvariantCulture: type represents the KeyboardManagerEditorType enum value
- editor = Process.Start(path, $"{type.ToString(CultureInfo.InvariantCulture)} {Process.GetCurrentProcess().Id}");
+ editor = Process.Start(path, $"{type.ToString(CultureInfo.InvariantCulture)} {Environment.ProcessId}");
}
catch (Exception e)
{
diff --git a/src/settings-ui/Settings.UI.UnitTests/Settings.UI.UnitTests.csproj b/src/settings-ui/Settings.UI.UnitTests/Settings.UI.UnitTests.csproj
index b212fac928..fbeae3b97b 100644
--- a/src/settings-ui/Settings.UI.UnitTests/Settings.UI.UnitTests.csproj
+++ b/src/settings-ui/Settings.UI.UnitTests/Settings.UI.UnitTests.csproj
@@ -1,7 +1,7 @@
- netcoreapp3.1
+ net6.0-windows
false
x64
$(Version).0
diff --git a/src/settings-ui/Settings.UI/App.xaml b/src/settings-ui/Settings.UI/App.xaml
index ad9869e4bf..0ec73f08c0 100644
--- a/src/settings-ui/Settings.UI/App.xaml
+++ b/src/settings-ui/Settings.UI/App.xaml
@@ -1,19 +1,20 @@
-
+ xmlns:local="using:Microsoft.PowerToys.Settings.UI"
+ xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls">
-
+
+
6,16,16,16
@@ -28,6 +29,7 @@
+
-
\ No newline at end of file
+
diff --git a/src/settings-ui/Settings.UI/App.xaml.cs b/src/settings-ui/Settings.UI/App.xaml.cs
index 2d786308a7..72419a6d04 100644
--- a/src/settings-ui/Settings.UI/App.xaml.cs
+++ b/src/settings-ui/Settings.UI/App.xaml.cs
@@ -2,33 +2,241 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System;
+using System.Diagnostics;
using System.Globalization;
+using System.Linq;
+using System.Threading.Tasks;
+using interop;
+using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Helpers;
using Microsoft.PowerToys.Settings.UI.Library;
-using Microsoft.Toolkit.Win32.UI.XamlHost;
+using Microsoft.PowerToys.Settings.UI.Library.Telemetry.Events;
+using Microsoft.PowerToys.Telemetry;
+using Microsoft.UI.Xaml;
+using Windows.UI.Popups;
+using Windows.UI.ViewManagement;
+using WinRT.Interop;
namespace Microsoft.PowerToys.Settings.UI
{
- public sealed partial class App : XamlApplication
+ ///
+ /// Provides application-specific behavior to supplement the default Application class.
+ ///
+ public partial class App : Application
{
+ private enum Arguments
+ {
+ PTPipeName = 1,
+ SettingsPipeName,
+ PTPid,
+ Theme, // used in the old settings
+ ElevatedStatus,
+ IsUserAdmin,
+ ShowOobeWindow,
+ ShowScoobeWindow,
+ SettingsWindow,
+ }
+
+ // Quantity of arguments
+ private const int RequiredArgumentsQty = 9;
+ private const int RequiredAndOptionalArgumentsQty = 10;
+
+ // Create an instance of the IPC wrapper.
+ private static TwoWayPipeMessageIPCManaged ipcmanager;
+
+ public static bool IsElevated { get; set; }
+
+ public static bool IsUserAnAdmin { get; set; }
+
+ public static int PowerToysPID { get; set; }
+
+ public bool ShowOobe { get; set; }
+
+ public bool ShowScoobe { get; set; }
+
+ public Type StartupPage { get; set; } = typeof(Views.GeneralPage);
+
+ public static Action IPCMessageReceivedCallback { get; set; }
+
+ ///
+ /// Initializes a new instance of the class.
+ /// Initializes the singleton application object. This is the first line of authored code
+ /// executed, and as such is the logical equivalent of main() or WinMain().
+ ///
public App()
{
- Initialize();
+ this.InitializeComponent();
+ }
- // Hide the Xaml Island window
- var coreWindow = Windows.UI.Core.CoreWindow.GetForCurrentThread();
- var coreWindowInterop = Interop.GetInterop(coreWindow);
- NativeMethods.ShowWindow(coreWindowInterop.WindowHandle, Interop.SW_HIDE);
+ public static void OpenSettingsWindow(Type type)
+ {
+ if (settingsWindow == null)
+ {
+ settingsWindow = new MainWindow();
+ }
+
+ settingsWindow.Activate();
+ settingsWindow.NavigateToSection(type);
+ }
+
+ ///
+ /// Invoked when the application is launched normally by the end user. Other entry points
+ /// will be used such as when the application is launched to open a specific file.
+ ///
+ /// Details about the launch request and process.
+ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
+ {
+ var cmdArgs = Environment.GetCommandLineArgs();
+
+ if (cmdArgs != null && cmdArgs.Length >= RequiredArgumentsQty)
+ {
+ // Skip the first argument which is prepended when launched by explorer
+ if (cmdArgs[0].EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase) && cmdArgs[1].EndsWith(".exe", StringComparison.InvariantCultureIgnoreCase) && (cmdArgs.Length >= RequiredArgumentsQty + 1))
+ {
+ cmdArgs = cmdArgs.Skip(1).ToArray();
+ }
+
+ _ = int.TryParse(cmdArgs[(int)Arguments.PTPid], out int powerToysPID);
+ PowerToysPID = powerToysPID;
+
+ IsElevated = cmdArgs[(int)Arguments.ElevatedStatus] == "true";
+ IsUserAnAdmin = cmdArgs[(int)Arguments.IsUserAdmin] == "true";
+ ShowOobe = cmdArgs[(int)Arguments.ShowOobeWindow] == "true";
+ ShowScoobe = cmdArgs[(int)Arguments.ShowScoobeWindow] == "true";
+
+ if (cmdArgs.Length == RequiredAndOptionalArgumentsQty)
+ {
+ // open specific window
+ switch (cmdArgs[(int)Arguments.SettingsWindow])
+ {
+ case "Overview": StartupPage = typeof(Views.GeneralPage); break;
+ case "AlwaysOnTop": StartupPage = typeof(Views.AlwaysOnTopPage); break;
+ case "Awake": StartupPage = typeof(Views.AwakePage); break;
+ case "ColorPicker": StartupPage = typeof(Views.ColorPickerPage); break;
+ case "FancyZones": StartupPage = typeof(Views.FancyZonesPage); break;
+ case "Run": StartupPage = typeof(Views.PowerLauncherPage); break;
+ case "ImageResizer": StartupPage = typeof(Views.ImageResizerPage); break;
+ case "KBM": StartupPage = typeof(Views.KeyboardManagerPage); break;
+ case "MouseUtils": StartupPage = typeof(Views.MouseUtilsPage); break;
+ case "PowerRename": StartupPage = typeof(Views.PowerRenamePage); break;
+ case "FileExplorer": StartupPage = typeof(Views.PowerPreviewPage); break;
+ case "ShortcutGuide": StartupPage = typeof(Views.ShortcutGuidePage); break;
+ case "VideoConference": StartupPage = typeof(Views.VideoConferencePage); break;
+ default: Debug.Assert(false, "Unexpected SettingsWindow argument value"); break;
+ }
+ }
+
+ RunnerHelper.WaitForPowerToysRunner(PowerToysPID, () =>
+ {
+ Environment.Exit(0);
+ });
+
+ ipcmanager = new TwoWayPipeMessageIPCManaged(cmdArgs[(int)Arguments.SettingsPipeName], cmdArgs[(int)Arguments.PTPipeName], (string message) =>
+ {
+ if (IPCMessageReceivedCallback != null && message.Length > 0)
+ {
+ IPCMessageReceivedCallback(message);
+ }
+ });
+ ipcmanager.Start();
+
+ settingsWindow = new MainWindow();
+ if (!ShowOobe && !ShowScoobe)
+ {
+ settingsWindow.Activate();
+ settingsWindow.NavigateToSection(StartupPage);
+ }
+ else
+ {
+ // Create the Settings window so that it's fully initialized and
+ // it will be ready to receive the notification if the user opens
+ // the Settings from the tray icon.
+ if (ShowOobe)
+ {
+ PowerToysTelemetry.Log.WriteEvent(new OobeStartedEvent());
+ OobeWindow oobeWindow = new OobeWindow(OOBE.Enums.PowerToysModules.Overview);
+ oobeWindow.Activate();
+ SetOobeWindow(oobeWindow);
+ }
+ else if (ShowScoobe)
+ {
+ PowerToysTelemetry.Log.WriteEvent(new ScoobeStartedEvent());
+ OobeWindow scoobeWindow = new OobeWindow(OOBE.Enums.PowerToysModules.WhatsNew);
+ scoobeWindow.Activate();
+ SetOobeWindow(scoobeWindow);
+ }
+ }
+ }
+ else
+ {
+ // For debugging purposes
+ // Window is also needed to show MessageDialog
+ settingsWindow = new MainWindow();
+ settingsWindow.Activate();
+ ShowMessageDialog("The application cannot be run as a standalone process. Please start the application through the runner.", "Forbidden");
+ }
+ }
+
+ private async void ShowMessageDialog(string content, string title = null)
+ {
+ await ShowDialogAsync(content, title);
+ }
+
+ public static Task ShowDialogAsync(string content, string title = null)
+ {
+ var dialog = new MessageDialog(content, title ?? string.Empty);
+ var handle = NativeMethods.GetActiveWindow();
+ if (handle == IntPtr.Zero)
+ {
+ throw new InvalidOperationException();
+ }
+
+ InitializeWithWindow.Initialize(dialog, handle);
+ return dialog.ShowAsync().AsTask();
+ }
+
+ public static TwoWayPipeMessageIPCManaged GetTwoWayIPCManager()
+ {
+ return ipcmanager;
}
public static bool IsDarkTheme()
{
var selectedTheme = SettingsRepository.GetInstance(settingsUtils).SettingsConfig.Theme.ToUpper(CultureInfo.InvariantCulture);
- var defaultTheme = new Windows.UI.ViewManagement.UISettings();
- var uiTheme = defaultTheme.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background).ToString(System.Globalization.CultureInfo.InvariantCulture);
+ var defaultTheme = new UISettings();
+ var uiTheme = defaultTheme.GetColorValue(UIColorType.Background).ToString(System.Globalization.CultureInfo.InvariantCulture);
return selectedTheme == "DARK" || (selectedTheme == "SYSTEM" && uiTheme == "#FF000000");
}
private static ISettingsUtils settingsUtils = new SettingsUtils();
+
+ private static MainWindow settingsWindow;
+ private static OobeWindow oobeWindow;
+
+ public static void ClearSettingsWindow()
+ {
+ settingsWindow = null;
+ }
+
+ public static MainWindow GetSettingsWindow()
+ {
+ return settingsWindow;
+ }
+
+ public static OobeWindow GetOobeWindow()
+ {
+ return oobeWindow;
+ }
+
+ public static void SetOobeWindow(OobeWindow window)
+ {
+ oobeWindow = window;
+ }
+
+ public static void ClearOobeWindow()
+ {
+ oobeWindow = null;
+ }
}
}
diff --git a/src/settings-ui/Settings.UI/Assets/LockScreenLogo.scale-200.png b/src/settings-ui/Settings.UI/Assets/LockScreenLogo.scale-200.png
index 735f57adb5..7440f0d4bf 100644
Binary files a/src/settings-ui/Settings.UI/Assets/LockScreenLogo.scale-200.png and b/src/settings-ui/Settings.UI/Assets/LockScreenLogo.scale-200.png differ
diff --git a/src/settings-ui/Settings.UI/Assets/SplashScreen.scale-200.png b/src/settings-ui/Settings.UI/Assets/SplashScreen.scale-200.png
index 023e7f1fed..32f486a867 100644
Binary files a/src/settings-ui/Settings.UI/Assets/SplashScreen.scale-200.png and b/src/settings-ui/Settings.UI/Assets/SplashScreen.scale-200.png differ
diff --git a/src/settings-ui/Settings.UI/Assets/Square150x150Logo.scale-200.png b/src/settings-ui/Settings.UI/Assets/Square150x150Logo.scale-200.png
index af49fec1a5..53ee3777ea 100644
Binary files a/src/settings-ui/Settings.UI/Assets/Square150x150Logo.scale-200.png and b/src/settings-ui/Settings.UI/Assets/Square150x150Logo.scale-200.png differ
diff --git a/src/settings-ui/Settings.UI/Assets/Square44x44Logo.scale-200.png b/src/settings-ui/Settings.UI/Assets/Square44x44Logo.scale-200.png
index ce342a2ec8..f713bba67f 100644
Binary files a/src/settings-ui/Settings.UI/Assets/Square44x44Logo.scale-200.png and b/src/settings-ui/Settings.UI/Assets/Square44x44Logo.scale-200.png differ
diff --git a/src/settings-ui/Settings.UI/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/src/settings-ui/Settings.UI/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
index f6c02ce97e..dc9f5bea0c 100644
Binary files a/src/settings-ui/Settings.UI/Assets/Square44x44Logo.targetsize-24_altform-unplated.png and b/src/settings-ui/Settings.UI/Assets/Square44x44Logo.targetsize-24_altform-unplated.png differ
diff --git a/src/settings-ui/Settings.UI/Assets/StoreLogo.png b/src/settings-ui/Settings.UI/Assets/StoreLogo.png
index 7385b56c0e..a4586f26bd 100644
Binary files a/src/settings-ui/Settings.UI/Assets/StoreLogo.png and b/src/settings-ui/Settings.UI/Assets/StoreLogo.png differ
diff --git a/src/settings-ui/Settings.UI/Assets/Wide310x150Logo.scale-200.png b/src/settings-ui/Settings.UI/Assets/Wide310x150Logo.scale-200.png
index 288995b397..8b4a5d0dd5 100644
Binary files a/src/settings-ui/Settings.UI/Assets/Wide310x150Logo.scale-200.png and b/src/settings-ui/Settings.UI/Assets/Wide310x150Logo.scale-200.png differ
diff --git a/src/settings-ui/Settings.UI/Behaviors/NavigationViewHeaderBehavior.cs b/src/settings-ui/Settings.UI/Behaviors/NavigationViewHeaderBehavior.cs
index 41eaea560f..d3da8420c4 100644
--- a/src/settings-ui/Settings.UI/Behaviors/NavigationViewHeaderBehavior.cs
+++ b/src/settings-ui/Settings.UI/Behaviors/NavigationViewHeaderBehavior.cs
@@ -3,12 +3,11 @@
// See the LICENSE file in the project root for more information.
using Microsoft.PowerToys.Settings.UI.Services;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Navigation;
using Microsoft.Xaml.Interactivity;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Navigation;
-
using WinUI = Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Behaviors
diff --git a/src/settings-ui/Settings.UI/Controls/CheckBoxWithDescriptionControl.cs b/src/settings-ui/Settings.UI/Controls/CheckBoxWithDescriptionControl.cs
index 898254da91..ad596138e1 100644
--- a/src/settings-ui/Settings.UI/Controls/CheckBoxWithDescriptionControl.cs
+++ b/src/settings-ui/Settings.UI/Controls/CheckBoxWithDescriptionControl.cs
@@ -3,11 +3,9 @@
// See the LICENSE file in the project root for more information.
using System.ComponentModel;
-using Windows.UI.Accessibility;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Automation;
-using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Media;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Automation;
+using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
diff --git a/src/settings-ui/Settings.UI/Controls/ColorPickerButton.xaml b/src/settings-ui/Settings.UI/Controls/ColorPickerButton.xaml
index 81873165cc..b97d1136a0 100644
--- a/src/settings-ui/Settings.UI/Controls/ColorPickerButton.xaml
+++ b/src/settings-ui/Settings.UI/Controls/ColorPickerButton.xaml
@@ -6,14 +6,16 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
- xmlns:clr="using:Windows.UI"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
+
+
diff --git a/src/settings-ui/Settings.UI/Controls/FancyZonesPreviewControl.xaml.cs b/src/settings-ui/Settings.UI/Controls/FancyZonesPreviewControl.xaml.cs
index b608706952..0bf4e212c4 100644
--- a/src/settings-ui/Settings.UI/Controls/FancyZonesPreviewControl.xaml.cs
+++ b/src/settings-ui/Settings.UI/Controls/FancyZonesPreviewControl.xaml.cs
@@ -6,10 +6,10 @@ using System.ComponentModel;
using System.IO;
using System.Text;
using Microsoft.PowerToys.Settings.UI.Helpers;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Media;
using Windows.UI;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Media;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
diff --git a/src/settings-ui/Settings.UI/Controls/IsEnabledTextBlock/IsEnabledTextBlock.cs b/src/settings-ui/Settings.UI/Controls/IsEnabledTextBlock/IsEnabledTextBlock.cs
index ff090777c8..6c15a703a0 100644
--- a/src/settings-ui/Settings.UI/Controls/IsEnabledTextBlock/IsEnabledTextBlock.cs
+++ b/src/settings-ui/Settings.UI/Controls/IsEnabledTextBlock/IsEnabledTextBlock.cs
@@ -3,8 +3,8 @@
// See the LICENSE file in the project root for more information.
using System.ComponentModel;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Controls;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
diff --git a/src/settings-ui/Settings.UI/Controls/KeyVisual/KeyVisual.cs b/src/settings-ui/Settings.UI/Controls/KeyVisual/KeyVisual.cs
index 1dafeacdaa..5e5d3ee846 100644
--- a/src/settings-ui/Settings.UI/Controls/KeyVisual/KeyVisual.cs
+++ b/src/settings-ui/Settings.UI/Controls/KeyVisual/KeyVisual.cs
@@ -2,11 +2,10 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System.ComponentModel.Design;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Markup;
using Windows.System;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Markup;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
diff --git a/src/settings-ui/Settings.UI/Controls/OOBEPageControl/OOBEPageControl.xaml.cs b/src/settings-ui/Settings.UI/Controls/OOBEPageControl/OOBEPageControl.xaml.cs
index 9683210ae2..abc73ee3e2 100644
--- a/src/settings-ui/Settings.UI/Controls/OOBEPageControl/OOBEPageControl.xaml.cs
+++ b/src/settings-ui/Settings.UI/Controls/OOBEPageControl/OOBEPageControl.xaml.cs
@@ -2,8 +2,8 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Controls;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
diff --git a/src/settings-ui/Settings.UI/Controls/Setting/Setting.cs b/src/settings-ui/Settings.UI/Controls/Setting/Setting.cs
index a396fb7f21..d235fb9751 100644
--- a/src/settings-ui/Settings.UI/Controls/Setting/Setting.cs
+++ b/src/settings-ui/Settings.UI/Controls/Setting/Setting.cs
@@ -3,10 +3,9 @@
// See the LICENSE file in the project root for more information.
using System.ComponentModel;
-using Windows.UI.Accessibility;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Automation;
-using Windows.UI.Xaml.Controls;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Automation;
+using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
diff --git a/src/settings-ui/Settings.UI/Controls/SettingExpander/SettingExpander.cs b/src/settings-ui/Settings.UI/Controls/SettingExpander/SettingExpander.cs
index 7b4ae00c50..78322e5435 100644
--- a/src/settings-ui/Settings.UI/Controls/SettingExpander/SettingExpander.cs
+++ b/src/settings-ui/Settings.UI/Controls/SettingExpander/SettingExpander.cs
@@ -2,15 +2,9 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Automation;
using Microsoft.UI.Xaml.Controls;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Automation;
-using Windows.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
diff --git a/src/settings-ui/Settings.UI/Controls/SettingsGroup/SettingsGroup.cs b/src/settings-ui/Settings.UI/Controls/SettingsGroup/SettingsGroup.cs
index 222922e87d..8b19fbf3ba 100644
--- a/src/settings-ui/Settings.UI/Controls/SettingsGroup/SettingsGroup.cs
+++ b/src/settings-ui/Settings.UI/Controls/SettingsGroup/SettingsGroup.cs
@@ -2,15 +2,10 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
-using System.Collections.Generic;
using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Automation.Peers;
-using Windows.UI.Xaml.Controls;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Automation.Peers;
+using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
diff --git a/src/settings-ui/Settings.UI/Controls/SettingsGroup/SettingsGroupAutomationPeer.cs b/src/settings-ui/Settings.UI/Controls/SettingsGroup/SettingsGroupAutomationPeer.cs
index ede4665fe0..56f85b1bde 100644
--- a/src/settings-ui/Settings.UI/Controls/SettingsGroup/SettingsGroupAutomationPeer.cs
+++ b/src/settings-ui/Settings.UI/Controls/SettingsGroup/SettingsGroupAutomationPeer.cs
@@ -2,7 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using Windows.UI.Xaml.Automation.Peers;
+using Microsoft.UI.Xaml.Automation.Peers;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
diff --git a/src/settings-ui/Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml b/src/settings-ui/Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml
index 0eb8c504eb..b916bf3736 100644
--- a/src/settings-ui/Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml
+++ b/src/settings-ui/Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml
@@ -6,7 +6,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Loaded="UserControl_Loaded"
- xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters" xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
+ xmlns:converters="using:CommunityToolkit.WinUI.UI.Converters"
+ xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
mc:Ignorable="d">
diff --git a/src/settings-ui/Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml.cs b/src/settings-ui/Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml.cs
index 02209e5c23..07848a80f2 100644
--- a/src/settings-ui/Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml.cs
+++ b/src/settings-ui/Settings.UI/Controls/SettingsPageControl/SettingsPageControl.xaml.cs
@@ -2,10 +2,9 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
using System.Collections.ObjectModel;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Controls;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
diff --git a/src/settings-ui/Settings.UI/Controls/ShortcutControl/ShortcutControl.xaml.cs b/src/settings-ui/Settings.UI/Controls/ShortcutControl/ShortcutControl.xaml.cs
index 08b8b6750c..121b17a0b5 100644
--- a/src/settings-ui/Settings.UI/Controls/ShortcutControl/ShortcutControl.xaml.cs
+++ b/src/settings-ui/Settings.UI/Controls/ShortcutControl/ShortcutControl.xaml.cs
@@ -5,14 +5,12 @@
using System;
using Microsoft.PowerToys.Settings.UI.Helpers;
using Microsoft.PowerToys.Settings.UI.Library;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Automation;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Input;
using Windows.ApplicationModel.Resources;
-using Windows.System.Diagnostics;
-using Windows.UI.Core;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Automation;
-using Windows.UI.Xaml.Automation.Peers;
-using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Input;
+using Windows.System;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
@@ -89,7 +87,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
this.Unloaded += ShortcutControl_Unloaded;
hook = new HotkeySettingsControlHook(Hotkey_KeyDown, Hotkey_KeyUp, Hotkey_IsActive, FilterAccessibleKeyboardEvents);
- ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView();
+ ResourceLoader resourceLoader = ResourceLoader.GetForViewIndependentUse();
// We create the Dialog in C# because doing it in XAML is giving WinUI/XAML Island bugs when using dark theme.
shortcutDialog = new ContentDialog
@@ -118,29 +116,29 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
private void KeyEventHandler(int key, bool matchValue, int matchValueCode)
{
- switch ((Windows.System.VirtualKey)key)
+ switch ((VirtualKey)key)
{
- case Windows.System.VirtualKey.LeftWindows:
- case Windows.System.VirtualKey.RightWindows:
+ case VirtualKey.LeftWindows:
+ case VirtualKey.RightWindows:
internalSettings.Win = matchValue;
break;
- case Windows.System.VirtualKey.Control:
- case Windows.System.VirtualKey.LeftControl:
- case Windows.System.VirtualKey.RightControl:
+ case VirtualKey.Control:
+ case VirtualKey.LeftControl:
+ case VirtualKey.RightControl:
internalSettings.Ctrl = matchValue;
break;
- case Windows.System.VirtualKey.Menu:
- case Windows.System.VirtualKey.LeftMenu:
- case Windows.System.VirtualKey.RightMenu:
+ case VirtualKey.Menu:
+ case VirtualKey.LeftMenu:
+ case VirtualKey.RightMenu:
internalSettings.Alt = matchValue;
break;
- case Windows.System.VirtualKey.Shift:
- case Windows.System.VirtualKey.LeftShift:
- case Windows.System.VirtualKey.RightShift:
+ case VirtualKey.Shift:
+ case VirtualKey.LeftShift:
+ case VirtualKey.RightShift:
_shiftToggled = true;
internalSettings.Shift = matchValue;
break;
- case Windows.System.VirtualKey.Escape:
+ case VirtualKey.Escape:
internalSettings = new HotkeySettings();
shortcutDialog.IsPrimaryButtonEnabled = false;
return;
@@ -183,7 +181,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
}
// If the current key press is tab, based on the other keys ignore the key press so as to shift focus out of the hotkey control.
- if ((Windows.System.VirtualKey)key == Windows.System.VirtualKey.Tab)
+ if ((VirtualKey)key == VirtualKey.Tab)
{
// Shift was not pressed while entering and Shift is not pressed while leaving the hotkey control, treat it as a normal tab key press.
if (!internalSettings.Shift && !_shiftKeyDownOnEntering && !internalSettings.Win && !internalSettings.Alt && !internalSettings.Ctrl)
@@ -197,7 +195,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
// This is to reset the shift key press within the control as it was not used within the control but rather was used to leave the hotkey.
internalSettings.Shift = false;
- SendSingleKeyboardInput((short)Windows.System.VirtualKey.Shift, (uint)NativeKeyboardHelper.KeyEventF.KeyDown);
+ SendSingleKeyboardInput((short)VirtualKey.Shift, (uint)NativeKeyboardHelper.KeyEventF.KeyDown);
return false;
}
@@ -223,7 +221,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
// The system still has shift in the key pressed status, therefore pass a Shift KeyUp message to the system, to release the shift key, therefore simulating only the Tab key press.
else if (!internalSettings.Shift && _shiftKeyDownOnEntering && _shiftToggled && !internalSettings.Win && !internalSettings.Alt && !internalSettings.Ctrl)
{
- SendSingleKeyboardInput((short)Windows.System.VirtualKey.Shift, (uint)NativeKeyboardHelper.KeyEventF.KeyUp);
+ SendSingleKeyboardInput((short)VirtualKey.Shift, (uint)NativeKeyboardHelper.KeyEventF.KeyUp);
return false;
}
@@ -238,50 +236,47 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
return true;
}
- private async void Hotkey_KeyDown(int key)
+ private void Hotkey_KeyDown(int key)
{
- await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
+ KeyEventHandler(key, true, key);
+
+ c.Keys = internalSettings.GetKeysList();
+
+ if (internalSettings.GetKeysList().Count == 0)
{
- KeyEventHandler(key, true, key);
+ // Empty, disable save button
+ shortcutDialog.IsPrimaryButtonEnabled = false;
+ }
+ else if (internalSettings.GetKeysList().Count == 1)
+ {
+ // 1 key, disable save button
+ shortcutDialog.IsPrimaryButtonEnabled = false;
- c.Keys = internalSettings.GetKeysList();
-
- if (internalSettings.GetKeysList().Count == 0)
+ // Check if the one key is a hotkey
+ if (internalSettings.Shift || internalSettings.Win || internalSettings.Alt || internalSettings.Ctrl)
{
- // Empty, disable save button
- shortcutDialog.IsPrimaryButtonEnabled = false;
+ c.IsError = false;
}
- else if (internalSettings.GetKeysList().Count == 1)
+ else
{
- // 1 key, disable save button
- shortcutDialog.IsPrimaryButtonEnabled = false;
-
- // Check if the one key is a hotkey
- if (internalSettings.Shift || internalSettings.Win || internalSettings.Alt || internalSettings.Ctrl)
- {
- c.IsError = false;
- }
- else
- {
- c.IsError = true;
- }
+ c.IsError = true;
}
+ }
- // Tab and Shift+Tab are accessible keys and should not be displayed in the hotkey control.
- if (internalSettings.Code > 0 && !internalSettings.IsAccessibleShortcut())
+ // Tab and Shift+Tab are accessible keys and should not be displayed in the hotkey control.
+ if (internalSettings.Code > 0 && !internalSettings.IsAccessibleShortcut())
+ {
+ lastValidSettings = internalSettings.Clone();
+
+ if (!ComboIsValid(lastValidSettings))
{
- lastValidSettings = internalSettings.Clone();
-
- if (!ComboIsValid(lastValidSettings))
- {
- DisableKeys();
- }
- else
- {
- EnableKeys();
- }
+ DisableKeys();
}
- });
+ else
+ {
+ EnableKeys();
+ }
+ }
}
private void EnableKeys()
@@ -300,12 +295,9 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
// WarningLabel.Style = (Style)App.Current.Resources["SecondaryWarningTextStyle"];
}
- private async void Hotkey_KeyUp(int key)
+ private void Hotkey_KeyUp(int key)
{
- await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
- {
- KeyEventHandler(key, false, 0);
- });
+ KeyEventHandler(key, false, 0);
}
private bool Hotkey_IsActive()
@@ -331,7 +323,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
_shiftToggled = false;
// To keep track of the shift key, whether it was pressed on entering.
- if ((NativeMethods.GetAsyncKeyState((int)Windows.System.VirtualKey.Shift) & 0x8000) != 0)
+ if ((NativeMethods.GetAsyncKeyState((int)VirtualKey.Shift) & 0x8000) != 0)
{
_shiftKeyDownOnEntering = true;
}
diff --git a/src/settings-ui/Settings.UI/Controls/ShortcutControl/ShortcutDialogContentControl.xaml b/src/settings-ui/Settings.UI/Controls/ShortcutControl/ShortcutDialogContentControl.xaml
index c501117fb4..a17bdbeda9 100644
--- a/src/settings-ui/Settings.UI/Controls/ShortcutControl/ShortcutDialogContentControl.xaml
+++ b/src/settings-ui/Settings.UI/Controls/ShortcutControl/ShortcutDialogContentControl.xaml
@@ -5,9 +5,9 @@
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls"
+ xmlns:toolkitcontrols="using:CommunityToolkit.WinUI.UI.Controls"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
- xmlns:converters="using:Microsoft.Toolkit.Uwp.UI.Converters"
+ xmlns:converters="using:CommunityToolkit.WinUI.UI.Converters"
mc:Ignorable="d"
x:Name="ShortcutContentControl">
@@ -69,11 +69,11 @@
+
diff --git a/src/settings-ui/Settings.UI/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml.cs b/src/settings-ui/Settings.UI/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml.cs
index d3e194abdc..fbc4da8e14 100644
--- a/src/settings-ui/Settings.UI/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml.cs
+++ b/src/settings-ui/Settings.UI/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml.cs
@@ -2,20 +2,9 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
-using Windows.Foundation;
-using Windows.Foundation.Collections;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Controls.Primitives;
-using Windows.UI.Xaml.Data;
-using Windows.UI.Xaml.Input;
-using Windows.UI.Xaml.Media;
-using Windows.UI.Xaml.Navigation;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Controls
{
diff --git a/src/settings-ui/Settings.UI/Converters/AwakeModeToIntConverter.cs b/src/settings-ui/Settings.UI/Converters/AwakeModeToIntConverter.cs
index ee73f03016..9746c62fc2 100644
--- a/src/settings-ui/Settings.UI/Converters/AwakeModeToIntConverter.cs
+++ b/src/settings-ui/Settings.UI/Converters/AwakeModeToIntConverter.cs
@@ -4,7 +4,7 @@
using System;
using Microsoft.PowerToys.Settings.UI.Library;
-using Windows.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Data;
namespace Microsoft.PowerToys.Settings.UI.Converters
{
diff --git a/src/settings-ui/Settings.UI/Converters/FindMyMouseActivationShakeMouseIntToVisibilityConverter.cs b/src/settings-ui/Settings.UI/Converters/FindMyMouseActivationShakeMouseIntToVisibilityConverter.cs
index ac0cbbfa70..d4539fe5dc 100644
--- a/src/settings-ui/Settings.UI/Converters/FindMyMouseActivationShakeMouseIntToVisibilityConverter.cs
+++ b/src/settings-ui/Settings.UI/Converters/FindMyMouseActivationShakeMouseIntToVisibilityConverter.cs
@@ -3,8 +3,8 @@
// See the LICENSE file in the project root for more information.
using System;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Data;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Data;
namespace Microsoft.PowerToys.Settings.UI.Converters
{
diff --git a/src/settings-ui/Settings.UI/Converters/ImageResizerFitToStringConverter.cs b/src/settings-ui/Settings.UI/Converters/ImageResizerFitToStringConverter.cs
index 736ac8aa6d..cb7098eed3 100644
--- a/src/settings-ui/Settings.UI/Converters/ImageResizerFitToStringConverter.cs
+++ b/src/settings-ui/Settings.UI/Converters/ImageResizerFitToStringConverter.cs
@@ -4,11 +4,8 @@
using System;
using System.Globalization;
-using System.Text;
+using Microsoft.UI.Xaml.Data;
using Windows.ApplicationModel.Resources;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Data;
-using Windows.UI.Xaml.Media;
namespace Microsoft.PowerToys.Settings.UI.Converters
{
@@ -25,9 +22,9 @@ namespace Microsoft.PowerToys.Settings.UI.Converters
string targetValue = string.Empty;
switch (value)
{
- case 0: targetValue = ResourceLoader.GetForCurrentView().GetString("ImageResizer_Fit_Fill_ThirdPersonSingular"); break;
- case 1: targetValue = ResourceLoader.GetForCurrentView().GetString("ImageResizer_Fit_Fit_ThirdPersonSingular"); break;
- case 2: targetValue = ResourceLoader.GetForCurrentView().GetString("ImageResizer_Fit_Stretch_ThirdPersonSingular"); break;
+ case 0: targetValue = ResourceLoader.GetForViewIndependentUse().GetString("ImageResizer_Fit_Fill_ThirdPersonSingular"); break;
+ case 1: targetValue = ResourceLoader.GetForViewIndependentUse().GetString("ImageResizer_Fit_Fit_ThirdPersonSingular"); break;
+ case 2: targetValue = ResourceLoader.GetForViewIndependentUse().GetString("ImageResizer_Fit_Stretch_ThirdPersonSingular"); break;
}
if (toLower)
diff --git a/src/settings-ui/Settings.UI/Converters/ImageResizerUnitToStringConverter.cs b/src/settings-ui/Settings.UI/Converters/ImageResizerUnitToStringConverter.cs
index b0b60715d0..f001608aae 100644
--- a/src/settings-ui/Settings.UI/Converters/ImageResizerUnitToStringConverter.cs
+++ b/src/settings-ui/Settings.UI/Converters/ImageResizerUnitToStringConverter.cs
@@ -4,8 +4,8 @@
using System;
using System.Globalization;
+using Microsoft.UI.Xaml.Data;
using Windows.ApplicationModel.Resources;
-using Windows.UI.Xaml.Data;
namespace Microsoft.PowerToys.Settings.UI.Converters
{
@@ -22,10 +22,10 @@ namespace Microsoft.PowerToys.Settings.UI.Converters
string targetValue = string.Empty;
switch (value)
{
- case 0: targetValue = ResourceLoader.GetForCurrentView().GetString("ImageResizer_Unit_Centimeter"); break;
- case 1: targetValue = ResourceLoader.GetForCurrentView().GetString("ImageResizer_Unit_Inch"); break;
- case 2: targetValue = ResourceLoader.GetForCurrentView().GetString("ImageResizer_Unit_Percent"); break;
- case 3: targetValue = ResourceLoader.GetForCurrentView().GetString("ImageResizer_Unit_Pixel"); break;
+ case 0: targetValue = ResourceLoader.GetForViewIndependentUse().GetString("ImageResizer_Unit_Centimeter"); break;
+ case 1: targetValue = ResourceLoader.GetForViewIndependentUse().GetString("ImageResizer_Unit_Inch"); break;
+ case 2: targetValue = ResourceLoader.GetForViewIndependentUse().GetString("ImageResizer_Unit_Percent"); break;
+ case 3: targetValue = ResourceLoader.GetForViewIndependentUse().GetString("ImageResizer_Unit_Pixel"); break;
}
if (toLower)
diff --git a/src/settings-ui/Settings.UI/Converters/UpdateStateToBoolConverter.cs b/src/settings-ui/Settings.UI/Converters/UpdateStateToBoolConverter.cs
index 1eec809aca..610736752e 100644
--- a/src/settings-ui/Settings.UI/Converters/UpdateStateToBoolConverter.cs
+++ b/src/settings-ui/Settings.UI/Converters/UpdateStateToBoolConverter.cs
@@ -3,12 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Microsoft.PowerToys.Settings.UI.Library;
-using Windows.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Data;
namespace Microsoft.PowerToys.Settings.UI.Converters
{
diff --git a/src/settings-ui/Settings.UI/GlobalSuppressions.cs b/src/settings-ui/Settings.UI/GlobalSuppressions.cs
new file mode 100644
index 0000000000..7bb4f5d3b8
--- /dev/null
+++ b/src/settings-ui/Settings.UI/GlobalSuppressions.cs
@@ -0,0 +1,75 @@
+// Copyright (c) Microsoft Corporation
+// The Microsoft Corporation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+// This file is used by Code Analysis to maintain SuppressMessage
+// attributes that are applied to this project.
+// Project-level suppressions either have no target or are given
+// a specific target and scoped to a namespace, type, member, etc.
+using System.Diagnostics.CodeAnalysis;
+
+[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1009:ClosingParenthesisMustBeSpacedCorrectly", Justification = "All current violations are due to Tuple shorthand and so valid.")]
+
+[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1101:PrefixLocalCallsWithThis", Justification = "We follow the C# Core Coding Style which avoids using `this` unless absolutely necessary.")]
+
+[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1200:UsingDirectivesMustBePlacedWithinNamespace", Justification = "We follow the C# Core Coding Style which puts using statements outside the namespace.")]
+[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1201:ElementsMustAppearInTheCorrectOrder", Justification = "It is not a priority and have hight impact in code changes.")]
+[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1202:ElementsMustBeOrderedByAccess", Justification = "It is not a priority and have hight impact in code changes.")]
+[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1203:ConstantsMustAppearBeforeFields", Justification = "It is not a priority and have hight impact in code changes.")]
+[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1204:StaticElementsMustAppearBeforeInstanceElements", Justification = "It is not a priority and have hight impact in code changes.")]
+
+[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1309:FieldNamesMustNotBeginWithUnderscore", Justification = "We follow the C# Core Coding Style which uses underscores as prefixes rather than using `this.`.")]
+
+[assembly: SuppressMessage("StyleCop.CSharp.SpecialRules", "SA0001:XmlCommentAnalysisDisabled", Justification = "Not enabled as we don't want or need XML documentation.")]
+[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1629:DocumentationTextMustEndWithAPeriod", Justification = "Not enabled as we don't want or need XML documentation.")]
+
+[assembly: SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly", Scope = "member", Target = "Microsoft.Templates.Core.Locations.TemplatesSynchronization.#SyncStatusChanged", Justification = "Using an Action