mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-01-05 11:57:00 +01:00
Compare commits
3 Commits
dev/snickl
...
yuleng/aot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a2d8d7851 | ||
|
|
f882bc3370 | ||
|
|
d872e844e7 |
@@ -45,6 +45,7 @@ jobs:
|
||||
BuildConfiguration: ${{ parameters.configuration }}
|
||||
SrcPath: $(Build.Repository.LocalPath)
|
||||
TestArtifactsName: build-${{ variables.BuildPlatform }}-${{ parameters.configuration }}${{ parameters.inputArtifactStem }}
|
||||
isBuildNow: ${{ eq(parameters.buildSource, 'buildNow') }}
|
||||
pool:
|
||||
${{ if eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564') }}:
|
||||
${{ if ne(parameters.platform, 'ARM64') }}:
|
||||
@@ -115,7 +116,7 @@ jobs:
|
||||
& '$(build.sourcesdirectory)\.pipelines\InstallWinAppDriver.ps1'
|
||||
displayName: Download and install WinAppDriver
|
||||
|
||||
- ${{ if ne(parameters.buildSource, 'buildNow') }}:
|
||||
- ${{ if not(variables.isBuildNow) }}:
|
||||
- task: DownloadPipelineArtifact@2
|
||||
inputs:
|
||||
buildType: 'specific'
|
||||
@@ -136,7 +137,7 @@ jobs:
|
||||
patterns: |
|
||||
**/PowerToysSetup*.exe
|
||||
|
||||
- ${{ if ne(parameters.buildSource, 'buildNow') }}:
|
||||
- ${{ if not(variables.isBuildNow) }}:
|
||||
- ${{ if eq(parameters.installMode, 'peruser') }}:
|
||||
- pwsh: |-
|
||||
& "$(build.sourcesdirectory)\.pipelines\installPowerToys.ps1" -InstallMode "PerUser"
|
||||
@@ -172,7 +173,7 @@ jobs:
|
||||
!**\UITests-FancyZones\**\UITests-FancyZonesEditor.dll
|
||||
env:
|
||||
platform: '$(TestPlatform)'
|
||||
useInstallerForTest: ${{ ne(parameters.buildSource, 'buildNow') }}
|
||||
useInstallerForTest: ${{ not(variables.isBuildNow) }}
|
||||
|
||||
- ${{ if ne(length(parameters.uiTestModules), 0) }}:
|
||||
- ${{ each module in parameters.uiTestModules }}:
|
||||
@@ -194,4 +195,4 @@ jobs:
|
||||
!**\UITests-FancyZones\**\UITests-FancyZonesEditor.dll
|
||||
env:
|
||||
platform: '$(TestPlatform)'
|
||||
useInstallerForTest: ${{ ne(parameters.buildSource, 'buildNow') }}
|
||||
useInstallerForTest: ${{ not(variables.isBuildNow) }}
|
||||
|
||||
@@ -3,6 +3,8 @@ variables:
|
||||
value: false
|
||||
- name: EnablePipelineCache
|
||||
value: true
|
||||
- name: isBuildNow
|
||||
value: ${{ eq(parameters.buildSource, 'buildNow') }}
|
||||
|
||||
parameters:
|
||||
- name: buildPlatforms
|
||||
@@ -37,22 +39,140 @@ parameters:
|
||||
|
||||
stages:
|
||||
- ${{ each platform in parameters.buildPlatforms }}:
|
||||
# Full build path: build PowerToys + UI tests + run tests
|
||||
- ${{ if eq(parameters.buildSource, 'buildNow') }}:
|
||||
- template: pipeline-ui-tests-full-build.yml
|
||||
parameters:
|
||||
platform: ${{ platform }}
|
||||
enableMsBuildCaching: ${{ parameters.enableMsBuildCaching }}
|
||||
useVSPreview: ${{ parameters.useVSPreview }}
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
- ${{ if variables.isBuildNow }}:
|
||||
- stage: Build_${{ platform }}
|
||||
displayName: Build ${{ platform }}
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: job-build-project.yml
|
||||
parameters:
|
||||
pool:
|
||||
${{ if eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564') }}:
|
||||
name: SHINE-INT-L
|
||||
${{ else }}:
|
||||
name: SHINE-OSS-L
|
||||
${{ if eq(parameters.useVSPreview, true) }}:
|
||||
demands: ImageOverride -equals SHINE-VS17-Preview
|
||||
buildPlatforms:
|
||||
- ${{ platform }}
|
||||
buildConfigurations: [Release]
|
||||
enablePackageCaching: true
|
||||
enableMsBuildCaching: ${{ parameters.enableMsBuildCaching }}
|
||||
runTests: false
|
||||
buildTests: true
|
||||
useVSPreview: ${{ parameters.useVSPreview }}
|
||||
timeoutInMinutes: 90
|
||||
|
||||
# Official build path: build UI tests only + download official build + run tests
|
||||
- ${{ if ne(parameters.buildSource, 'buildNow') }}:
|
||||
- template: pipeline-ui-tests-official-build.yml
|
||||
parameters:
|
||||
platform: ${{ platform }}
|
||||
buildSource: ${{ parameters.buildSource }}
|
||||
specificBuildId: ${{ parameters.specificBuildId }}
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
- ${{ if not(variables.isBuildNow) }}:
|
||||
- stage: BuildUITests_${{ platform }}
|
||||
displayName: Build UI Tests Only
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: job-build-ui-tests.yml
|
||||
parameters:
|
||||
pool:
|
||||
${{ if eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564') }}:
|
||||
name: SHINE-INT-L
|
||||
${{ else }}:
|
||||
name: SHINE-OSS-L
|
||||
${{ if eq(parameters.useVSPreview, true) }}:
|
||||
demands: ImageOverride -equals SHINE-VS17-Preview
|
||||
buildPlatforms:
|
||||
- ${{ platform }}
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
|
||||
- ${{ if eq(platform, 'x64') }}:
|
||||
- stage: Test_x64Win10
|
||||
displayName: Test x64Win10
|
||||
${{ if not(variables.isBuildNow) }}:
|
||||
dependsOn:
|
||||
- BuildUITests_${{ platform }}
|
||||
${{ else }}:
|
||||
dependsOn:
|
||||
- Build_${{ platform }}
|
||||
jobs:
|
||||
- template: job-test-project.yml
|
||||
parameters:
|
||||
platform: x64Win10
|
||||
configuration: Release
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
buildSource: ${{ parameters.buildSource }}
|
||||
specificBuildId: ${{ parameters.specificBuildId }}
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
|
||||
# Additional per-user installation test
|
||||
- ${{ if not(variables.isBuildNow) }}:
|
||||
- template: job-test-project.yml
|
||||
parameters:
|
||||
platform: x64Win10
|
||||
configuration: Release
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
buildSource: ${{ parameters.buildSource }}
|
||||
specificBuildId: ${{ parameters.specificBuildId }}
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
installMode: 'peruser'
|
||||
jobSuffix: '_PerUser'
|
||||
|
||||
- ${{ if eq(platform, 'x64') }}:
|
||||
- stage: Test_x64Win11
|
||||
displayName: Test x64Win11
|
||||
${{ if not(variables.isBuildNow) }}:
|
||||
dependsOn:
|
||||
- BuildUITests_${{ platform }}
|
||||
${{ else }}:
|
||||
dependsOn:
|
||||
- Build_${{ platform }}
|
||||
jobs:
|
||||
- template: job-test-project.yml
|
||||
parameters:
|
||||
platform: x64Win11
|
||||
configuration: Release
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
buildSource: ${{ parameters.buildSource }}
|
||||
specificBuildId: ${{ parameters.specificBuildId }}
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
|
||||
# Additional per-user installation test
|
||||
- ${{ if not(variables.isBuildNow) }}:
|
||||
- template: job-test-project.yml
|
||||
parameters:
|
||||
platform: x64Win11
|
||||
configuration: Release
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
buildSource: ${{ parameters.buildSource }}
|
||||
specificBuildId: ${{ parameters.specificBuildId }}
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
installMode: 'peruser'
|
||||
jobSuffix: '_PerUser'
|
||||
|
||||
- ${{ if ne(platform, 'x64') }}:
|
||||
- stage: Test_${{ platform }}
|
||||
displayName: Test ${{ platform }}
|
||||
${{ if not(variables.isBuildNow) }}:
|
||||
dependsOn:
|
||||
- BuildUITests_${{ platform }}
|
||||
${{ else }}:
|
||||
dependsOn:
|
||||
- Build_${{ platform }}
|
||||
jobs:
|
||||
- template: job-test-project.yml
|
||||
parameters:
|
||||
platform: ${{ platform }}
|
||||
configuration: Release
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
buildSource: ${{ parameters.buildSource }}
|
||||
specificBuildId: ${{ parameters.specificBuildId }}
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
|
||||
# Additional per-user installation test
|
||||
- ${{ if not(variables.isBuildNow) }}:
|
||||
- template: job-test-project.yml
|
||||
parameters:
|
||||
platform: ${{ platform }}
|
||||
configuration: Release
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
buildSource: ${{ parameters.buildSource }}
|
||||
specificBuildId: ${{ parameters.specificBuildId }}
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
installMode: 'peruser'
|
||||
jobSuffix: '_PerUser'
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
# Template for full build path: Build PowerToys + Build UI Tests + Run Tests
|
||||
parameters:
|
||||
- name: platform
|
||||
type: string
|
||||
- name: enableMsBuildCaching
|
||||
type: boolean
|
||||
default: false
|
||||
- name: useVSPreview
|
||||
type: boolean
|
||||
default: false
|
||||
- name: useLatestWebView2
|
||||
type: boolean
|
||||
default: false
|
||||
- name: uiTestModules
|
||||
type: object
|
||||
default: []
|
||||
|
||||
stages:
|
||||
# Stage 1: Build full PowerToys project
|
||||
- stage: Build_${{ parameters.platform }}
|
||||
displayName: Build PowerToys ${{ parameters.platform }}
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: job-build-project.yml
|
||||
parameters:
|
||||
pool:
|
||||
${{ if eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564') }}:
|
||||
name: SHINE-INT-L
|
||||
${{ else }}:
|
||||
name: SHINE-OSS-L
|
||||
${{ if eq(parameters.useVSPreview, true) }}:
|
||||
demands: ImageOverride -equals SHINE-VS17-Preview
|
||||
buildPlatforms:
|
||||
- ${{ parameters.platform }}
|
||||
buildConfigurations: [Release]
|
||||
enablePackageCaching: true
|
||||
enableMsBuildCaching: ${{ parameters.enableMsBuildCaching }}
|
||||
runTests: false
|
||||
buildTests: true
|
||||
useVSPreview: ${{ parameters.useVSPreview }}
|
||||
timeoutInMinutes: 90
|
||||
|
||||
# Stage 2: Run UI Tests
|
||||
- ${{ if eq(parameters.platform, 'x64') }}:
|
||||
- stage: Test_x64Win10_FullBuild
|
||||
displayName: Test x64Win10 (Full Build)
|
||||
dependsOn: Build_${{ parameters.platform }}
|
||||
jobs:
|
||||
- template: job-test-project.yml
|
||||
parameters:
|
||||
platform: x64Win10
|
||||
configuration: Release
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
buildSource: 'buildNow'
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
|
||||
- stage: Test_x64Win11_FullBuild
|
||||
displayName: Test x64Win11 (Full Build)
|
||||
dependsOn: Build_${{ parameters.platform }}
|
||||
jobs:
|
||||
- template: job-test-project.yml
|
||||
parameters:
|
||||
platform: x64Win11
|
||||
configuration: Release
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
buildSource: 'buildNow'
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
|
||||
- ${{ if ne(parameters.platform, 'x64') }}:
|
||||
- stage: Test_${{ parameters.platform }}_FullBuild
|
||||
displayName: Test ${{ parameters.platform }} (Full Build)
|
||||
dependsOn: Build_${{ parameters.platform }}
|
||||
jobs:
|
||||
- template: job-test-project.yml
|
||||
parameters:
|
||||
platform: ${{ parameters.platform }}
|
||||
configuration: Release
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
buildSource: 'buildNow'
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
@@ -1,110 +0,0 @@
|
||||
# Template for official build path: Download Official Build + Build UI Tests Only + Run Tests
|
||||
parameters:
|
||||
- name: platform
|
||||
type: string
|
||||
- name: buildSource
|
||||
type: string
|
||||
- name: specificBuildId
|
||||
type: string
|
||||
default: 'xxxx'
|
||||
- name: useLatestWebView2
|
||||
type: boolean
|
||||
default: false
|
||||
- name: uiTestModules
|
||||
type: object
|
||||
default: []
|
||||
|
||||
stages:
|
||||
# Stage 1: Build UI Tests Only
|
||||
- stage: BuildUITests_${{ parameters.platform }}
|
||||
displayName: Build UI Tests Only ${{ parameters.platform }}
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: job-build-ui-tests.yml
|
||||
parameters:
|
||||
pool:
|
||||
${{ if eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564') }}:
|
||||
name: SHINE-INT-L
|
||||
${{ else }}:
|
||||
name: SHINE-OSS-L
|
||||
buildPlatforms:
|
||||
- ${{ parameters.platform }}
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
|
||||
# Stage 2: Run UI Tests with Official Build
|
||||
- ${{ if eq(parameters.platform, 'x64') }}:
|
||||
- stage: Test_x64Win10_OfficialBuild
|
||||
displayName: Test x64Win10 (Official Build)
|
||||
dependsOn: BuildUITests_${{ parameters.platform }}
|
||||
jobs:
|
||||
- template: job-test-project.yml
|
||||
parameters:
|
||||
platform: x64Win10
|
||||
configuration: Release
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
buildSource: ${{ parameters.buildSource }}
|
||||
specificBuildId: ${{ parameters.specificBuildId }}
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
|
||||
# Additional per-user installation test
|
||||
- template: job-test-project.yml
|
||||
parameters:
|
||||
platform: x64Win10
|
||||
configuration: Release
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
buildSource: ${{ parameters.buildSource }}
|
||||
specificBuildId: ${{ parameters.specificBuildId }}
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
installMode: 'peruser'
|
||||
jobSuffix: '_PerUser'
|
||||
|
||||
- stage: Test_x64Win11_OfficialBuild
|
||||
displayName: Test x64Win11 (Official Build)
|
||||
dependsOn: BuildUITests_${{ parameters.platform }}
|
||||
jobs:
|
||||
- template: job-test-project.yml
|
||||
parameters:
|
||||
platform: x64Win11
|
||||
configuration: Release
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
buildSource: ${{ parameters.buildSource }}
|
||||
specificBuildId: ${{ parameters.specificBuildId }}
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
|
||||
# Additional per-user installation test
|
||||
- template: job-test-project.yml
|
||||
parameters:
|
||||
platform: x64Win11
|
||||
configuration: Release
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
buildSource: ${{ parameters.buildSource }}
|
||||
specificBuildId: ${{ parameters.specificBuildId }}
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
installMode: 'peruser'
|
||||
jobSuffix: '_PerUser'
|
||||
|
||||
- ${{ if ne(parameters.platform, 'x64') }}:
|
||||
- stage: Test_${{ parameters.platform }}_OfficialBuild
|
||||
displayName: Test ${{ parameters.platform }} (Official Build)
|
||||
dependsOn: BuildUITests_${{ parameters.platform }}
|
||||
jobs:
|
||||
- template: job-test-project.yml
|
||||
parameters:
|
||||
platform: ${{ parameters.platform }}
|
||||
configuration: Release
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
buildSource: ${{ parameters.buildSource }}
|
||||
specificBuildId: ${{ parameters.specificBuildId }}
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
|
||||
# Additional per-user installation test
|
||||
- template: job-test-project.yml
|
||||
parameters:
|
||||
platform: ${{ parameters.platform }}
|
||||
configuration: Release
|
||||
useLatestWebView2: ${{ parameters.useLatestWebView2 }}
|
||||
buildSource: ${{ parameters.buildSource }}
|
||||
specificBuildId: ${{ parameters.specificBuildId }}
|
||||
uiTestModules: ${{ parameters.uiTestModules }}
|
||||
installMode: 'peruser'
|
||||
jobSuffix: '_PerUser'
|
||||
@@ -34,22 +34,22 @@
|
||||
<!-- Including MessagePack to force version, since it's used by StreamJsonRpc but contains vulnerabilities. After StreamJsonRpc updates the version of MessagePack, we can upgrade StreamJsonRpc instead. -->
|
||||
<PackageVersion Include="MessagePack" Version="3.1.3" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0" />
|
||||
<PackageVersion Include="Microsoft.Data.Sqlite" Version="9.0.8" />
|
||||
<PackageVersion Include="Microsoft.Data.Sqlite" Version="9.0.7" />
|
||||
<!-- Including Microsoft.Bcl.AsyncInterfaces to force version, since it's used by Microsoft.SemanticKernel. -->
|
||||
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.8" />
|
||||
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="3.1.16" />
|
||||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.8" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.8" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.8" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.8" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="9.0.8" />
|
||||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.SemanticKernel" Version="1.15.0" />
|
||||
<PackageVersion Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.2" />
|
||||
<PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.2903.40" />
|
||||
<!-- Package Microsoft.Win32.SystemEvents added as a hack for being able to exclude the runtime assets so they don't conflict with 8.0.1. This is a dependency of System.Drawing.Common but the 8.0.1 version wasn't published to nuget. -->
|
||||
<PackageVersion Include="Microsoft.Win32.SystemEvents" Version="9.0.8" />
|
||||
<PackageVersion Include="Microsoft.Win32.SystemEvents" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.WindowsPackageManager.ComInterop" Version="1.10.340" />
|
||||
<PackageVersion Include="Microsoft.Windows.Compatibility" Version="9.0.8" />
|
||||
<PackageVersion Include="Microsoft.Windows.Compatibility" Version="9.0.7" />
|
||||
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.3.183" />
|
||||
<!-- CsWinRT version needs to be set to have a WinRT.Runtime.dll at the same version contained inside the NET SDK we're currently building on CI. -->
|
||||
<!--
|
||||
@@ -78,28 +78,28 @@
|
||||
<PackageVersion Include="StreamJsonRpc" Version="2.21.69" />
|
||||
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
|
||||
<!-- Package System.CodeDom added as a hack for being able to exclude the runtime assets so they don't conflict with 8.0.1. This is a dependency of System.Management but the 8.0.1 version wasn't published to nuget. -->
|
||||
<PackageVersion Include="System.CodeDom" Version="9.0.8" />
|
||||
<PackageVersion Include="System.CodeDom" Version="9.0.7" />
|
||||
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
|
||||
<PackageVersion Include="System.ComponentModel.Composition" Version="9.0.8" />
|
||||
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="9.0.8" />
|
||||
<PackageVersion Include="System.Data.OleDb" Version="9.0.8" />
|
||||
<PackageVersion Include="System.ComponentModel.Composition" Version="9.0.7" />
|
||||
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="9.0.7" />
|
||||
<PackageVersion Include="System.Data.OleDb" Version="9.0.7" />
|
||||
<!-- Package System.Data.SqlClient added to force it as a dependency of Microsoft.Windows.Compatibility to the latest version available at this time. -->
|
||||
<PackageVersion Include="System.Data.SqlClient" Version="4.9.0" />
|
||||
<!-- Package System.Diagnostics.EventLog added as a hack for being able to exclude the runtime assets so they don't conflict with 8.0.1. This is a dependency of System.Data.OleDb but the 8.0.1 version wasn't published to nuget. -->
|
||||
<PackageVersion Include="System.Diagnostics.EventLog" Version="9.0.8" />
|
||||
<PackageVersion Include="System.Diagnostics.EventLog" Version="9.0.7" />
|
||||
<!-- Package System.Diagnostics.PerformanceCounter added as a hack for being able to exclude the runtime assets so they don't conflict with 8.0.11. -->
|
||||
<PackageVersion Include="System.Diagnostics.PerformanceCounter" Version="9.0.8" />
|
||||
<PackageVersion Include="System.Drawing.Common" Version="9.0.8" />
|
||||
<PackageVersion Include="System.Diagnostics.PerformanceCounter" Version="9.0.7" />
|
||||
<PackageVersion Include="System.Drawing.Common" Version="9.0.7" />
|
||||
<PackageVersion Include="System.IO.Abstractions" Version="22.0.13" />
|
||||
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="22.0.13" />
|
||||
<PackageVersion Include="System.Management" Version="9.0.8" />
|
||||
<PackageVersion Include="System.Management" Version="9.0.7" />
|
||||
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
|
||||
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
|
||||
<PackageVersion Include="System.Reactive" Version="6.0.1" />
|
||||
<PackageVersion Include="System.Runtime.Caching" Version="9.0.8" />
|
||||
<PackageVersion Include="System.ServiceProcess.ServiceController" Version="9.0.8" />
|
||||
<PackageVersion Include="System.Text.Encoding.CodePages" Version="9.0.8" />
|
||||
<PackageVersion Include="System.Text.Json" Version="9.0.8" />
|
||||
<PackageVersion Include="System.Runtime.Caching" Version="9.0.7" />
|
||||
<PackageVersion Include="System.ServiceProcess.ServiceController" Version="9.0.7" />
|
||||
<PackageVersion Include="System.Text.Encoding.CodePages" Version="9.0.7" />
|
||||
<PackageVersion Include="System.Text.Json" Version="9.0.7" />
|
||||
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
|
||||
<PackageVersion Include="UnicodeInformation" Version="2.6.0" />
|
||||
<PackageVersion Include="UnitsNet" Version="5.56.0" />
|
||||
|
||||
42
NOTICE.md
42
NOTICE.md
@@ -1519,23 +1519,23 @@ SOFTWARE.
|
||||
- Mages 3.0.0
|
||||
- Markdig.Signed 0.34.0
|
||||
- MessagePack 3.1.3
|
||||
- Microsoft.Bcl.AsyncInterfaces 9.0.8
|
||||
- Microsoft.Bcl.AsyncInterfaces 9.0.7
|
||||
- Microsoft.Bot.AdaptiveExpressions.Core 4.23.0
|
||||
- Microsoft.CodeAnalysis.NetAnalyzers 9.0.0
|
||||
- Microsoft.Data.Sqlite 9.0.8
|
||||
- Microsoft.Data.Sqlite 9.0.7
|
||||
- Microsoft.Diagnostics.Tracing.TraceEvent 3.1.16
|
||||
- Microsoft.DotNet.ILCompiler (A)
|
||||
- Microsoft.Extensions.DependencyInjection 9.0.8
|
||||
- Microsoft.Extensions.Hosting 9.0.8
|
||||
- Microsoft.Extensions.Hosting.WindowsServices 9.0.8
|
||||
- Microsoft.Extensions.Logging 9.0.8
|
||||
- Microsoft.Extensions.Logging.Abstractions 9.0.8
|
||||
- Microsoft.Extensions.DependencyInjection 9.0.7
|
||||
- Microsoft.Extensions.Hosting 9.0.7
|
||||
- Microsoft.Extensions.Hosting.WindowsServices 9.0.7
|
||||
- Microsoft.Extensions.Logging 9.0.7
|
||||
- Microsoft.Extensions.Logging.Abstractions 9.0.7
|
||||
- Microsoft.NET.ILLink.Tasks (A)
|
||||
- Microsoft.SemanticKernel 1.15.0
|
||||
- Microsoft.Toolkit.Uwp.Notifications 7.1.2
|
||||
- Microsoft.Web.WebView2 1.0.2903.40
|
||||
- Microsoft.Win32.SystemEvents 9.0.8
|
||||
- Microsoft.Windows.Compatibility 9.0.8
|
||||
- Microsoft.Win32.SystemEvents 9.0.7
|
||||
- Microsoft.Windows.Compatibility 9.0.7
|
||||
- Microsoft.Windows.CsWin32 0.3.183
|
||||
- Microsoft.Windows.CsWinRT 2.2.0
|
||||
- Microsoft.Windows.SDK.BuildTools 10.0.26100.4188
|
||||
@@ -1555,25 +1555,25 @@ SOFTWARE.
|
||||
- SkiaSharp.Views.WinUI 2.88.9
|
||||
- StreamJsonRpc 2.21.69
|
||||
- StyleCop.Analyzers 1.2.0-beta.556
|
||||
- System.CodeDom 9.0.8
|
||||
- System.CodeDom 9.0.7
|
||||
- System.CommandLine 2.0.0-beta4.22272.1
|
||||
- System.ComponentModel.Composition 9.0.8
|
||||
- System.Configuration.ConfigurationManager 9.0.8
|
||||
- System.Data.OleDb 9.0.8
|
||||
- System.ComponentModel.Composition 9.0.7
|
||||
- System.Configuration.ConfigurationManager 9.0.7
|
||||
- System.Data.OleDb 9.0.7
|
||||
- System.Data.SqlClient 4.9.0
|
||||
- System.Diagnostics.EventLog 9.0.8
|
||||
- System.Diagnostics.PerformanceCounter 9.0.8
|
||||
- System.Drawing.Common 9.0.8
|
||||
- System.Diagnostics.EventLog 9.0.7
|
||||
- System.Diagnostics.PerformanceCounter 9.0.7
|
||||
- System.Drawing.Common 9.0.7
|
||||
- System.IO.Abstractions 22.0.13
|
||||
- System.IO.Abstractions.TestingHelpers 22.0.13
|
||||
- System.Management 9.0.8
|
||||
- System.Management 9.0.7
|
||||
- System.Net.Http 4.3.4
|
||||
- System.Private.Uri 4.3.2
|
||||
- System.Reactive 6.0.1
|
||||
- System.Runtime.Caching 9.0.8
|
||||
- System.ServiceProcess.ServiceController 9.0.8
|
||||
- System.Text.Encoding.CodePages 9.0.8
|
||||
- System.Text.Json 9.0.8
|
||||
- System.Runtime.Caching 9.0.7
|
||||
- System.ServiceProcess.ServiceController 9.0.7
|
||||
- System.Text.Encoding.CodePages 9.0.7
|
||||
- System.Text.Json 9.0.7
|
||||
- System.Text.RegularExpressions 4.3.1
|
||||
- UnicodeInformation 2.6.0
|
||||
- UnitsNet 5.56.0
|
||||
|
||||
1
deps/cxxopts
vendored
Submodule
1
deps/cxxopts
vendored
Submodule
Submodule deps/cxxopts added at 12e496da3d
@@ -12,6 +12,6 @@
|
||||
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.7.250513003" />
|
||||
<PackageVersion Include="Shmuelie.WinRTServer" Version="2.1.1" />
|
||||
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
|
||||
<PackageVersion Include="System.Text.Json" Version="9.0.8" />
|
||||
<PackageVersion Include="System.Text.Json" Version="9.0.7" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -6,7 +6,6 @@ using System.Collections.Immutable;
|
||||
using System.Collections.Specialized;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using ManagedCommon;
|
||||
using Microsoft.CmdPal.Common.Helpers;
|
||||
using Microsoft.CmdPal.Core.ViewModels.Messages;
|
||||
using Microsoft.CmdPal.Ext.Apps;
|
||||
using Microsoft.CommandPalette.Extensions;
|
||||
@@ -30,9 +29,6 @@ public partial class MainListPage : DynamicListPage,
|
||||
private bool _includeApps;
|
||||
private bool _filteredItemsIncludesApps;
|
||||
|
||||
private InterlockedBoolean _refreshRunning;
|
||||
private InterlockedBoolean _refreshRequested;
|
||||
|
||||
public MainListPage(IServiceProvider serviceProvider)
|
||||
{
|
||||
Icon = IconHelpers.FromRelativePath("Assets\\StoreLogo.scale-200.png");
|
||||
@@ -87,47 +83,18 @@ public partial class MainListPage : DynamicListPage,
|
||||
|
||||
private void ReapplySearchInBackground()
|
||||
{
|
||||
_refreshRequested.Set();
|
||||
if (!_refreshRunning.Set())
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_ = Task.Run(RunRefreshLoop);
|
||||
}
|
||||
|
||||
private void RunRefreshLoop()
|
||||
{
|
||||
try
|
||||
{
|
||||
do
|
||||
try
|
||||
{
|
||||
_refreshRequested.Clear();
|
||||
lock (_tlcManager.TopLevelCommands)
|
||||
{
|
||||
if (_filteredItemsIncludesApps == _includeApps)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var currentSearchText = SearchText;
|
||||
UpdateSearchText(currentSearchText, currentSearchText);
|
||||
}
|
||||
while (_refreshRequested.Value);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError("Failed to reload search", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_refreshRunning.Clear();
|
||||
if (_refreshRequested.Value && _refreshRunning.Set())
|
||||
catch (Exception e)
|
||||
{
|
||||
_ = Task.Run(RunRefreshLoop);
|
||||
Logger.LogError("Failed to reload search", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public override IListItem[] GetItems()
|
||||
@@ -159,15 +126,6 @@ public partial class MainListPage : DynamicListPage,
|
||||
var aliases = _serviceProvider.GetService<AliasManager>()!;
|
||||
if (aliases.CheckAlias(newSearch))
|
||||
{
|
||||
if (_filteredItemsIncludesApps != _includeApps)
|
||||
{
|
||||
lock (_tlcManager.TopLevelCommands)
|
||||
{
|
||||
_filteredItemsIncludesApps = _includeApps;
|
||||
_filteredItems = null;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -180,7 +138,6 @@ public partial class MainListPage : DynamicListPage,
|
||||
// Cleared out the filter text? easy. Reset _filteredItems, and bail out.
|
||||
if (string.IsNullOrEmpty(newSearch))
|
||||
{
|
||||
_filteredItemsIncludesApps = _includeApps;
|
||||
_filteredItems = null;
|
||||
RaiseItemsChanged(commands.Count);
|
||||
return;
|
||||
|
||||
@@ -98,107 +98,35 @@ public partial class ContentFormViewModel(IFormContent _form, WeakReference<IPag
|
||||
|
||||
public void HandleSubmit(IAdaptiveActionElement action, JsonObject inputs)
|
||||
{
|
||||
// BODGY circa GH #40979
|
||||
// Usually, you're supposed to try to cast the action to a specific
|
||||
// type, and use those objects to get the data you need.
|
||||
// However, there's something weird with AdaptiveCards and the way it
|
||||
// works when we consume it when built in Release, with AOT (and
|
||||
// trimming) enabled. Any sort of `action.As<IAdaptiveSubmitAction>()`
|
||||
// or similar will throw a System.InvalidCastException.
|
||||
//
|
||||
// Instead we have this horror show.
|
||||
//
|
||||
// The `action.ToJson()` blob ACTUALLY CONTAINS THE `type` field, which
|
||||
// we can use to determine what kind of action it is. Then we can parse
|
||||
// the JSON manually based on the type.
|
||||
var actionJson = action.ToJson();
|
||||
|
||||
if (actionJson.TryGetValue("type", out var actionTypeValue))
|
||||
if (action is AdaptiveOpenUrlAction openUrlAction)
|
||||
{
|
||||
var actionTypeString = actionTypeValue.GetString();
|
||||
Logger.LogTrace($"atString={actionTypeString}");
|
||||
|
||||
var actionType = actionTypeString switch
|
||||
{
|
||||
"Action.Submit" => ActionType.Submit,
|
||||
"Action.Execute" => ActionType.Execute,
|
||||
"Action.OpenUrl" => ActionType.OpenUrl,
|
||||
_ => ActionType.Unsupported,
|
||||
};
|
||||
|
||||
Logger.LogDebug($"{actionTypeString}->{actionType}");
|
||||
|
||||
switch (actionType)
|
||||
{
|
||||
case ActionType.OpenUrl:
|
||||
{
|
||||
HandleOpenUrlAction(action, actionJson);
|
||||
}
|
||||
|
||||
break;
|
||||
case ActionType.Submit:
|
||||
case ActionType.Execute:
|
||||
{
|
||||
HandleSubmitAction(action, actionJson, inputs);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
Logger.LogError($"{actionType} was an unexpected action `type`");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogError($"actionJson.TryGetValue(type) failed");
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleOpenUrlAction(IAdaptiveActionElement action, JsonObject actionJson)
|
||||
{
|
||||
if (actionJson.TryGetValue("url", out var actionUrlValue))
|
||||
{
|
||||
var actionUrl = actionUrlValue.GetString() ?? string.Empty;
|
||||
if (Uri.TryCreate(actionUrl, default(UriCreationOptions), out var uri))
|
||||
{
|
||||
WeakReferenceMessenger.Default.Send<LaunchUriMessage>(new(uri));
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogError($"Failed to produce URI for {actionUrlValue}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleSubmitAction(
|
||||
IAdaptiveActionElement action,
|
||||
JsonObject actionJson,
|
||||
JsonObject inputs)
|
||||
{
|
||||
var dataString = string.Empty;
|
||||
if (actionJson.TryGetValue("data", out var actionDataValue))
|
||||
{
|
||||
dataString = actionDataValue.Stringify() ?? string.Empty;
|
||||
WeakReferenceMessenger.Default.Send<LaunchUriMessage>(new(openUrlAction.Url));
|
||||
return;
|
||||
}
|
||||
|
||||
var inputString = inputs.Stringify();
|
||||
_ = Task.Run(() =>
|
||||
if (action is AdaptiveSubmitAction or AdaptiveExecuteAction)
|
||||
{
|
||||
try
|
||||
// Get the data and inputs
|
||||
var dataString = (action as AdaptiveSubmitAction)?.DataJson.Stringify() ?? string.Empty;
|
||||
var inputString = inputs.Stringify();
|
||||
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
var model = _formModel.Unsafe!;
|
||||
if (model != null)
|
||||
try
|
||||
{
|
||||
var result = model.SubmitForm(inputString, dataString);
|
||||
Logger.LogDebug($"SubmitForm() returned {result}");
|
||||
WeakReferenceMessenger.Default.Send<HandleCommandResultMessage>(new(new(result)));
|
||||
var model = _formModel.Unsafe!;
|
||||
if (model != null)
|
||||
{
|
||||
var result = model.SubmitForm(inputString, dataString);
|
||||
WeakReferenceMessenger.Default.Send<HandleCommandResultMessage>(new(new(result)));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowException(ex);
|
||||
}
|
||||
});
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowException(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly string ErrorCardJson = """
|
||||
|
||||
@@ -29,7 +29,7 @@ public static class WindowExtensions
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
// Setting IsShownInSwitchers failed. This can happen if the Explorer is not running.
|
||||
// SetShownInSwitchers failed. This can happen if the Explorer is not running.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,11 +176,7 @@ public sealed partial class MainWindow : WindowEx,
|
||||
|
||||
private void UpdateAcrylic()
|
||||
{
|
||||
if (_acrylicController != null)
|
||||
{
|
||||
_acrylicController.RemoveAllSystemBackdropTargets();
|
||||
_acrylicController.Dispose();
|
||||
}
|
||||
_acrylicController?.RemoveAllSystemBackdropTargets();
|
||||
|
||||
_acrylicController = GetAcrylicConfig(Content);
|
||||
|
||||
|
||||
@@ -44,25 +44,25 @@ public class AllAppsSettings : JsonSettingsManager
|
||||
private readonly ToggleSetting _enableStartMenuSource = new(
|
||||
Namespaced(nameof(EnableStartMenuSource)),
|
||||
Resources.enable_start_menu_source,
|
||||
string.Empty,
|
||||
Resources.enable_start_menu_source,
|
||||
true);
|
||||
|
||||
private readonly ToggleSetting _enableDesktopSource = new(
|
||||
Namespaced(nameof(EnableDesktopSource)),
|
||||
Resources.enable_desktop_source,
|
||||
string.Empty,
|
||||
Resources.enable_desktop_source,
|
||||
true);
|
||||
|
||||
private readonly ToggleSetting _enableRegistrySource = new(
|
||||
Namespaced(nameof(EnableRegistrySource)),
|
||||
Resources.enable_registry_source,
|
||||
string.Empty,
|
||||
Resources.enable_registry_source,
|
||||
false); // This one is very noisy
|
||||
|
||||
private readonly ToggleSetting _enablePathEnvironmentVariableSource = new(
|
||||
Namespaced(nameof(EnablePathEnvironmentVariableSource)),
|
||||
Resources.enable_path_environment_variable_source,
|
||||
string.Empty,
|
||||
Resources.enable_path_environment_variable_source,
|
||||
false); // this one is very VERY noisy
|
||||
|
||||
public double MinScoreThreshold { get; set; } = 0.75;
|
||||
|
||||
@@ -85,10 +85,6 @@ internal sealed partial class IndexerListItem : ListItem
|
||||
commands.Add(new CommandContextItem(openCommand));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
commands.Add(new CommandContextItem(openCommand));
|
||||
}
|
||||
|
||||
commands.Add(new CommandContextItem(new OpenWithCommand(fullPath)));
|
||||
commands.Add(new CommandContextItem(new ShowFileInFolderCommand(fullPath) { Name = Resources.Indexer_Command_ShowInFolder }));
|
||||
|
||||
@@ -225,11 +225,6 @@ internal sealed partial class SampleContentForm : FormContent
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Action.OpenUrl",
|
||||
"title": "Action.OpenUrl",
|
||||
"url": "https://adaptivecards.microsoft.com/"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -126,12 +126,11 @@ void App::OnLaunched(LaunchActivatedEventArgs const&)
|
||||
}
|
||||
|
||||
auto args = std::wstring{ GetCommandLine() };
|
||||
size_t pipePos{ args.rfind(L"\\\\.\\pipe\\") };
|
||||
|
||||
|
||||
// Try to parse command line arguments first
|
||||
std::vector<std::wstring> cmdLineFiles = ParseCommandLineArgs(args);
|
||||
|
||||
if (pipePos == std::wstring::npos && !cmdLineFiles.empty())
|
||||
if (!cmdLineFiles.empty())
|
||||
{
|
||||
// Use command line arguments for UI testing
|
||||
for (const auto& filePath : cmdLineFiles)
|
||||
@@ -143,10 +142,12 @@ void App::OnLaunched(LaunchActivatedEventArgs const&)
|
||||
else
|
||||
{
|
||||
// Use original pipe/stdin logic for normal operation
|
||||
size_t pos{ args.rfind(L"\\\\.\\pipe\\") };
|
||||
|
||||
std::wstring pipe_name;
|
||||
if (pipePos != std::wstring::npos)
|
||||
if (pos != std::wstring::npos)
|
||||
{
|
||||
pipe_name = args.substr(pipePos);
|
||||
pipe_name = args.substr(pos);
|
||||
}
|
||||
|
||||
HANDLE hStdin;
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Bgcode
|
||||
_previewHandlerControl.DoPreview(filePath);
|
||||
|
||||
NativeEventWaiter.WaitForEventLoop(
|
||||
Constants.BgcodePreviewResizeEvent(),
|
||||
Constants.GcodePreviewResizeEvent(),
|
||||
() =>
|
||||
{
|
||||
Rectangle s = default;
|
||||
|
||||
@@ -120,7 +120,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
|
||||
if (Shift)
|
||||
{
|
||||
shortcutList.Add(16); // The Shift key or button.
|
||||
shortcutList.Add("Shift");
|
||||
|
||||
// shortcutList.Add(16); // The Shift key or button.
|
||||
}
|
||||
|
||||
if (Code > 0)
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// 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 Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Converters
|
||||
{
|
||||
internal sealed partial class KeyVisualTemplateSelector : DataTemplateSelector
|
||||
{
|
||||
public DataTemplate KeyVisualTemplate { get; set; }
|
||||
|
||||
public DataTemplate CommaTemplate { get; set; }
|
||||
|
||||
protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
|
||||
{
|
||||
var stringValue = item as string;
|
||||
return stringValue == KeysDataModel.CommaSeparator ? CommaTemplate : KeyVisualTemplate;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,17 +10,23 @@ namespace Microsoft.PowerToys.Settings.UI.Converters
|
||||
{
|
||||
public partial class ModuleItemTemplateSelector : DataTemplateSelector
|
||||
{
|
||||
public DataTemplate TextTemplate { get; set; }
|
||||
|
||||
public DataTemplate ButtonTemplate { get; set; }
|
||||
|
||||
public DataTemplate ShortcutTemplate { get; set; }
|
||||
|
||||
public DataTemplate ActivationTemplate { get; set; }
|
||||
public DataTemplate KBMTemplate { get; set; }
|
||||
|
||||
protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
|
||||
{
|
||||
switch (item)
|
||||
{
|
||||
case DashboardModuleButtonItem: return ButtonTemplate;
|
||||
case DashboardModuleShortcutItem: return ShortcutTemplate;
|
||||
case DashboardModuleActivationItem: return ActivationTemplate;
|
||||
default: return ActivationTemplate;
|
||||
case DashboardModuleTextItem: return TextTemplate;
|
||||
case DashboardModuleKBMItem: return KBMTemplate;
|
||||
default: return TextTemplate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
<ItemGroup>
|
||||
<None Remove="Assets\Settings\Modules\APDialog.dark.png" />
|
||||
<None Remove="Assets\Settings\Modules\APDialog.light.png" />
|
||||
<None Remove="SettingsXAML\Controls\Dashboard\CheckUpdateControl.xaml" />
|
||||
<None Remove="SettingsXAML\Controls\Dashboard\ShortcutConflictControl.xaml" />
|
||||
<None Remove="SettingsXAML\Controls\KeyVisual\KeyCharPresenter.xaml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Remove="SettingsXAML\App.xaml" />
|
||||
@@ -135,15 +132,6 @@
|
||||
<None Update="Assets\Settings\Scripts\DisableModule.ps1">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<Page Update="SettingsXAML\Controls\KeyVisual\KeyCharPresenter.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Update="SettingsXAML\Controls\Dashboard\ShortcutConflictControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Update="SettingsXAML\Controls\Dashboard\CheckUpdateControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -3,20 +3,17 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Converters"
|
||||
xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
|
||||
<ResourceDictionary Source="/SettingsXAML/Controls/KeyVisual/KeyVisual.xaml" />
|
||||
<ResourceDictionary Source="/SettingsXAML/Controls/KeyVisual/KeyCharPresenter.xaml" />
|
||||
<ResourceDictionary Source="/SettingsXAML/Styles/TextBlock.xaml" />
|
||||
<ResourceDictionary Source="/SettingsXAML/Styles/Button.xaml" />
|
||||
<ResourceDictionary Source="/SettingsXAML/Styles/InfoBadge.xaml" />
|
||||
<ResourceDictionary Source="/SettingsXAML/Themes/Colors.xaml" />
|
||||
<ResourceDictionary Source="/SettingsXAML/Themes/Generic.xaml" />
|
||||
|
||||
<!-- Other merged dictionaries here -->
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
@@ -29,28 +26,19 @@
|
||||
x:Key="BoolToVisibilityConverter"
|
||||
FalseValue="Collapsed"
|
||||
TrueValue="Visible" />
|
||||
|
||||
<tkconverters:BoolToObjectConverter
|
||||
x:Key="BoolToComboBoxIndexConverter"
|
||||
FalseValue="0"
|
||||
TrueValue="1" />
|
||||
|
||||
<tkconverters:BoolToObjectConverter
|
||||
x:Key="ReverseBoolToComboBoxIndexConverter"
|
||||
FalseValue="1"
|
||||
TrueValue="0" />
|
||||
<tkconverters:DoubleToVisibilityConverter
|
||||
x:Name="DoubleToVisibilityConverter"
|
||||
FalseValue="Collapsed"
|
||||
GreaterThan="0"
|
||||
TrueValue="Visible" />
|
||||
<tkconverters:DoubleToVisibilityConverter
|
||||
x:Name="DoubleToInvertedVisibilityConverter"
|
||||
FalseValue="Visible"
|
||||
GreaterThan="0"
|
||||
TrueValue="Collapsed" />
|
||||
|
||||
<tkconverters:StringFormatConverter x:Key="StringFormatConverter" />
|
||||
<tkconverters:BoolNegationConverter x:Key="BoolNegationConverter" />
|
||||
<converters:UpdateStateToBoolConverter x:Key="UpdateStateToBoolConverter" />
|
||||
|
||||
<x:Double x:Key="SettingsCardSpacing">2</x:Double>
|
||||
|
||||
<!-- Overrides -->
|
||||
@@ -58,7 +46,6 @@
|
||||
<Thickness x:Key="InfoBarContentRootPadding">16,0,0,0</Thickness>
|
||||
<x:Double x:Key="SettingActionControlMinWidth">240</x:Double>
|
||||
|
||||
<x:Double x:Key="PageMaxWidth">1000</x:Double>
|
||||
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="Margin" Value="0,0,0,2" />
|
||||
@@ -68,6 +55,7 @@
|
||||
</Style>
|
||||
|
||||
<Style BasedOn="{StaticResource DefaultCheckBoxStyle}" TargetType="controls:CheckBoxWithDescriptionControl" />
|
||||
<!-- Other app resources here -->
|
||||
|
||||
<TransitionCollection x:Key="SettingsCardsAnimations">
|
||||
<EntranceThemeTransition FromVerticalOffset="50" />
|
||||
@@ -75,9 +63,6 @@
|
||||
<RepositionThemeTransition IsStaggeringEnabled="False" />
|
||||
<!-- Smoothly animates individual cards upon whenever Expanders are expanded/collapsed -->
|
||||
</TransitionCollection>
|
||||
|
||||
<!-- Additional resources or settings can be added here -->
|
||||
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UserControl
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Controls.Card"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Padding="8"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
||||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="{StaticResource OverlayCornerRadius}"
|
||||
mc:Ignorable="d">
|
||||
<Grid
|
||||
VerticalAlignment="{x:Bind VerticalContentAlignment, Mode=OneWay}"
|
||||
Background="{x:Bind Background, Mode=OneWay}"
|
||||
BorderBrush="{x:Bind BorderBrush, Mode=OneWay}"
|
||||
BorderThickness="{x:Bind BorderThickness, Mode=OneWay}"
|
||||
CornerRadius="{x:Bind CornerRadius, Mode=OneWay}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" MinHeight="44" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid x:Name="TitleGrid">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Margin="16,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
FontWeight="SemiBold"
|
||||
Text="{x:Bind Title, Mode=OneWay}" />
|
||||
<ContentPresenter
|
||||
Grid.Column="2"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Content="{x:Bind TitleContent, Mode=OneWay}" />
|
||||
</Grid>
|
||||
<Rectangle
|
||||
x:Name="Divider"
|
||||
Grid.Row="1"
|
||||
Height="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
Fill="{ThemeResource DividerStrokeColorDefaultBrush}"
|
||||
Visibility="{x:Bind DividerVisibility, Mode=OneWay}" />
|
||||
|
||||
<ContentPresenter
|
||||
Grid.Row="2"
|
||||
Margin="{x:Bind Padding, Mode=OneWay}"
|
||||
HorizontalAlignment="{x:Bind HorizontalContentAlignment, Mode=OneWay}"
|
||||
VerticalAlignment="{x:Bind VerticalContentAlignment, Mode=OneWay}"
|
||||
Content="{x:Bind Content, Mode=OneWay}" />
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="TitleGridVisibilityStates">
|
||||
<VisualState x:Name="TitleGridVisible" />
|
||||
<VisualState x:Name="TitleGridCollapsed">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="TitleGrid.Visibility" Value="Collapsed" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,73 +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 Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
{
|
||||
public sealed partial class Card : UserControl
|
||||
{
|
||||
public static readonly DependencyProperty TitleContentProperty = DependencyProperty.Register(nameof(TitleContent), typeof(object), typeof(Card), new PropertyMetadata(defaultValue: null, OnVisualPropertyChanged));
|
||||
|
||||
public object TitleContent
|
||||
{
|
||||
get => (object)GetValue(TitleContentProperty);
|
||||
set => SetValue(TitleContentProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(nameof(Title), typeof(string), typeof(Card), new PropertyMetadata(defaultValue: null, OnVisualPropertyChanged));
|
||||
|
||||
public string Title
|
||||
{
|
||||
get => (string)GetValue(TitleProperty);
|
||||
set => SetValue(TitleProperty, value);
|
||||
}
|
||||
|
||||
public static new readonly DependencyProperty ContentProperty = DependencyProperty.Register(nameof(Content), typeof(object), typeof(Card), new PropertyMetadata(defaultValue: null));
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1061:Do not hide base class methods", Justification = "We need to hide the base class method")]
|
||||
public new object Content
|
||||
{
|
||||
get => (object)GetValue(ContentProperty);
|
||||
set => SetValue(ContentProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty DividerVisibilityProperty = DependencyProperty.Register(nameof(DividerVisibility), typeof(Visibility), typeof(Card), new PropertyMetadata(defaultValue: null));
|
||||
|
||||
public Visibility DividerVisibility
|
||||
{
|
||||
get => (Visibility)GetValue(DividerVisibilityProperty);
|
||||
set => SetValue(DividerVisibilityProperty, value);
|
||||
}
|
||||
|
||||
public Card()
|
||||
{
|
||||
InitializeComponent();
|
||||
SetVisualStates();
|
||||
}
|
||||
|
||||
private static void OnVisualPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is Card card)
|
||||
{
|
||||
card.SetVisualStates();
|
||||
}
|
||||
}
|
||||
|
||||
private void SetVisualStates()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Title) && TitleContent == null)
|
||||
{
|
||||
VisualStateManager.GoToState(this, "TitleGridCollapsed", true);
|
||||
DividerVisibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
VisualStateManager.GoToState(this, "TitleGridVisible", true);
|
||||
DividerVisibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UserControl
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Controls.CheckUpdateControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button
|
||||
Click="SWVersionButtonClicked"
|
||||
Style="{StaticResource SubtleButtonStyle}"
|
||||
Visibility="{x:Bind UpdateAvailable, Mode=OneWay}">
|
||||
<Grid ColumnSpacing="16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border
|
||||
Width="20"
|
||||
Height="20"
|
||||
CornerRadius="10">
|
||||
<Border.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="0.5,1">
|
||||
<GradientStop Offset="0.0" Color="#239DE0" />
|
||||
<GradientStop Offset="1.0" Color="#037CD6" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
<FontIcon
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
FontSize="11"
|
||||
Foreground="White"
|
||||
Glyph="" />
|
||||
</Border>
|
||||
<StackPanel Grid.Column="1" Orientation="Vertical">
|
||||
<TextBlock x:Uid="UpdateAvailableTextBlock" FontWeight="SemiBold" />
|
||||
<TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}" Style="{StaticResource CaptionTextBlockStyle}">
|
||||
<Run x:Uid="GeneralVersion" />
|
||||
<Run Text="{x:Bind UpdateSettingsConfig.NewVersion, Mode=OneWay}" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Button>
|
||||
<Grid
|
||||
Padding="0,0,4,0"
|
||||
VerticalAlignment="Center"
|
||||
ColumnSpacing="16"
|
||||
Visibility="{x:Bind UpdateAvailable, Converter={StaticResource ReverseBoolToVisibilityConverter}, Mode=OneWay}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border
|
||||
Width="20"
|
||||
Height="20"
|
||||
CornerRadius="10">
|
||||
<Border.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="0.5,1">
|
||||
<GradientStop Offset="0.0" Color="#6FB538" />
|
||||
<GradientStop Offset="1.0" Color="#397A24" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
<FontIcon
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
FontSize="11"
|
||||
Foreground="White"
|
||||
Glyph="" />
|
||||
</Border>
|
||||
<StackPanel Grid.Column="1" Orientation="Vertical">
|
||||
<TextBlock x:Uid="YoureUpToDate" FontWeight="SemiBold" />
|
||||
<TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}" Style="{StaticResource CaptionTextBlockStyle}">
|
||||
<Run x:Uid="General_VersionLastChecked" />
|
||||
<Run Text="{x:Bind UpdateSettingsConfig.LastCheckedDateLocalized, Mode=OneWay}" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -1,30 +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 Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Services;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
{
|
||||
public sealed partial class CheckUpdateControl : UserControl
|
||||
{
|
||||
public bool UpdateAvailable { get; set; }
|
||||
|
||||
public UpdatingSettings UpdateSettingsConfig { get; set; }
|
||||
|
||||
public CheckUpdateControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
UpdateSettingsConfig = UpdatingSettings.LoadSettings();
|
||||
UpdateAvailable = UpdateSettingsConfig != null && (UpdateSettingsConfig.State == UpdatingSettings.UpdatingState.ReadyToInstall || UpdateSettingsConfig.State == UpdatingSettings.UpdatingState.ReadyToDownload);
|
||||
}
|
||||
|
||||
private void SWVersionButtonClicked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
NavigationService.Navigate(typeof(GeneralPage));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<UserControl
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Controls.ShortcutConflictControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<Button Click="ShortcutConflictBtn_Click" Style="{StaticResource SubtleButtonStyle}">
|
||||
<Grid ColumnSpacing="16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<FontIcon
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
FontSize="20"
|
||||
Foreground="{ThemeResource SystemFillColorCriticalBrush}"
|
||||
Glyph="" />
|
||||
<StackPanel Grid.Column="1" Orientation="Vertical">
|
||||
<TextBlock FontWeight="SemiBold" Text="Shortcut conflicts" />
|
||||
<TextBlock
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="2 conflicts found" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Button>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,40 +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.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
{
|
||||
public sealed partial class ShortcutConflictControl : UserControl
|
||||
{
|
||||
public ShortcutConflictControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
GetShortcutConflicts();
|
||||
}
|
||||
|
||||
private void GetShortcutConflicts()
|
||||
{
|
||||
// TO DO: Implement the logic to retrieve and display shortcut conflicts. Make sure to Collapse this control if not conflicts are found.
|
||||
}
|
||||
|
||||
private void ShortcutConflictBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// TO DO: Handle the button click event to show the shortcut conflicts window.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:ui="using:CommunityToolkit.WinUI">
|
||||
|
||||
<Style BasedOn="{StaticResource DefaultKeyCharPresenterStyle}" TargetType="local:KeyCharPresenter" />
|
||||
|
||||
<Style x:Key="DefaultKeyCharPresenterStyle" TargetType="local:KeyCharPresenter">
|
||||
<Setter Property="FontWeight" Value="Normal" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
<Setter Property="AutomationProperties.AccessibilityView" Value="Raw" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="local:KeyCharPresenter">
|
||||
<Grid Height="{TemplateBinding FontSize}">
|
||||
<TextBlock
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
FontFamily="{TemplateBinding FontFamily}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontWeight="{TemplateBinding FontWeight}"
|
||||
Text="{TemplateBinding Content}"
|
||||
TextLineBounds="Tight" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style
|
||||
x:Key="WindowsKeyCharPresenterStyle"
|
||||
BasedOn="{StaticResource DefaultKeyCharPresenterStyle}"
|
||||
TargetType="local:KeyCharPresenter">
|
||||
<!-- Scale to visually align the height of the Windows logo and text -->
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="local:KeyCharPresenter">
|
||||
<Grid Height="{TemplateBinding FontSize}">
|
||||
<Viewbox>
|
||||
<PathIcon Data="M9 20H0V11H9V20ZM20 20H11V11H20V20ZM9 9H0V0H9V9ZM20 9H11V0H20V9Z" />
|
||||
</Viewbox>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style
|
||||
x:Key="GlyphKeyCharPresenterStyle"
|
||||
BasedOn="{StaticResource DefaultKeyCharPresenterStyle}"
|
||||
TargetType="local:KeyCharPresenter">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="local:KeyCharPresenter">
|
||||
<Grid>
|
||||
<Viewbox>
|
||||
<FontIcon
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontWeight="{TemplateBinding FontWeight}"
|
||||
Glyph="{TemplateBinding Content}" />
|
||||
</Viewbox>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
@@ -1,32 +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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using Microsoft.UI.Xaml.Documents;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Controls;
|
||||
|
||||
public sealed partial class KeyCharPresenter : Control
|
||||
{
|
||||
public KeyCharPresenter()
|
||||
{
|
||||
DefaultStyleKey = typeof(KeyCharPresenter);
|
||||
}
|
||||
|
||||
public object Content
|
||||
{
|
||||
get => (object)GetValue(ContentProperty);
|
||||
set => SetValue(ContentProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(nameof(Content), typeof(object), typeof(KeyCharPresenter), new PropertyMetadata(default(string)));
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
// 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 Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Markup;
|
||||
using Windows.System;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
{
|
||||
[TemplatePart(Name = KeyPresenter, Type = typeof(ContentPresenter))]
|
||||
[TemplateVisualState(Name = "Normal", GroupName = "CommonStates")]
|
||||
[TemplateVisualState(Name = "Disabled", GroupName = "CommonStates")]
|
||||
[TemplateVisualState(Name = "Default", GroupName = "StateStates")]
|
||||
[TemplateVisualState(Name = "Error", GroupName = "StateStates")]
|
||||
public sealed partial class KeyVisual : Control
|
||||
{
|
||||
private const string KeyPresenter = "KeyPresenter";
|
||||
private KeyVisual _keyVisual;
|
||||
private ContentPresenter _keyPresenter;
|
||||
|
||||
public object Content
|
||||
{
|
||||
get => (object)GetValue(ContentProperty);
|
||||
set => SetValue(ContentProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ContentProperty = DependencyProperty.Register("Content", typeof(object), typeof(KeyVisual), new PropertyMetadata(default(string), OnContentChanged));
|
||||
|
||||
public VisualType VisualType
|
||||
{
|
||||
get => (VisualType)GetValue(VisualTypeProperty);
|
||||
set => SetValue(VisualTypeProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty VisualTypeProperty = DependencyProperty.Register("VisualType", typeof(VisualType), typeof(KeyVisual), new PropertyMetadata(default(VisualType), OnSizeChanged));
|
||||
|
||||
public bool IsError
|
||||
{
|
||||
get => (bool)GetValue(IsErrorProperty);
|
||||
set => SetValue(IsErrorProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsErrorProperty = DependencyProperty.Register("IsError", typeof(bool), typeof(KeyVisual), new PropertyMetadata(false, OnIsErrorChanged));
|
||||
|
||||
public KeyVisual()
|
||||
{
|
||||
this.DefaultStyleKey = typeof(KeyVisual);
|
||||
this.Style = GetStyleSize("TextKeyVisualStyle");
|
||||
}
|
||||
|
||||
protected override void OnApplyTemplate()
|
||||
{
|
||||
IsEnabledChanged -= KeyVisual_IsEnabledChanged;
|
||||
_keyVisual = (KeyVisual)this;
|
||||
_keyPresenter = (ContentPresenter)_keyVisual.GetTemplateChild(KeyPresenter);
|
||||
Update();
|
||||
SetEnabledState();
|
||||
SetErrorState();
|
||||
IsEnabledChanged += KeyVisual_IsEnabledChanged;
|
||||
base.OnApplyTemplate();
|
||||
}
|
||||
|
||||
private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
((KeyVisual)d).Update();
|
||||
}
|
||||
|
||||
private static void OnSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
((KeyVisual)d).Update();
|
||||
}
|
||||
|
||||
private static void OnIsErrorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
((KeyVisual)d).SetErrorState();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_keyVisual == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_keyVisual.Content != null)
|
||||
{
|
||||
if (_keyVisual.Content.GetType() == typeof(string))
|
||||
{
|
||||
_keyVisual.Style = GetStyleSize("TextKeyVisualStyle");
|
||||
_keyVisual._keyPresenter.Content = _keyVisual.Content;
|
||||
}
|
||||
else
|
||||
{
|
||||
_keyVisual.Style = GetStyleSize("IconKeyVisualStyle");
|
||||
|
||||
switch ((int)_keyVisual.Content)
|
||||
{
|
||||
/* We can enable other glyphs in the future
|
||||
case 13: // The Enter key or button.
|
||||
_keyVisual._keyPresenter.Content = "\uE751"; break;
|
||||
|
||||
case 8: // The Back key or button.
|
||||
_keyVisual._keyPresenter.Content = "\uE750"; break;
|
||||
|
||||
case 16: // The right Shift key or button.
|
||||
case 160: // The left Shift key or button.
|
||||
case 161: // The Shift key or button.
|
||||
_keyVisual._keyPresenter.Content = "\uE752"; break; */
|
||||
|
||||
case 38: _keyVisual._keyPresenter.Content = "\uE0E4"; break; // The Up Arrow key or button.
|
||||
case 40: _keyVisual._keyPresenter.Content = "\uE0E5"; break; // The Down Arrow key or button.
|
||||
case 37: _keyVisual._keyPresenter.Content = "\uE0E2"; break; // The Left Arrow key or button.
|
||||
case 39: _keyVisual._keyPresenter.Content = "\uE0E3"; break; // The Right Arrow key or button.
|
||||
|
||||
case 91: // The left Windows key
|
||||
case 92: // The right Windows key
|
||||
PathIcon winIcon = XamlReader.Load(@"<PathIcon xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" Data=""M683 1229H0V546h683v683zm819 0H819V546h683v683zm-819 819H0v-683h683v683zm819 0H819v-683h683v683z"" />") as PathIcon;
|
||||
Viewbox winIconContainer = new Viewbox();
|
||||
winIconContainer.Child = winIcon;
|
||||
winIconContainer.HorizontalAlignment = HorizontalAlignment.Center;
|
||||
winIconContainer.VerticalAlignment = VerticalAlignment.Center;
|
||||
|
||||
double iconDimensions = GetIconSize();
|
||||
winIconContainer.Height = iconDimensions;
|
||||
winIconContainer.Width = iconDimensions;
|
||||
_keyVisual._keyPresenter.Content = winIconContainer;
|
||||
break;
|
||||
default: _keyVisual._keyPresenter.Content = ((VirtualKey)_keyVisual.Content).ToString(); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Style GetStyleSize(string styleName)
|
||||
{
|
||||
if (VisualType == VisualType.Small)
|
||||
{
|
||||
return (Style)App.Current.Resources["Small" + styleName];
|
||||
}
|
||||
else if (VisualType == VisualType.SmallOutline)
|
||||
{
|
||||
return (Style)App.Current.Resources["SmallOutline" + styleName];
|
||||
}
|
||||
else if (VisualType == VisualType.TextOnly)
|
||||
{
|
||||
return (Style)App.Current.Resources["Only" + styleName];
|
||||
}
|
||||
else
|
||||
{
|
||||
return (Style)App.Current.Resources["Default" + styleName];
|
||||
}
|
||||
}
|
||||
|
||||
public double GetIconSize()
|
||||
{
|
||||
if (VisualType == VisualType.Small || VisualType == VisualType.SmallOutline)
|
||||
{
|
||||
return (double)App.Current.Resources["SmallIconSize"];
|
||||
}
|
||||
else
|
||||
{
|
||||
return (double)App.Current.Resources["DefaultIconSize"];
|
||||
}
|
||||
}
|
||||
|
||||
private void KeyVisual_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
SetEnabledState();
|
||||
}
|
||||
|
||||
private void SetErrorState()
|
||||
{
|
||||
VisualStateManager.GoToState(this, IsError ? "Error" : "Default", true);
|
||||
}
|
||||
|
||||
private void SetEnabledState()
|
||||
{
|
||||
VisualStateManager.GoToState(this, IsEnabled ? "Normal" : "Disabled", true);
|
||||
}
|
||||
}
|
||||
|
||||
public enum VisualType
|
||||
{
|
||||
Small,
|
||||
SmallOutline,
|
||||
TextOnly,
|
||||
Large,
|
||||
}
|
||||
}
|
||||
@@ -1,184 +1,66 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls">
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls">
|
||||
|
||||
<Style BasedOn="{StaticResource DefaultKeyVisualStyle}" TargetType="local:KeyVisual" />
|
||||
|
||||
<Style x:Key="DefaultKeyVisualStyle" TargetType="local:KeyVisual">
|
||||
<Setter Property="MinWidth" Value="16" />
|
||||
<Setter Property="AutomationProperties.AccessibilityView" Value="Raw" />
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
<Setter Property="MinHeight" Value="16" />
|
||||
<Setter Property="Background" Value="{ThemeResource SubtleFillColorTransparentBrush}" />
|
||||
<Setter Property="Foreground" Value="{ThemeResource TextFillColorPrimaryBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource ControlStrokeColorDefaultBrush}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="Padding" Value="4,4,4,4" />
|
||||
<Setter Property="FontWeight" Value="Normal" />
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="CornerRadius" Value="2" />
|
||||
<Setter Property="BackgroundSizing" Value="InnerBorderEdge" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<x:Double x:Key="DefaultIconSize">16</x:Double>
|
||||
<x:Double x:Key="SmallIconSize">12</x:Double>
|
||||
<Style x:Key="DefaultTextKeyVisualStyle" TargetType="controls:KeyVisual">
|
||||
<Setter Property="MinWidth" Value="56" />
|
||||
<Setter Property="MinHeight" Value="48" />
|
||||
<Setter Property="Background" Value="{ThemeResource AccentButtonBackground}" />
|
||||
<Setter Property="Foreground" Value="{ThemeResource AccentButtonForeground}" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource AccentButtonBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}" />
|
||||
<Setter Property="Padding" Value="16,8,16,8" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="local:KeyVisual">
|
||||
<Grid
|
||||
x:Name="KeyHolder"
|
||||
MinWidth="{TemplateBinding MinWidth}"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Grid.BackgroundTransition>
|
||||
<BrushTransition Duration="0:0:0.083" />
|
||||
</Grid.BackgroundTransition>
|
||||
<local:KeyCharPresenter
|
||||
x:Name="KeyPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content="{TemplateBinding Content}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontWeight="{TemplateBinding FontWeight}"
|
||||
Foreground="{TemplateBinding Foreground}" />
|
||||
<ControlTemplate TargetType="controls:KeyVisual">
|
||||
<Grid>
|
||||
<Grid>
|
||||
<Rectangle
|
||||
x:Name="ContentHolder"
|
||||
Height="{TemplateBinding Height}"
|
||||
MinWidth="{TemplateBinding MinWidth}"
|
||||
Fill="{TemplateBinding Background}"
|
||||
RadiusX="4"
|
||||
RadiusY="4"
|
||||
Stroke="{TemplateBinding BorderBrush}"
|
||||
StrokeThickness="{TemplateBinding BorderThickness}" />
|
||||
<ContentPresenter
|
||||
x:Name="KeyPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Content}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontWeight="{TemplateBinding FontWeight}"
|
||||
Foreground="{TemplateBinding Foreground}" />
|
||||
</Grid>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="KeyHolder.Background" Value="{ThemeResource SubtleFillColorTransparentBrush}" />
|
||||
<Setter Target="KeyHolder.BorderBrush" Value="{ThemeResource CardStrokeColorDefaultSolidBrush}" />
|
||||
<Setter Target="KeyPresenter.Foreground" Value="{ThemeResource ControlStrokeColorDefaultBrush}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Invalid">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="KeyHolder.Background" Value="{ThemeResource SystemFillColorCriticalBackgroundBrush}" />
|
||||
<Setter Target="KeyHolder.BorderBrush" Value="{ThemeResource SystemFillColorCriticalBrush}" />
|
||||
<Setter Target="KeyHolder.BorderThickness" Value="2" />
|
||||
<Setter Target="KeyPresenter.Foreground" Value="{ThemeResource SystemFillColorCriticalBrush}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
x:Key="SubtleKeyVisualStyle"
|
||||
BasedOn="{StaticResource DefaultKeyVisualStyle}"
|
||||
TargetType="local:KeyVisual">
|
||||
<Setter Property="Background" Value="{ThemeResource SubtleFillColorTransparentBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource SubtleFillColorTransparentBrush}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="local:KeyVisual">
|
||||
<Grid
|
||||
x:Name="KeyHolder"
|
||||
MinWidth="{TemplateBinding MinWidth}"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Grid.BackgroundTransition>
|
||||
<BrushTransition Duration="0:0:0.083" />
|
||||
</Grid.BackgroundTransition>
|
||||
<local:KeyCharPresenter
|
||||
x:Name="KeyPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content="{TemplateBinding Content}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontWeight="{TemplateBinding FontWeight}"
|
||||
Foreground="{TemplateBinding Foreground}" />
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="KeyPresenter.Foreground" Value="{ThemeResource TextFillColorDisabledBrush}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Invalid">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="KeyPresenter.Foreground" Value="{ThemeResource SystemFillColorCriticalBrush}" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
x:Key="AccentKeyVisualStyle"
|
||||
BasedOn="{StaticResource DefaultKeyVisualStyle}"
|
||||
TargetType="local:KeyVisual">
|
||||
|
||||
<Setter Property="Background" Value="{ThemeResource AccentFillColorDefaultBrush}" />
|
||||
<Setter Property="Foreground" Value="{ThemeResource TextOnAccentFillColorPrimaryBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource AccentControlElevationBorderBrush}" />
|
||||
<Setter Property="BackgroundSizing" Value="OuterBorderEdge" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="local:KeyVisual">
|
||||
<Grid
|
||||
x:Name="KeyHolder"
|
||||
MinWidth="{TemplateBinding MinWidth}"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Grid.BackgroundTransition>
|
||||
<BrushTransition Duration="0:0:0.083" />
|
||||
</Grid.BackgroundTransition>
|
||||
<local:KeyCharPresenter
|
||||
x:Name="KeyPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontWeight="{TemplateBinding FontWeight}"
|
||||
Foreground="{TemplateBinding Foreground}" />
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="KeyHolder.Background" Value="{ThemeResource AccentButtonBackgroundDisabled}" />
|
||||
<Setter Target="KeyHolder.BorderBrush" Value="{ThemeResource AccentButtonBorderBrushDisabled}" />
|
||||
<Setter Target="ContentHolder.Fill" Value="{ThemeResource AccentButtonBackgroundDisabled}" />
|
||||
<Setter Target="KeyPresenter.Foreground" Value="{ThemeResource AccentButtonForegroundDisabled}" />
|
||||
<Setter Target="ContentHolder.Stroke" Value="{ThemeResource AccentButtonBorderBrushDisabled}" />
|
||||
<!--<Setter Target="ContentHolder.StrokeThickness" Value="{TemplateBinding BorderThickness}" />-->
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Invalid">
|
||||
</VisualStateGroup>
|
||||
<VisualStateGroup x:Name="StateStates">
|
||||
<VisualState x:Name="Default" />
|
||||
<VisualState x:Name="Error">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="KeyHolder.Background" Value="{ThemeResource SystemFillColorCriticalBackgroundBrush}" />
|
||||
<Setter Target="KeyHolder.BorderBrush" Value="{ThemeResource SystemFillColorCriticalBrush}" />
|
||||
<Setter Target="KeyHolder.BorderThickness" Value="2" />
|
||||
<Setter Target="KeyPresenter.Foreground" Value="{ThemeResource SystemFillColorCriticalBrush}" />
|
||||
<Setter Target="ContentHolder.Fill" Value="{ThemeResource InfoBarErrorSeverityBackgroundBrush}" />
|
||||
<Setter Target="KeyPresenter.Foreground" Value="{ThemeResource InfoBarErrorSeverityIconBackground}" />
|
||||
<Setter Target="ContentHolder.Stroke" Value="{ThemeResource InfoBarErrorSeverityIconBackground}" />
|
||||
<Setter Target="ContentHolder.StrokeThickness" Value="2" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
@@ -188,4 +70,105 @@
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
|
||||
<Style
|
||||
x:Key="SmallTextKeyVisualStyle"
|
||||
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
|
||||
TargetType="controls:KeyVisual">
|
||||
<Setter Property="MinWidth" Value="40" />
|
||||
<Setter Property="Height" Value="36" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="Padding" Value="12,0,12,2" />
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
x:Key="SmallOutlineTextKeyVisualStyle"
|
||||
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
|
||||
TargetType="controls:KeyVisual">
|
||||
<Setter Property="MinWidth" Value="40" />
|
||||
<Setter Property="Background" Value="{ThemeResource ButtonBackground}" />
|
||||
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" />
|
||||
<Setter Property="Height" Value="36" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="Padding" Value="8,0,8,2" />
|
||||
<Setter Property="FontSize" Value="13" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
|
||||
|
||||
<Style
|
||||
x:Key="DefaultIconKeyVisualStyle"
|
||||
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
|
||||
TargetType="controls:KeyVisual">
|
||||
<Setter Property="MinWidth" Value="56" />
|
||||
<Setter Property="MinHeight" Value="48" />
|
||||
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
|
||||
<Setter Property="Padding" Value="16,8,16,8" />
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
x:Key="SmallIconKeyVisualStyle"
|
||||
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
|
||||
TargetType="controls:KeyVisual">
|
||||
<Setter Property="MinWidth" Value="40" />
|
||||
<Setter Property="Height" Value="36" />
|
||||
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
|
||||
<Setter Property="FontWeight" Value="Normal" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="FontSize" Value="10" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
x:Key="SmallOutlineIconKeyVisualStyle"
|
||||
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
|
||||
TargetType="controls:KeyVisual">
|
||||
<Setter Property="MinWidth" Value="40" />
|
||||
<Setter Property="Background" Value="{ThemeResource ButtonBackground}" />
|
||||
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" />
|
||||
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
|
||||
<Setter Property="Height" Value="36" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="FontSize" Value="9" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
x:Key="OnlyTextKeyVisualStyle"
|
||||
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
|
||||
TargetType="controls:KeyVisual">
|
||||
<Setter Property="MinHeight" Value="12" />
|
||||
<Setter Property="MinWidth" Value="12" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="FontWeight" Value="Normal" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
x:Key="OnlyIconKeyVisualStyle"
|
||||
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
|
||||
TargetType="controls:KeyVisual">
|
||||
<Setter Property="MinHeight" Value="10" />
|
||||
<Setter Property="MinWidth" Value="10" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
|
||||
<Setter Property="FontWeight" Value="Normal" />
|
||||
<Setter Property="Padding" Value="0,0,0,3" />
|
||||
<!--<Setter Property="FontSize" Value="9" />-->
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
@@ -1,166 +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 Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Windows.System;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
{
|
||||
[TemplatePart(Name = KeyPresenter, Type = typeof(KeyCharPresenter))]
|
||||
[TemplateVisualState(Name = NormalState, GroupName = "CommonStates")]
|
||||
[TemplateVisualState(Name = DisabledState, GroupName = "CommonStates")]
|
||||
[TemplateVisualState(Name = InvalidState, GroupName = "CommonStates")]
|
||||
public sealed partial class KeyVisual : Control
|
||||
{
|
||||
private const string KeyPresenter = "KeyPresenter";
|
||||
private const string NormalState = "Normal";
|
||||
private const string DisabledState = "Disabled";
|
||||
private const string InvalidState = "Invalid";
|
||||
private KeyCharPresenter _keyPresenter;
|
||||
|
||||
public object Content
|
||||
{
|
||||
get => (object)GetValue(ContentProperty);
|
||||
set => SetValue(ContentProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(nameof(Content), typeof(object), typeof(KeyVisual), new PropertyMetadata(default(string), OnContentChanged));
|
||||
|
||||
public bool IsInvalid
|
||||
{
|
||||
get => (bool)GetValue(IsInvalidProperty);
|
||||
set => SetValue(IsInvalidProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsInvalidProperty = DependencyProperty.Register(nameof(IsInvalid), typeof(bool), typeof(KeyVisual), new PropertyMetadata(false, OnIsInvalidChanged));
|
||||
|
||||
public bool RenderKeyAsGlyph
|
||||
{
|
||||
get => (bool)GetValue(RenderKeyAsGlyphProperty);
|
||||
set => SetValue(RenderKeyAsGlyphProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty RenderKeyAsGlyphProperty = DependencyProperty.Register(nameof(RenderKeyAsGlyph), typeof(bool), typeof(KeyVisual), new PropertyMetadata(false, OnContentChanged));
|
||||
|
||||
public KeyVisual()
|
||||
{
|
||||
this.DefaultStyleKey = typeof(KeyVisual);
|
||||
}
|
||||
|
||||
protected override void OnApplyTemplate()
|
||||
{
|
||||
IsEnabledChanged -= KeyVisual_IsEnabledChanged;
|
||||
_keyPresenter = (KeyCharPresenter)this.GetTemplateChild(KeyPresenter);
|
||||
Update();
|
||||
SetVisualStates();
|
||||
IsEnabledChanged += KeyVisual_IsEnabledChanged;
|
||||
base.OnApplyTemplate();
|
||||
}
|
||||
|
||||
private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
((KeyVisual)d).SetVisualStates();
|
||||
}
|
||||
|
||||
private static void OnIsInvalidChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
((KeyVisual)d).SetVisualStates();
|
||||
}
|
||||
|
||||
private void SetVisualStates()
|
||||
{
|
||||
if (this != null)
|
||||
{
|
||||
if (IsInvalid)
|
||||
{
|
||||
VisualStateManager.GoToState(this, InvalidState, true);
|
||||
}
|
||||
else if (!IsEnabled)
|
||||
{
|
||||
VisualStateManager.GoToState(this, DisabledState, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
VisualStateManager.GoToState(this, NormalState, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Content == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Content is string)
|
||||
{
|
||||
_keyPresenter.Style = (Style)Application.Current.Resources["DefaultKeyCharPresenterStyle"];
|
||||
return;
|
||||
}
|
||||
|
||||
if (Content is int keyCode)
|
||||
{
|
||||
VirtualKey virtualKey = (VirtualKey)keyCode;
|
||||
switch (virtualKey)
|
||||
{
|
||||
case VirtualKey.Enter:
|
||||
SetGlyphOrText("\uE751", virtualKey);
|
||||
break;
|
||||
|
||||
case VirtualKey.Back:
|
||||
SetGlyphOrText("\uE750", virtualKey);
|
||||
break;
|
||||
|
||||
case VirtualKey.Shift:
|
||||
case (VirtualKey)160: // Left Shift
|
||||
case (VirtualKey)161: // Right Shift
|
||||
SetGlyphOrText("\uE752", virtualKey);
|
||||
break;
|
||||
|
||||
case VirtualKey.Up:
|
||||
_keyPresenter.Content = "\uE0E4";
|
||||
break;
|
||||
|
||||
case VirtualKey.Down:
|
||||
_keyPresenter.Content = "\uE0E5";
|
||||
break;
|
||||
|
||||
case VirtualKey.Left:
|
||||
_keyPresenter.Content = "\uE0E2";
|
||||
break;
|
||||
|
||||
case VirtualKey.Right:
|
||||
_keyPresenter.Content = "\uE0E3";
|
||||
break;
|
||||
|
||||
case VirtualKey.LeftWindows:
|
||||
case VirtualKey.RightWindows:
|
||||
_keyPresenter.Style = (Style)Application.Current.Resources["WindowsKeyCharPresenterStyle"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetGlyphOrText(string glyph, VirtualKey key)
|
||||
{
|
||||
if (RenderKeyAsGlyph)
|
||||
{
|
||||
_keyPresenter.Content = glyph;
|
||||
_keyPresenter.Style = (Style)Application.Current.Resources["GlyphKeyCharPresenterStyle"];
|
||||
}
|
||||
else
|
||||
{
|
||||
_keyPresenter.Content = key.ToString();
|
||||
_keyPresenter.Style = (Style)Application.Current.Resources["DefaultKeyCharPresenterStyle"];
|
||||
}
|
||||
}
|
||||
|
||||
private void KeyVisual_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
SetVisualStates();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,8 @@
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content="{Binding}"
|
||||
IsTabStop="False" />
|
||||
IsTabStop="False"
|
||||
VisualType="SmallOutline" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
@@ -6,12 +6,20 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:tk7controls="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters"
|
||||
Loaded="UserControl_Loaded"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<UserControl.Resources>
|
||||
<x:Double x:Key="PageMaxWidth">1000</x:Double>
|
||||
<x:Double x:Key="PageHeaderMaxWidth">1020</x:Double>
|
||||
<tkconverters:DoubleToVisibilityConverter
|
||||
x:Name="doubleToVisibilityConverter"
|
||||
FalseValue="Collapsed"
|
||||
GreaterThan="0"
|
||||
TrueValue="Visible" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid Padding="20,0,0,0" RowSpacing="24">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -54,7 +62,7 @@
|
||||
MaxWidth="160"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
CornerRadius="{StaticResource OverlayCornerRadius}">
|
||||
CornerRadius="4">
|
||||
<Image AutomationProperties.AccessibilityView="Raw">
|
||||
<Image.Source>
|
||||
<BitmapImage UriSource="{x:Bind ModuleImageSource}" />
|
||||
@@ -105,7 +113,7 @@
|
||||
MaxWidth="{StaticResource PageMaxWidth}"
|
||||
AutomationProperties.Name="{x:Bind SecondaryLinksHeader}"
|
||||
Orientation="Vertical"
|
||||
Visibility="{x:Bind SecondaryLinks.Count, Converter={StaticResource DoubleToVisibilityConverter}}">
|
||||
Visibility="{x:Bind SecondaryLinks.Count, Converter={StaticResource doubleToVisibilityConverter}}">
|
||||
<TextBlock
|
||||
Margin="2,8,0,0"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
|
||||
@@ -11,74 +11,43 @@
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid HorizontalAlignment="Right">
|
||||
<Button
|
||||
x:Name="EditButton"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Right"
|
||||
Click="OpenDialogButton_Click"
|
||||
Style="{StaticResource SubtleButtonStyle}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<ItemsControl
|
||||
x:Name="PreviewKeysControl"
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
IsEnabled="{Binding ElementName=EditButton, Path=IsEnabled}"
|
||||
IsTabStop="False"
|
||||
Visibility="Collapsed">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="4" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls:KeyVisual
|
||||
Padding="12,8,12,8"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content="{Binding}"
|
||||
CornerRadius="{StaticResource ControlCornerRadius}"
|
||||
FontWeight="SemiBold"
|
||||
IsTabStop="False"
|
||||
Style="{StaticResource AccentKeyVisualStyle}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="EditButton"
|
||||
Padding="0"
|
||||
Click="OpenDialogButton_Click"
|
||||
CornerRadius="8">
|
||||
<StackPanel
|
||||
x:Name="PlaceholderPanel"
|
||||
Padding="8,4"
|
||||
BorderThickness="1"
|
||||
CornerRadius="{StaticResource ControlCornerRadius}"
|
||||
Margin="12,6,12,6"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<!--<FontIcon
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
FontSize="12"
|
||||
Glyph="" />-->
|
||||
<TextBlock
|
||||
x:Uid="ConfigureShortcutText"
|
||||
Spacing="16">
|
||||
<ItemsControl
|
||||
x:Name="PreviewKeysControl"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
|
||||
IsEnabled="{Binding ElementName=EditButton, Path=IsEnabled}"
|
||||
IsTabStop="False">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="4" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls:KeyVisual
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content="{Binding}"
|
||||
IsTabStop="False"
|
||||
VisualType="Small" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<FontIcon
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="16"
|
||||
Glyph="" />
|
||||
</StackPanel>
|
||||
<FontIcon
|
||||
Margin="0,0,4,0"
|
||||
AutomationProperties.Name=""
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
FontSize="14"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Glyph="" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Configured">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="PlaceholderPanel.Visibility" Value="Collapsed" />
|
||||
<Setter Target="PreviewKeysControl.Visibility" Value="Visible" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -3,6 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
|
||||
using CommunityToolkit.WinUI;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
@@ -10,7 +11,6 @@ using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Automation;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using Microsoft.Windows.ApplicationModel.Resources;
|
||||
using Windows.System;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
@@ -36,8 +36,6 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
|
||||
public static readonly DependencyProperty AllowDisableProperty = DependencyProperty.Register("AllowDisable", typeof(bool), typeof(ShortcutControl), new PropertyMetadata(false, OnAllowDisableChanged));
|
||||
|
||||
private static ResourceLoader resourceLoader = Helpers.ResourceLoaderInstance.ResourceLoader;
|
||||
|
||||
private static void OnAllowDisableChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var me = d as ShortcutControl;
|
||||
@@ -52,6 +50,8 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
return;
|
||||
}
|
||||
|
||||
var resourceLoader = Helpers.ResourceLoaderInstance.ResourceLoader;
|
||||
|
||||
var newValue = (bool)(e?.NewValue ?? false);
|
||||
|
||||
var text = newValue ? resourceLoader.GetString("Activation_Shortcut_With_Disable_Description") : resourceLoader.GetString("Activation_Shortcut_Description");
|
||||
@@ -103,7 +103,8 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
{
|
||||
hotkeySettings = value;
|
||||
SetValue(HotkeySettingsProperty, value);
|
||||
SetKeys();
|
||||
PreviewKeysControl.ItemsSource = HotkeySettings.GetKeysList();
|
||||
AutomationProperties.SetHelpText(EditButton, HotkeySettings.ToString());
|
||||
c.Keys = HotkeySettings.GetKeysList();
|
||||
}
|
||||
}
|
||||
@@ -117,6 +118,8 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
this.Unloaded += ShortcutControl_Unloaded;
|
||||
this.Loaded += ShortcutControl_Loaded;
|
||||
|
||||
var resourceLoader = Helpers.ResourceLoaderInstance.ResourceLoader;
|
||||
|
||||
// We create the Dialog in C# because doing it in XAML is giving WinUI/XAML Island bugs when using dark theme.
|
||||
shortcutDialog = new ContentDialog
|
||||
{
|
||||
@@ -430,9 +433,11 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
hotkeySettings = null;
|
||||
|
||||
SetValue(HotkeySettingsProperty, hotkeySettings);
|
||||
SetKeys();
|
||||
PreviewKeysControl.ItemsSource = HotkeySettings.GetKeysList();
|
||||
|
||||
lastValidSettings = hotkeySettings;
|
||||
|
||||
AutomationProperties.SetHelpText(EditButton, HotkeySettings.ToString());
|
||||
shortcutDialog.Hide();
|
||||
}
|
||||
|
||||
@@ -443,7 +448,8 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
HotkeySettings = lastValidSettings with { };
|
||||
}
|
||||
|
||||
SetKeys();
|
||||
PreviewKeysControl.ItemsSource = hotkeySettings.GetKeysList();
|
||||
AutomationProperties.SetHelpText(EditButton, HotkeySettings.ToString());
|
||||
shortcutDialog.Hide();
|
||||
}
|
||||
|
||||
@@ -456,7 +462,9 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
|
||||
var empty = new HotkeySettings();
|
||||
HotkeySettings = empty;
|
||||
SetKeys();
|
||||
|
||||
PreviewKeysControl.ItemsSource = HotkeySettings.GetKeysList();
|
||||
AutomationProperties.SetHelpText(EditButton, HotkeySettings.ToString());
|
||||
shortcutDialog.Hide();
|
||||
}
|
||||
|
||||
@@ -517,22 +525,5 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void SetKeys()
|
||||
{
|
||||
var keys = HotkeySettings.GetKeysList();
|
||||
|
||||
if (keys != null && keys.Count > 0)
|
||||
{
|
||||
VisualStateManager.GoToState(this, "Configured", true);
|
||||
PreviewKeysControl.ItemsSource = keys;
|
||||
AutomationProperties.SetHelpText(EditButton, HotkeySettings.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
VisualStateManager.GoToState(this, "Normal", true);
|
||||
AutomationProperties.SetHelpText(EditButton, resourceLoader.GetString("ConfigureShortcut"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
<RowDefinition MinHeight="110" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" />
|
||||
|
||||
<ItemsControl
|
||||
x:Name="KeysControl"
|
||||
Grid.Row="1"
|
||||
@@ -31,15 +34,12 @@
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls:KeyVisual
|
||||
Padding="20,16"
|
||||
Height="56"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content="{Binding}"
|
||||
CornerRadius="{StaticResource ControlCornerRadius}"
|
||||
FontSize="16"
|
||||
FontWeight="SemiBold"
|
||||
IsInvalid="{Binding ElementName=ShortcutContentControl, Path=IsError, Mode=OneWay}"
|
||||
IsError="{Binding ElementName=ShortcutContentControl, Path=IsError, Mode=OneWay}"
|
||||
IsTabStop="False"
|
||||
Style="{StaticResource AccentKeyVisualStyle}" />
|
||||
VisualType="Large" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
@@ -51,12 +51,14 @@
|
||||
Orientation="Vertical"
|
||||
Spacing="8">
|
||||
<Grid Height="62">
|
||||
|
||||
<InfoBar
|
||||
x:Uid="InvalidShortcut"
|
||||
IsClosable="False"
|
||||
IsOpen="{Binding ElementName=ShortcutContentControl, Path=IsError, Mode=OneWay}"
|
||||
IsTabStop="{Binding ElementName=ShortcutContentControl, Path=IsError, Mode=OneWay}"
|
||||
Severity="Error" />
|
||||
|
||||
<InfoBar
|
||||
x:Uid="WarningShortcutAltGr"
|
||||
IsClosable="False"
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls:KeyVisual
|
||||
Padding="12,8,12,8"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content="{Binding}"
|
||||
FontSize="12"
|
||||
IsTabStop="False" />
|
||||
IsTabStop="False"
|
||||
VisualType="SmallOutline" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
@@ -7,8 +7,17 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters"
|
||||
xmlns:viewModels="using:Microsoft.PowerToys.Settings.UI.ViewModels"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Page.Resources>
|
||||
<tkconverters:BoolNegationConverter x:Key="BoolNegationConverter" />
|
||||
<tkconverters:BoolToVisibilityConverter
|
||||
x:Key="BoolToInvertedVisibilityConverter"
|
||||
FalseValue="Visible"
|
||||
TrueValue="Collapsed" />
|
||||
</Page.Resources>
|
||||
<Grid Background="{ThemeResource LayerOnAcrylicFillColorDefaultBrush}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -80,7 +89,7 @@
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Glyph=""
|
||||
Visibility="{x:Bind IsLocked, Converter={StaticResource ReverseBoolToVisibilityConverter}, ConverterParameter=True, Mode=OneWay}">
|
||||
Visibility="{x:Bind IsLocked, Converter={StaticResource BoolToInvertedVisibilityConverter}, ConverterParameter=True, Mode=OneWay}">
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock x:Uid="GPO_SettingIsManaged_ToolTip" TextWrapping="WrapWholeWords" />
|
||||
</ToolTipService.ToolTip>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<Setter Property="Height" Value="32" />
|
||||
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
|
||||
</Style>
|
||||
|
||||
<tkconverters:StringVisibilityConverter x:Key="StringVisibilityConverter" />
|
||||
</Page.Resources>
|
||||
<Grid>
|
||||
@@ -109,7 +110,7 @@
|
||||
</Grid>
|
||||
<Grid Grid.Row="2">
|
||||
<InfoBar
|
||||
x:Uid="UpdateAvailableInfoBar"
|
||||
x:Uid="UpdateAvailable"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind ViewModel.IsUpdateAvailable, Mode=OneWay}"
|
||||
Severity="Success" />
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="ms-appx:///SettingsXAML/Controls/SettingsGroup/SettingsGroup.xaml" />
|
||||
<ResourceDictionary Source="ms-appx:///SettingsXAML/Controls/IsEnabledTextBlock.xaml" />
|
||||
<ResourceDictionary Source="ms-appx:///SettingsXAML/Controls/FlyoutMenuButton.xaml" />
|
||||
<ResourceDictionary Source="ms-appx:///SettingsXAML/Controls/IsEnabledTextBlock/IsEnabledTextBlock.xaml" />
|
||||
<ResourceDictionary Source="ms-appx:///SettingsXAML/Controls/FlyoutMenuButton/FlyoutMenuButton.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
|
||||
@@ -10,6 +10,13 @@
|
||||
xmlns:ui="using:CommunityToolkit.WinUI"
|
||||
AutomationProperties.LandmarkType="Main"
|
||||
mc:Ignorable="d">
|
||||
<Page.Resources>
|
||||
<tkconverters:BoolToVisibilityConverter
|
||||
x:Key="BoolToInvertedVisibilityConverter"
|
||||
FalseValue="Visible"
|
||||
TrueValue="Collapsed" />
|
||||
<tkconverters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
|
||||
</Page.Resources>
|
||||
<controls:SettingsPageControl x:Uid="CmdNotFound" ModuleImageSource="ms-appx:///Assets/Settings/Modules/CmdNotFound.png">
|
||||
<controls:SettingsPageControl.ModuleContent>
|
||||
<StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical">
|
||||
|
||||
@@ -14,8 +14,14 @@
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:ColorPickerViewModel}"
|
||||
AutomationProperties.LandmarkType="Main"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Page.Resources>
|
||||
<tkconverters:BoolToVisibilityConverter x:Key="BoolToVis" />
|
||||
</Page.Resources>
|
||||
|
||||
<controls:SettingsPageControl x:Uid="ColorPicker" ModuleImageSource="ms-appx:///Assets/Settings/Modules/ColorPicker.png">
|
||||
<controls:SettingsPageControl.ModuleContent>
|
||||
|
||||
<StackPanel
|
||||
x:Name="ColorPickerView"
|
||||
ChildrenTransitions="{StaticResource SettingsCardsAnimations}"
|
||||
|
||||
@@ -9,357 +9,497 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:tkconverters="using:CommunityToolkit.WinUI.Converters"
|
||||
xmlns:viewmodels="using:Microsoft.PowerToys.Settings.UI.ViewModels"
|
||||
xmlns:viewModels="using:Microsoft.PowerToys.Settings.UI.ViewModels"
|
||||
AutomationProperties.LandmarkType="Main"
|
||||
DataContext="DashboardViewModel"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Page.Resources>
|
||||
<DataTemplate x:Key="KeyVisualTemplate">
|
||||
<controls:KeyVisual
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content="{Binding}"
|
||||
IsTabStop="False"
|
||||
VisualType="TextOnly" />
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="CommaTemplate">
|
||||
<StackPanel Background="{ThemeResource SystemFillColorSolidAttentionBackground}">
|
||||
<TextBlock
|
||||
Margin="4,0"
|
||||
VerticalAlignment="Bottom"
|
||||
Text="," />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
<converters:KeyVisualTemplateSelector
|
||||
x:Key="KeyVisualTemplateSelector"
|
||||
CommaTemplate="{StaticResource CommaTemplate}"
|
||||
KeyVisualTemplate="{StaticResource KeyVisualTemplate}" />
|
||||
<converters:ModuleItemTemplateSelector
|
||||
x:Key="ModuleItemTemplateSelector"
|
||||
ActivationTemplate="{StaticResource ModuleItemActivationTemplate}"
|
||||
ShortcutTemplate="{StaticResource ModuleItemShortcutTemplate}" />
|
||||
<DataTemplate x:Key="ModuleItemShortcutTemplate" x:DataType="viewmodels:DashboardModuleShortcutItem">
|
||||
<Grid MinHeight="36" ColumnSpacing="12">
|
||||
ButtonTemplate="{StaticResource ModuleItemButtonTemplate}"
|
||||
KBMTemplate="{StaticResource ModuleItemKBMTemplate}"
|
||||
ShortcutTemplate="{StaticResource ModuleItemShortcutTemplate}"
|
||||
TextTemplate="{StaticResource ModuleItemTextTemplate}" />
|
||||
<tkconverters:CollectionVisibilityConverter x:Key="CollectionVisibilityConverter" />
|
||||
<Style x:Name="KeysListViewContainerStyle" TargetType="ListViewItem">
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
</Style>
|
||||
<converters:UpdateStateToBoolConverter x:Key="UpdateStateToBoolConverter" />
|
||||
<tkconverters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
|
||||
<tkconverters:BoolNegationConverter x:Key="BoolNegationConverter" />
|
||||
<tkconverters:BoolToVisibilityConverter
|
||||
x:Key="BoolToInvertedVisibilityConverter"
|
||||
FalseValue="Visible"
|
||||
TrueValue="Collapsed" />
|
||||
<DataTemplate x:Key="OriginalKeyTemplate" x:DataType="x:String">
|
||||
<controls:KeyVisual Content="{Binding}" VisualType="SmallOutline" />
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="RemappedKeyTemplate" x:DataType="x:String">
|
||||
<controls:KeyVisual Content="{Binding}" VisualType="Small" />
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="ModuleItemTextTemplate" x:DataType="viewModels:DashboardModuleTextItem">
|
||||
<TextBlock
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="{x:Bind Label, Mode=OneWay}"
|
||||
TextWrapping="WrapWholeWords" />
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="ModuleItemButtonTemplate" x:DataType="viewModels:DashboardModuleButtonItem">
|
||||
<Button
|
||||
HorizontalAlignment="Stretch"
|
||||
Click="{x:Bind ButtonClickHandler, Mode=OneWay}"
|
||||
Content="{x:Bind ButtonTitle}" />
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="ModuleItemShortcutTemplate" x:DataType="viewModels:DashboardModuleShortcutItem">
|
||||
<Grid ColumnSpacing="12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="140" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ItemsControl
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Left"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
IsTabStop="False"
|
||||
ItemsSource="{x:Bind Shortcut, Mode=OneWay}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="4" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls:KeyVisual
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content="{Binding}"
|
||||
FontSize="12"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
IsTabStop="False"
|
||||
RenderKeyAsGlyph="True" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<Border
|
||||
Padding="8,4"
|
||||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
||||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="{StaticResource ControlCornerRadius}">
|
||||
<ItemsControl
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
IsTabStop="False"
|
||||
ItemsSource="{x:Bind Shortcut, Mode=TwoWay}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="12" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls:KeyVisual
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content="{Binding}"
|
||||
IsTabStop="False"
|
||||
VisualType="TextOnly" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Border>
|
||||
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="{x:Bind Label, Mode=OneWay}"
|
||||
TextWrapping="WrapWholeWords" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="ModuleItemActivationTemplate" x:DataType="viewmodels:DashboardModuleActivationItem">
|
||||
<Grid MinHeight="36" ColumnSpacing="12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="140" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{x:Bind Label, Mode=OneWay}"
|
||||
TextWrapping="WrapWholeWords" />
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Text="{x:Bind Activation, Mode=OneWay}"
|
||||
TextWrapping="WrapWholeWords" />
|
||||
</Grid>
|
||||
<DataTemplate x:Key="ModuleItemKBMTemplate" x:DataType="viewModels:DashboardModuleKBMItem">
|
||||
<Button x:Uid="DashboardKBMShowMappingsButton" HorizontalAlignment="Stretch">
|
||||
<Button.Flyout>
|
||||
<Flyout
|
||||
x:Name="DetailsFlyout"
|
||||
Placement="Bottom"
|
||||
ShouldConstrainToRootBounds="False">
|
||||
<StackPanel Orientation="Vertical" Spacing="4">
|
||||
<ItemsControl ItemsSource="{x:Bind RemapKeys, Mode=OneWay}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Spacing="4" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="Lib:KeysDataModel">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border
|
||||
Padding="8,4"
|
||||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
||||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="{StaticResource ControlCornerRadius}">
|
||||
<ItemsControl
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
IsTabStop="False"
|
||||
ItemsSource="{x:Bind GetMappedOriginalKeys()}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="12" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls:KeyVisual
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content="{Binding}"
|
||||
IsTabStop="False"
|
||||
VisualType="TextOnly" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Border>
|
||||
<controls:IsEnabledTextBlock
|
||||
x:Uid="To"
|
||||
Margin="8,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource SecondaryIsEnabledTextBlockStyle}" />
|
||||
<Border
|
||||
Padding="8,4"
|
||||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
||||
BorderBrush="{ThemeResource AccentFillColorDefaultBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="{StaticResource ControlCornerRadius}">
|
||||
<ItemsControl
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
IsTabStop="False"
|
||||
ItemsSource="{x:Bind GetMappedNewRemapKeys(15)}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="12" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls:KeyVisual
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content="{Binding}"
|
||||
FontSize="12"
|
||||
Foreground="{ThemeResource AccentFillColorDefaultBrush}"
|
||||
IsTabStop="False"
|
||||
VisualType="TextOnly" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<ItemsControl ItemsSource="{x:Bind RemapShortcuts, Mode=OneWay}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Spacing="4" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="Lib:AppSpecificKeysDataModel">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border
|
||||
Padding="8,0"
|
||||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
||||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="{StaticResource ControlCornerRadius}">
|
||||
<ItemsControl
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
IsTabStop="False"
|
||||
ItemTemplateSelector="{StaticResource KeyVisualTemplateSelector}"
|
||||
ItemsSource="{x:Bind GetMappedOriginalKeysWithSplitChord()}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="12" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
</Border>
|
||||
<controls:IsEnabledTextBlock
|
||||
x:Uid="To"
|
||||
Margin="8,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource SecondaryIsEnabledTextBlockStyle}"
|
||||
Visibility="{x:Bind Path=IsOpenUriOrIsRunProgram, Mode=OneWay, Converter={StaticResource BoolToInvertedVisibilityConverter}}" />
|
||||
<controls:IsEnabledTextBlock
|
||||
x:Uid="Starts"
|
||||
Margin="8,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource SecondaryIsEnabledTextBlockStyle}"
|
||||
Visibility="{x:Bind Path=IsOpenUriOrIsRunProgram, Mode=OneWay}" />
|
||||
<Border
|
||||
Padding="8,4"
|
||||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
||||
BorderBrush="{ThemeResource AccentFillColorDefaultBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="{StaticResource ControlCornerRadius}">
|
||||
<ItemsControl
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
IsTabStop="False"
|
||||
ItemsSource="{x:Bind GetMappedNewRemapKeys(15)}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" Spacing="12" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls:KeyVisual
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Content="{Binding}"
|
||||
Foreground="{ThemeResource AccentFillColorDefaultBrush}"
|
||||
IsTabStop="False"
|
||||
VisualType="TextOnly" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Border>
|
||||
<TextBlock
|
||||
Margin="4,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{ThemeResource AccentFillColorDefaultBrush}"
|
||||
Text="{x:Bind TargetApp}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</Flyout>
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</Page.Resources>
|
||||
<Grid Margin="16,0,0,0" RowSpacing="12">
|
||||
<Grid Margin="16,0,0,0" RowSpacing="24">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock
|
||||
x:Uid="DashboardTitle"
|
||||
MaxWidth="{StaticResource PageMaxWidth}"
|
||||
Margin="1,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource TitleTextBlockStyle}" />
|
||||
<Grid
|
||||
Grid.Row="1"
|
||||
MaxWidth="{StaticResource PageMaxWidth}"
|
||||
Padding="0,0,20,0"
|
||||
ColumnSpacing="16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Button
|
||||
Padding="0,0,8,0"
|
||||
AutomationProperties.Name="WhatsNewButton"
|
||||
Click="WhatsNewButton_Click"
|
||||
Style="{StaticResource SubtleButtonStyle}">
|
||||
<Grid ColumnSpacing="16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid CornerRadius="{StaticResource OverlayCornerRadius}">
|
||||
<Image
|
||||
Width="120"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Source="ms-appx:///Assets/Settings/Modules/PT.png" />
|
||||
<Grid Background="{ThemeResource SmokeFillColorDefaultBrush}" />
|
||||
</Grid>
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Vertical">
|
||||
<TextBlock x:Uid="LearnWhatsNew" FontWeight="SemiBold" />
|
||||
<TextBlock
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="{x:Bind ViewModel.PowerToysVersion, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Button>
|
||||
<StackPanel
|
||||
x:Name="TopButtonPanel"
|
||||
Grid.Column="1"
|
||||
Orientation="Horizontal"
|
||||
Spacing="16">
|
||||
<!--<controls:ShortcutConflictControl/>-->
|
||||
<controls:CheckUpdateControl />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<ScrollViewer x:Name="MainScrollViewer" Grid.Row="2">
|
||||
<Grid>
|
||||
<!-- This grid is required to ensure that the content is horizontally aligned -->
|
||||
<Grid
|
||||
MaxWidth="{StaticResource PageMaxWidth}"
|
||||
Padding="0,0,20,48"
|
||||
ColumnSpacing="16"
|
||||
RowSpacing="16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<controls:Card x:Uid="QuickAccessTitle" VerticalAlignment="Top">
|
||||
<Grid>
|
||||
<ItemsControl
|
||||
x:Name="QuickAccessItemsControl"
|
||||
Margin="8,0,12,12"
|
||||
ItemsSource="{x:Bind ViewModel.ActionModules, Mode=OneWay}"
|
||||
Visibility="{x:Bind ViewModel.ActionModules.Count, Mode=OneWay, Converter={StaticResource DoubleToVisibilityConverter}}">
|
||||
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<tkcontrols:WrapPanel
|
||||
Padding="12"
|
||||
HorizontalSpacing="16"
|
||||
VerticalSpacing="24" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<InfoBar
|
||||
x:Uid="UpdateAvailable"
|
||||
Margin="0,0,16,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="8"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind ViewModel.UpdateAvailable, Mode=OneWay}"
|
||||
Severity="Informational">
|
||||
<InfoBar.ActionButton>
|
||||
<Button x:Uid="LearnMore" Click="SWVersionButtonClicked" />
|
||||
</InfoBar.ActionButton>
|
||||
</InfoBar>
|
||||
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="viewmodels:DashboardListItem">
|
||||
<ItemsControl IsTabStop="False" ItemsSource="{x:Bind DashboardModuleItems, Mode=OneWay}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="viewmodels:DashboardModuleButtonItem">
|
||||
<controls:FlyoutMenuButton AutomationProperties.Name="{x:Bind ButtonTitle}" Click="{x:Bind ButtonClickHandler}">
|
||||
<controls:FlyoutMenuButton.Content>
|
||||
<TextBlock
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="{x:Bind ButtonTitle}"
|
||||
TextAlignment="Center"
|
||||
TextWrapping="Wrap" />
|
||||
</controls:FlyoutMenuButton.Content>
|
||||
<controls:FlyoutMenuButton.Icon>
|
||||
<Image Width="24">
|
||||
<Image.Source>
|
||||
<BitmapImage UriSource="{x:Bind ButtonGlyph}" />
|
||||
</Image.Source>
|
||||
</Image>
|
||||
</controls:FlyoutMenuButton.Icon>
|
||||
<ToolTipService.ToolTip>
|
||||
<ToolTip Content="{x:Bind ButtonDescription}" />
|
||||
</ToolTipService.ToolTip>
|
||||
</controls:FlyoutMenuButton>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Spacing="0" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<TextBlock
|
||||
x:Uid="NoActionsToShow"
|
||||
Margin="12"
|
||||
HorizontalAlignment="Left"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Visibility="{x:Bind ViewModel.ActionModules.Count, Mode=OneWay, Converter={StaticResource DoubleToInvertedVisibilityConverter}}" />
|
||||
</Grid>
|
||||
</controls:Card>
|
||||
<controls:Card
|
||||
x:Uid="ShortcutsOverview"
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Top">
|
||||
<Grid>
|
||||
<ItemsRepeater
|
||||
Grid.Row="2"
|
||||
Margin="8,0,0,0"
|
||||
ItemsSource="{x:Bind ViewModel.ShortcutModules, Mode=OneWay}">
|
||||
<ItemsRepeater.Layout>
|
||||
<StackLayout Orientation="Vertical" Spacing="0" />
|
||||
</ItemsRepeater.Layout>
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate x:DataType="viewmodels:DashboardListItem">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="32" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image
|
||||
Width="16"
|
||||
Margin="0,10,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Source="{x:Bind Icon, Mode=OneWay}"
|
||||
ToolTipService.ToolTip="{x:Bind Label}" />
|
||||
<ItemsControl
|
||||
Grid.Column="1"
|
||||
IsTabStop="False"
|
||||
ItemTemplateSelector="{StaticResource ModuleItemTemplateSelector}"
|
||||
ItemsSource="{x:Bind DashboardModuleItems, Mode=OneWay}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Spacing="0" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsRepeater.ItemTemplate>
|
||||
</ItemsRepeater>
|
||||
<TextBlock
|
||||
x:Uid="NoShortcutsToShow"
|
||||
Margin="12"
|
||||
HorizontalAlignment="Left"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Visibility="{x:Bind ViewModel.ShortcutModules.Count, Mode=OneWay, Converter={StaticResource DoubleToInvertedVisibilityConverter}}" />
|
||||
</Grid>
|
||||
</controls:Card>
|
||||
<controls:Card
|
||||
x:Name="ModulesCard"
|
||||
Title="Modules"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
MinWidth="400"
|
||||
Padding="0"
|
||||
VerticalAlignment="Top"
|
||||
DividerVisibility="Collapsed">
|
||||
<ItemsRepeater
|
||||
x:Name="DashboardView"
|
||||
Grid.Row="2"
|
||||
ItemsSource="{x:Bind ViewModel.AllModules, Mode=OneWay}">
|
||||
<ItemsRepeater.Layout>
|
||||
<StackLayout Orientation="Vertical" Spacing="0" />
|
||||
</ItemsRepeater.Layout>
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate x:DataType="viewmodels:DashboardListItem">
|
||||
<tkcontrols:SettingsCard
|
||||
MinHeight="0"
|
||||
Padding="12,4,12,4"
|
||||
AutomationProperties.Name="{x:Bind Label}"
|
||||
Background="Transparent"
|
||||
BorderBrush="{ThemeResource DividerStrokeColorDefaultBrush}"
|
||||
BorderThickness="0,1,0,0"
|
||||
Click="DashboardListItemClick"
|
||||
CornerRadius="0"
|
||||
IsClickEnabled="True"
|
||||
Tag="{x:Bind Tag}">
|
||||
<tkcontrols:SettingsCard.Resources>
|
||||
<x:Double x:Key="SettingsCardWrapThreshold">0</x:Double>
|
||||
<x:Double x:Key="SettingsCardHeaderIconMaxSize">16</x:Double>
|
||||
</tkcontrols:SettingsCard.Resources>
|
||||
<tkcontrols:SettingsCard.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{x:Bind Label}" />
|
||||
<InfoBadge
|
||||
Margin="4,0,0,0"
|
||||
Style="{StaticResource NewInfoBadge}"
|
||||
Visibility="{x:Bind IsNew, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
<FontIcon
|
||||
Grid.Column="2"
|
||||
Width="20"
|
||||
Margin="0,0,-12,0"
|
||||
FontSize="16"
|
||||
Glyph=""
|
||||
Visibility="{x:Bind IsLocked, Converter={StaticResource ReverseBoolToVisibilityConverter}, ConverterParameter=True}">
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock x:Uid="GPO_SettingIsManaged_ToolTip" TextWrapping="WrapWholeWords" />
|
||||
</ToolTipService.ToolTip>
|
||||
</FontIcon>
|
||||
</StackPanel>
|
||||
</tkcontrols:SettingsCard.Header>
|
||||
<tkcontrols:SettingsCard.HeaderIcon>
|
||||
<ImageIcon>
|
||||
<ImageIcon.Source>
|
||||
<BitmapImage UriSource="{x:Bind Icon}" />
|
||||
</ImageIcon.Source>
|
||||
</ImageIcon>
|
||||
</tkcontrols:SettingsCard.HeaderIcon>
|
||||
<ScrollViewer x:Name="MainScrollViewer" Grid.Row="1">
|
||||
<StackPanel Padding="0,0,16,16" Orientation="Vertical">
|
||||
<TextBlock
|
||||
x:Uid="EnabledModules"
|
||||
Margin="0,0,0,12"
|
||||
Style="{StaticResource SubtitleTextBlockStyle}" />
|
||||
<ItemsRepeater x:Name="DashboardView" ItemsSource="{x:Bind ViewModel.ActiveModules, Mode=OneWay}">
|
||||
<ItemsRepeater.Layout>
|
||||
<tkcontrols:StaggeredLayout
|
||||
ColumnSpacing="8"
|
||||
DesiredColumnWidth="378"
|
||||
RowSpacing="8" />
|
||||
</ItemsRepeater.Layout>
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate x:DataType="viewModels:DashboardListItem">
|
||||
<Button
|
||||
Padding="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
AutomationProperties.Name="{x:Bind Label}"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Click="DashboardListItemClick"
|
||||
CornerRadius="{StaticResource OverlayCornerRadius}"
|
||||
Tag="{x:Bind Tag, Mode=OneWay}">
|
||||
<Grid
|
||||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
||||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="{StaticResource OverlayCornerRadius}"
|
||||
RowSpacing="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Margin="16,8,16,0" ColumnSpacing="12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image
|
||||
Grid.Column="0"
|
||||
Width="20"
|
||||
Margin="0,0,0,0">
|
||||
<Image.Source>
|
||||
<BitmapImage UriSource="{x:Bind Icon, Mode=OneWay}" />
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
Text="{x:Bind Label, Mode=OneWay}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<InfoBadge
|
||||
Margin="4,0,0,0"
|
||||
Style="{StaticResource NewInfoBadge}"
|
||||
Visibility="{x:Bind IsNew, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
<FontIcon
|
||||
Grid.Column="2"
|
||||
Width="20"
|
||||
Margin="0,0,-12,0"
|
||||
FontSize="16"
|
||||
Glyph=""
|
||||
Visibility="{x:Bind IsLocked, Converter={StaticResource BoolToInvertedVisibilityConverter}, ConverterParameter=True, Mode=OneWay}">
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock x:Uid="GPO_SettingIsManaged_ToolTip" TextWrapping="WrapWholeWords" />
|
||||
</ToolTipService.ToolTip>
|
||||
</FontIcon>
|
||||
<ToggleSwitch
|
||||
AutomationProperties.Name="{x:Bind Label}"
|
||||
x:Uid="Enable_Module"
|
||||
Grid.Column="3"
|
||||
Margin="0,-2,0,0"
|
||||
HorizontalAlignment="Right"
|
||||
AutomationProperties.HelpText="{x:Bind Label}"
|
||||
IsEnabled="{x:Bind IsLocked, Converter={StaticResource BoolNegationConverter}, ConverterParameter=True, Mode=OneWay}"
|
||||
IsOn="{x:Bind IsEnabled, Mode=TwoWay}"
|
||||
OffContent=""
|
||||
OnContent="" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</DataTemplate>
|
||||
</ItemsRepeater.ItemTemplate>
|
||||
</ItemsRepeater>
|
||||
</controls:Card>
|
||||
</Grid>
|
||||
</Grid>
|
||||
OnContent=""
|
||||
Style="{StaticResource RightAlignedCompactToggleSwitchStyle}" />
|
||||
</Grid>
|
||||
|
||||
<ItemsControl
|
||||
Grid.Row="1"
|
||||
Margin="16,8,16,16"
|
||||
IsTabStop="False"
|
||||
ItemTemplateSelector="{StaticResource ModuleItemTemplateSelector}"
|
||||
ItemsSource="{x:Bind DashboardModuleItems, Mode=OneWay}"
|
||||
Visibility="{x:Bind IsEnabled, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Spacing="4" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ItemsRepeater.ItemTemplate>
|
||||
</ItemsRepeater>
|
||||
|
||||
<TextBlock
|
||||
x:Uid="DisabledModules"
|
||||
Margin="0,24,0,12"
|
||||
Style="{StaticResource SubtitleTextBlockStyle}" />
|
||||
|
||||
<ItemsRepeater ItemsSource="{x:Bind ViewModel.DisabledModules, Mode=OneWay}">
|
||||
<ItemsRepeater.Layout>
|
||||
<tkcontrols:StaggeredLayout
|
||||
ColumnSpacing="8"
|
||||
DesiredColumnWidth="378"
|
||||
RowSpacing="8" />
|
||||
</ItemsRepeater.Layout>
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate x:DataType="viewModels:DashboardListItem">
|
||||
<Button
|
||||
Padding="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
AutomationProperties.Name="{x:Bind Label}"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Click="DashboardListItemClick"
|
||||
CornerRadius="{StaticResource OverlayCornerRadius}"
|
||||
Tag="{x:Bind Tag, Mode=OneWay}">
|
||||
<Grid
|
||||
Padding="16,12"
|
||||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
||||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="{StaticResource OverlayCornerRadius}"
|
||||
RowSpacing="12">
|
||||
<Grid ColumnSpacing="12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Grid.Column="0" Width="20">
|
||||
<Image.Source>
|
||||
<BitmapImage UriSource="{x:Bind Icon, Mode=OneWay}" />
|
||||
</Image.Source>
|
||||
</Image>
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
Text="{x:Bind Label, Mode=OneWay}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<InfoBadge
|
||||
Margin="4,0,0,0"
|
||||
Style="{StaticResource NewInfoBadge}"
|
||||
Visibility="{x:Bind IsNew, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
<FontIcon
|
||||
Grid.Column="2"
|
||||
Width="20"
|
||||
Margin="0,0,-12,0"
|
||||
FontSize="16"
|
||||
Glyph=""
|
||||
Visibility="{x:Bind IsLocked, Converter={StaticResource BoolToInvertedVisibilityConverter}, ConverterParameter=True, Mode=OneWay}">
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock x:Uid="GPO_SettingIsManaged_ToolTip" TextWrapping="WrapWholeWords" />
|
||||
</ToolTipService.ToolTip>
|
||||
</FontIcon>
|
||||
<ToggleSwitch
|
||||
x:Uid="Enable_Module"
|
||||
Grid.Column="3"
|
||||
Margin="0,-2,0,0"
|
||||
HorizontalAlignment="Right"
|
||||
AutomationProperties.HelpText="{x:Bind Label}"
|
||||
IsEnabled="{x:Bind IsLocked, Converter={StaticResource BoolNegationConverter}, ConverterParameter=True, Mode=OneWay}"
|
||||
IsOn="{x:Bind IsEnabled, Mode=TwoWay}"
|
||||
OffContent=""
|
||||
OnContent=""
|
||||
Style="{StaticResource RightAlignedCompactToggleSwitchStyle}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ItemsRepeater.ItemTemplate>
|
||||
</ItemsRepeater>
|
||||
</StackPanel>
|
||||
|
||||
</ScrollViewer>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup>
|
||||
<VisualState>
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="840" />
|
||||
</VisualState.StateTriggers>
|
||||
</VisualState>
|
||||
<VisualState>
|
||||
<VisualState.StateTriggers>
|
||||
<AdaptiveTrigger MinWindowWidth="0" />
|
||||
</VisualState.StateTriggers>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="TopButtonPanel.(Grid.Row)" Value="1" />
|
||||
<Setter Target="TopButtonPanel.Margin" Value="0,16,0,0" />
|
||||
<Setter Target="TopButtonPanel.(Grid.Column)" Value="0" />
|
||||
<Setter Target="ModulesCard.(Grid.Column)" Value="0" />
|
||||
<Setter Target="ModulesCard.(Grid.Row)" Value="2" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</Grid>
|
||||
</Page>
|
||||
</Page>
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Views;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using Microsoft.UI.Xaml;
|
||||
@@ -46,23 +46,14 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
ViewModel.ModuleEnabledChangedOnSettingsPage();
|
||||
}
|
||||
|
||||
private void SWVersionButtonClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ViewModel.SWVersionButtonClicked();
|
||||
}
|
||||
|
||||
private void DashboardListItemClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ViewModel.DashboardListItemClick(sender);
|
||||
}
|
||||
|
||||
private void WhatsNewButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (App.GetOobeWindow() == null)
|
||||
{
|
||||
App.SetOobeWindow(new OobeWindow(PowerToysModules.WhatsNew));
|
||||
}
|
||||
else
|
||||
{
|
||||
App.GetOobeWindow().SetAppWindow(PowerToysModules.WhatsNew);
|
||||
}
|
||||
|
||||
App.GetOobeWindow().Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Page.Resources>
|
||||
<converters:UpdateStateToBoolConverter x:Key="UpdateStateToBoolConverter" />
|
||||
<converters:StringToInfoBarSeverityConverter x:Key="StringToInfoBarSeverityConverter" />
|
||||
</Page.Resources>
|
||||
|
||||
|
||||
@@ -14,23 +14,22 @@
|
||||
|
||||
<Page.Resources>
|
||||
<tkconverters:CollectionVisibilityConverter x:Key="CollectionVisibilityConverter" />
|
||||
<tkconverters:BoolToVisibilityConverter
|
||||
x:Key="BoolToInvertedVisibilityConverter"
|
||||
FalseValue="Visible"
|
||||
TrueValue="Collapsed" />
|
||||
<tkconverters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
|
||||
|
||||
<Style x:Name="KeysListViewContainerStyle" TargetType="ListViewItem">
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
</Style>
|
||||
|
||||
<DataTemplate x:Key="OriginalKeyTemplate" x:DataType="x:String">
|
||||
<controls:KeyVisual
|
||||
Padding="8"
|
||||
Content="{Binding}"
|
||||
CornerRadius="{StaticResource ControlCornerRadius}" />
|
||||
<controls:KeyVisual Content="{Binding}" VisualType="SmallOutline" />
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="RemappedKeyTemplate" x:DataType="x:String">
|
||||
<controls:KeyVisual
|
||||
Padding="8"
|
||||
Content="{Binding}"
|
||||
CornerRadius="{StaticResource ControlCornerRadius}"
|
||||
Style="{StaticResource AccentKeyVisualStyle}" />
|
||||
<controls:KeyVisual Content="{Binding}" VisualType="Small" />
|
||||
</DataTemplate>
|
||||
|
||||
<!--<DataTemplate x:Name="KeysListViewTemplate" x:DataType="Lib:KeysDataModel">
|
||||
@@ -185,7 +184,7 @@
|
||||
Margin="8,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource SecondaryIsEnabledTextBlockStyle}"
|
||||
Visibility="{x:Bind Path=IsOpenUriOrIsRunProgram, Mode=OneWay, Converter={StaticResource ReverseBoolToVisibilityConverter}}" />
|
||||
Visibility="{x:Bind Path=IsOpenUriOrIsRunProgram, Mode=OneWay, Converter={StaticResource BoolToInvertedVisibilityConverter}}" />
|
||||
|
||||
<controls:IsEnabledTextBlock
|
||||
x:Uid="Starts"
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
mc:Ignorable="d">
|
||||
<Page.Resources>
|
||||
<converters:IndexBitFieldToVisibilityConverter x:Key="IndexBitFieldToVisibilityConverter" />
|
||||
<tkconverters:BoolToVisibilityConverter
|
||||
x:Key="BoolToInvertedVisibilityConverter"
|
||||
FalseValue="Visible"
|
||||
TrueValue="Collapsed" />
|
||||
</Page.Resources>
|
||||
<controls:SettingsPageControl x:Uid="MouseUtils" ModuleImageSource="ms-appx:///Assets/Settings/Modules/MouseUtils.png">
|
||||
<controls:SettingsPageControl.ModuleContent>
|
||||
@@ -149,7 +153,7 @@
|
||||
IsClosable="False"
|
||||
IsOpen="True"
|
||||
Severity="Informational"
|
||||
Visibility="{x:Bind ViewModel.IsAnimationEnabledBySystem, Mode=OneWay, Converter={StaticResource BoolToReverseVisibilityConverter}}">
|
||||
Visibility="{x:Bind ViewModel.IsAnimationEnabledBySystem, Mode=OneWay, Converter={StaticResource BoolToInvertedVisibilityConverter}}">
|
||||
<InfoBar.ActionButton>
|
||||
<HyperlinkButton x:Uid="OpenSettings" Click="OpenAnimationsSettings_Click" />
|
||||
</InfoBar.ActionButton>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
AutomationProperties.LandmarkType="Main"
|
||||
mc:Ignorable="d">
|
||||
<Page.Resources>
|
||||
<converters:BoolToVisibilityConverter x:Key="negativeBoolToVisibilityConverter" />
|
||||
<converters:BoolToObjectConverter
|
||||
x:Key="OneRowMatrixBoolToNumberOfRowsConverter"
|
||||
FalseValue="2"
|
||||
@@ -74,7 +75,7 @@
|
||||
x:Uid="MouseWithoutBorders_Connect"
|
||||
Command="{x:Bind ShowConnectFieldsCommand, Mode=OneTime}"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
Visibility="{x:Bind Path=ViewModel.ConnectFieldsVisible, Mode=OneWay, Converter={StaticResource ReverseBoolToVisibilityConverter}, ConverterParameter=True}" />
|
||||
Visibility="{x:Bind Path=ViewModel.ConnectFieldsVisible, Mode=OneWay, Converter={StaticResource negativeBoolToVisibilityConverter}, ConverterParameter=True}" />
|
||||
</StackPanel>
|
||||
</tkcontrols:SettingsExpander>
|
||||
|
||||
|
||||
@@ -796,7 +796,7 @@
|
||||
<value>Information Symbol</value>
|
||||
</data>
|
||||
<data name="FancyZones_LaunchEditorButtonControl.Header" xml:space="preserve">
|
||||
<value>Open layout editor</value>
|
||||
<value>Launch layout editor</value>
|
||||
<comment>launches the FancyZones layout editor application</comment>
|
||||
</data>
|
||||
<data name="FancyZones_LaunchEditorButtonControl.Description" xml:space="preserve">
|
||||
@@ -824,11 +824,8 @@
|
||||
<data name="FancyZones_ShiftDragCheckBoxControl_Header.Content" xml:space="preserve">
|
||||
<value>Hold Shift key to activate zones while dragging a window</value>
|
||||
</data>
|
||||
<data name="FancyZones_ActivationShiftDrag" xml:space="preserve">
|
||||
<value>Hold Shift key</value>
|
||||
</data>
|
||||
<data name="FancyZones_ActivationNoShiftDrag" xml:space="preserve">
|
||||
<value>Drag a window</value>
|
||||
<value>Drag windows to activate zones</value>
|
||||
</data>
|
||||
<data name="FancyZones_ShowZonesOnAllMonitorsCheckBoxControl.Content" xml:space="preserve">
|
||||
<value>Show zones on all monitors while dragging a window</value>
|
||||
@@ -1989,7 +1986,7 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
|
||||
<value>Launch</value>
|
||||
</data>
|
||||
<data name="Launch_ColorPicker.Content" xml:space="preserve">
|
||||
<value>Open Color Picker</value>
|
||||
<value>Launch Color Picker</value>
|
||||
</data>
|
||||
<data name="Oobe_LearnMore.Text" xml:space="preserve">
|
||||
<value>Learn more about</value>
|
||||
@@ -2136,7 +2133,7 @@ From there, simply click on one of the supported files in the File Explorer and
|
||||
<value>Want a custom size? You can add them in the PowerToys Settings!</value>
|
||||
</data>
|
||||
<data name="Oobe_KBM_HowToCreateMappings.Text" xml:space="preserve">
|
||||
<value>Open **PowerToys Settings**, navigate to the Keyboard Manager menu, and select either **Remap a key** or **Remap a shortcut**.</value>
|
||||
<value>Launch **PowerToys Settings**, navigate to the Keyboard Manager menu, and select either **Remap a key** or **Remap a shortcut**.</value>
|
||||
</data>
|
||||
<data name="Oobe_KBM_TipsAndTricks.Text" xml:space="preserve">
|
||||
<value>Want to only have a shortcut work for a single application? Use the Target App field when creating the shortcut remapping.</value>
|
||||
@@ -2553,10 +2550,10 @@ From there, simply click on one of the supported files in the File Explorer and
|
||||
<comment>Mouse as in the hardware peripheral.</comment>
|
||||
</data>
|
||||
<data name="Launch_Run.Content" xml:space="preserve">
|
||||
<value>Open PowerToys Run</value>
|
||||
<value>Launch PowerToys Run</value>
|
||||
</data>
|
||||
<data name="Launch_ShortcutGuide.Content" xml:space="preserve">
|
||||
<value>Open Shortcut Guide</value>
|
||||
<value>Launch Shortcut Guide</value>
|
||||
</data>
|
||||
<data name="ColorPicker_ColorFormat_ToggleSwitch.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Show format in editor</value>
|
||||
@@ -2851,9 +2848,6 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
|
||||
<data name="FancyZones_Zone_Appearance.Header" xml:space="preserve">
|
||||
<value>Zone appearance</value>
|
||||
</data>
|
||||
<data name="LearnMore.Text" xml:space="preserve">
|
||||
<value>Learn more</value>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_ToggleSwitch_Thumbnail_GCODE.Header" xml:space="preserve">
|
||||
<value>Geometric Code</value>
|
||||
<comment>File type, do not translate</comment>
|
||||
@@ -3140,7 +3134,7 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
|
||||
<value>Create and manage Workspaces</value>
|
||||
</data>
|
||||
<data name="Workspaces_LaunchEditorButtonControl.Header" xml:space="preserve">
|
||||
<value>Open editor</value>
|
||||
<value>Launch editor</value>
|
||||
</data>
|
||||
<data name="LearnMore_Workspaces.Text" xml:space="preserve">
|
||||
<value>Learn more about the Workspaces utility</value>
|
||||
@@ -3165,10 +3159,10 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<value>Pick a color</value>
|
||||
</data>
|
||||
<data name="CropAndLock_Thumbnail" xml:space="preserve">
|
||||
<value>Crop and create a thumbnail</value>
|
||||
<value>Thumbnail</value>
|
||||
</data>
|
||||
<data name="CropAndLock_Reparent" xml:space="preserve">
|
||||
<value>Crop an app's window into a cropped window</value>
|
||||
<value>Reparent</value>
|
||||
</data>
|
||||
<data name="FancyZones_OpenEditor" xml:space="preserve">
|
||||
<value>Open editor</value>
|
||||
@@ -3180,7 +3174,7 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<value>Find the mouse</value>
|
||||
</data>
|
||||
<data name="MouseHighlighter_ShortDescription" xml:space="preserve">
|
||||
<value>Turn on clicks highlighter</value>
|
||||
<value>Highlight clicks</value>
|
||||
</data>
|
||||
<data name="MouseJump_ShortDescription" xml:space="preserve">
|
||||
<value>Quickly move the mouse pointer</value>
|
||||
@@ -3198,10 +3192,10 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<value>Learn more</value>
|
||||
</data>
|
||||
<data name="Peek_ShortDescription" xml:space="preserve">
|
||||
<value>Preview file</value>
|
||||
<value>Quick and easy previewer</value>
|
||||
</data>
|
||||
<data name="Run_ShortDescription" xml:space="preserve">
|
||||
<value>Open Run</value>
|
||||
<value>A quick launcher</value>
|
||||
</data>
|
||||
<data name="PowerAccent_ShortDescription" xml:space="preserve">
|
||||
<value>An alternative way to type accented characters</value>
|
||||
@@ -3211,21 +3205,18 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<comment>{Locked="Windows"}</comment>
|
||||
</data>
|
||||
<data name="ScreenRuler_ShortDescription" xml:space="preserve">
|
||||
<value>Start measurement</value>
|
||||
<value>Measure pixels on your screen</value>
|
||||
</data>
|
||||
<data name="ShortcutGuide_ShortDescription" xml:space="preserve">
|
||||
<value>Open Shortcut Guide</value>
|
||||
<value>Show a help overlay with Windows shortcuts</value>
|
||||
<comment>{Locked="Windows"}</comment>
|
||||
</data>
|
||||
<data name="PowerOcr_ShortDescription" xml:space="preserve">
|
||||
<value>Start text extraction</value>
|
||||
<value>A convenient way to copy text from anywhere on screen</value>
|
||||
</data>
|
||||
<data name="Dashboard_Activation" xml:space="preserve">
|
||||
<value>Activation</value>
|
||||
</data>
|
||||
<data name="Activate_Zones" xml:space="preserve">
|
||||
<value>Activate zones</value>
|
||||
</data>
|
||||
<data name="DashboardKBMShowMappingsButton.Content" xml:space="preserve">
|
||||
<value>Show remappings</value>
|
||||
</data>
|
||||
@@ -3404,7 +3395,7 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<value>Text Extractor</value>
|
||||
</data>
|
||||
<data name="Launch_TextExtractor.Content" xml:space="preserve">
|
||||
<value>Open Text Extractor</value>
|
||||
<value>Launch Text Extractor</value>
|
||||
</data>
|
||||
<data name="Oobe_TextExtractor.Title" xml:space="preserve">
|
||||
<value>Text Extractor</value>
|
||||
@@ -3629,11 +3620,11 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<comment>"Hosts" refers to the system hosts file, do not loc</comment>
|
||||
</data>
|
||||
<data name="Hosts_LaunchButtonControl.Header" xml:space="preserve">
|
||||
<value>Open Hosts File Editor</value>
|
||||
<value>Launch Hosts File Editor</value>
|
||||
<comment>"Hosts File Editor" is a product name</comment>
|
||||
</data>
|
||||
<data name="Hosts_LaunchButton_Accessible.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Open Hosts File Editor</value>
|
||||
<value>Launch Hosts File Editor</value>
|
||||
<comment>"Hosts File Editor" is a product name</comment>
|
||||
</data>
|
||||
<data name="Hosts_AdditionalLinesPosition.Header" xml:space="preserve">
|
||||
@@ -3649,7 +3640,7 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<value>Behavior</value>
|
||||
</data>
|
||||
<data name="Launch_Hosts.Content" xml:space="preserve">
|
||||
<value>Open Hosts File Editor</value>
|
||||
<value>Launch Hosts File Editor</value>
|
||||
<comment>"Hosts File Editor" is the name of the utility</comment>
|
||||
</data>
|
||||
<data name="LearnMore_Hosts.Text" xml:space="preserve">
|
||||
@@ -3668,7 +3659,7 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<value>Required in order to make changes to the hosts file</value>
|
||||
</data>
|
||||
<data name="Hosts_Toggle_LaunchAdministrator.Header" xml:space="preserve">
|
||||
<value>Open as administrator</value>
|
||||
<value>Launch as administrator</value>
|
||||
</data>
|
||||
<data name="EnvironmentVariables.ModuleDescription" xml:space="preserve">
|
||||
<value>A quick utility for managing environment variables.</value>
|
||||
@@ -3689,13 +3680,13 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<value>Manage your environment variables</value>
|
||||
</data>
|
||||
<data name="EnvironmentVariables_LaunchButtonControl.Header" xml:space="preserve">
|
||||
<value>Open Environment Variables</value>
|
||||
<value>Launch Environment Variables</value>
|
||||
</data>
|
||||
<data name="EnvironmentVariables_LaunchButton_Accessible.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Open Environment Variables</value>
|
||||
<value>Launch Environment Variables</value>
|
||||
</data>
|
||||
<data name="Launch_EnvironmentVariables.Content" xml:space="preserve">
|
||||
<value>Open Environment Variables</value>
|
||||
<value>Launch Environment Variables</value>
|
||||
</data>
|
||||
<data name="LearnMore_EnvironmentVariables.Text" xml:space="preserve">
|
||||
<value>Learn more about Environment Variables</value>
|
||||
@@ -3710,7 +3701,7 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<value>Required in order to make changes to the system environment variables</value>
|
||||
</data>
|
||||
<data name="EnvironmentVariables_Toggle_LaunchAdministrator.Header" xml:space="preserve">
|
||||
<value>Open as administrator</value>
|
||||
<value>Launch as administrator</value>
|
||||
</data>
|
||||
<data name="ShortcutGuide_PressTimeForTaskbarIconShortcuts.Header" xml:space="preserve">
|
||||
<value>Press duration before showing taskbar icon shortcuts (ms)</value>
|
||||
@@ -3964,9 +3955,6 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<data name="QuickAccessTxt.Text" xml:space="preserve">
|
||||
<value>Quick access</value>
|
||||
</data>
|
||||
<data name="UpdateAvailable.Text" xml:space="preserve">
|
||||
<value>Update available</value>
|
||||
</data>
|
||||
<data name="FileExplorerPreview_Toggle_Monaco_Max_File_Size.Header" xml:space="preserve">
|
||||
<value>Maximum file size to preview</value>
|
||||
<comment>Size refers to the disk space used by a file</comment>
|
||||
@@ -4009,7 +3997,7 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<comment>Registry Preview is a product name, do not loc</comment>
|
||||
</data>
|
||||
<data name="Launch_RegistryPreview.Content" xml:space="preserve">
|
||||
<value>Open Registry Preview</value>
|
||||
<value>Launch Registry Preview</value>
|
||||
<comment>"Registry Preview" is the name of the utility</comment>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseJump.Header" xml:space="preserve">
|
||||
@@ -4157,13 +4145,13 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<value>Consider loopback addresses as duplicates</value>
|
||||
</data>
|
||||
<data name="RegistryPreview_Launch_GroupSettings.Header" xml:space="preserve">
|
||||
<value>Open</value>
|
||||
<value>Launch</value>
|
||||
</data>
|
||||
<data name="RegistryPreview_LaunchButton_Accessible.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Open Registry Preview</value>
|
||||
<value>Launch Registry Preview</value>
|
||||
</data>
|
||||
<data name="RegistryPreview_LaunchButtonControl.Header" xml:space="preserve">
|
||||
<value>Open Registry Preview</value>
|
||||
<value>Launch Registry Preview</value>
|
||||
</data>
|
||||
<data name="RegistryPreview_DefaultRegApp.Header" xml:space="preserve">
|
||||
<value>Make Registry Preview the default app for .reg files</value>
|
||||
@@ -4239,10 +4227,10 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<comment>Title of the settings window when running as administrator</comment>
|
||||
</data>
|
||||
<data name="DashboardTitle.Text" xml:space="preserve">
|
||||
<value>Home</value>
|
||||
<value>Dashboard</value>
|
||||
</data>
|
||||
<data name="Shell_Dashboard.Content" xml:space="preserve">
|
||||
<value>Home</value>
|
||||
<value>Dashboard</value>
|
||||
</data>
|
||||
<data name="Peek_Preview_GroupSettings.Header" xml:space="preserve">
|
||||
<value>Preview</value>
|
||||
@@ -4498,7 +4486,7 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<value>Workspaces</value>
|
||||
</data>
|
||||
<data name="Workspaces_ShortDescription" xml:space="preserve">
|
||||
<value>Open editor</value>
|
||||
<value>Create and launch Workspaces</value>
|
||||
</data>
|
||||
<data name="Shell_ZoomIt.Content" xml:space="preserve">
|
||||
<value>ZoomIt</value>
|
||||
@@ -4925,9 +4913,6 @@ To record a specific window, enter the hotkey with the Alt key in the opposite m
|
||||
<data name="CmdPal_ShortDescription" xml:space="preserve">
|
||||
<value>A better quick launcher</value>
|
||||
</data>
|
||||
<data name="CmdPal_ActivationDescription" xml:space="preserve">
|
||||
<value>Open Command Palette</value>
|
||||
</data>
|
||||
<data name="CmdPal_Enable_CmdPal.Header" xml:space="preserve">
|
||||
<value>Enable Command Palette</value>
|
||||
<comment>"Command Palette" is the name of the utility.</comment>
|
||||
@@ -5045,36 +5030,6 @@ To record a specific window, enter the hotkey with the Alt key in the opposite m
|
||||
<data name="FileExplorerPreview_ToggleSwitch_Thumbnail_BGCODE.Header" xml:space="preserve">
|
||||
<value>Binary Geometric Code</value>
|
||||
</data>
|
||||
<data name="YoureUpToDate.Text" xml:space="preserve">
|
||||
<value>You're up to date</value>
|
||||
</data>
|
||||
<data name="UpdateAvailableTextBlock.Text" xml:space="preserve">
|
||||
<value>Update Available</value>
|
||||
</data>
|
||||
<data name="GeneralVersion.Text" xml:space="preserve">
|
||||
<value>Version</value>
|
||||
</data>
|
||||
<data name="LearnWhatsNew.Text" xml:space="preserve">
|
||||
<value>Learn what's new</value>
|
||||
</data>
|
||||
<data name="ConfigureShortcut" xml:space="preserve">
|
||||
<value>Configure shortcut</value>
|
||||
</data>
|
||||
<data name="ConfigureShortcutText.Text" xml:space="preserve">
|
||||
<value>Configure shortcut</value>
|
||||
</data>
|
||||
<data name="QuickAccessTitle.Title" xml:space="preserve">
|
||||
<value>Quick access</value>
|
||||
</data>
|
||||
<data name="ShortcutsOverview.Title" xml:space="preserve">
|
||||
<value>Shortcuts overview</value>
|
||||
</data>
|
||||
<data name="NoActionsToShow.Text" xml:space="preserve">
|
||||
<value>No actions to show..</value>
|
||||
</data>
|
||||
<data name="NoShortcutsToShow.Text" xml:space="preserve">
|
||||
<value>No shortcuts to show..</value>
|
||||
</data>
|
||||
<data name="HighlightMode.Description" xml:space="preserve">
|
||||
<value>Highlight the cursor or dim the screen to spotlight it</value>
|
||||
</data>
|
||||
@@ -5124,7 +5079,4 @@ To record a specific window, enter the hotkey with the Alt key in the opposite m
|
||||
<data name="GeneralPage_EnableViewDiagnosticDataText.Text" xml:space="preserve">
|
||||
<value>Stores diagnostic data locally in .xml format; folder may include .etl files as well. May use up 1 GB or more of disk space.</value>
|
||||
</data>
|
||||
<data name="KeyBack" xml:space="preserve">
|
||||
<value>Back key</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -36,9 +36,23 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
public List<object> Shortcut { get; set; }
|
||||
}
|
||||
|
||||
public partial class DashboardModuleActivationItem : DashboardModuleItem
|
||||
public partial class DashboardModuleKBMItem : DashboardModuleItem
|
||||
{
|
||||
public string Activation { get; set; }
|
||||
private List<KeysDataModel> _remapKeys = new List<KeysDataModel>();
|
||||
|
||||
public List<KeysDataModel> RemapKeys
|
||||
{
|
||||
get => _remapKeys;
|
||||
set => _remapKeys = value;
|
||||
}
|
||||
|
||||
private List<AppSpecificKeysDataModel> _remapShortcuts = new List<AppSpecificKeysDataModel>();
|
||||
|
||||
public List<AppSpecificKeysDataModel> RemapShortcuts
|
||||
{
|
||||
get => _remapShortcuts;
|
||||
set => _remapShortcuts = value;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class DashboardModuleItem : INotifyPropertyChanged
|
||||
|
||||
@@ -8,14 +8,13 @@ using System.Collections.ObjectModel;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Windows.Threading;
|
||||
using CommunityToolkit.WinUI.Controls;
|
||||
|
||||
using global::PowerToys.GPOWrapper;
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Settings.UI.Services;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Microsoft.UI.Xaml;
|
||||
@@ -26,23 +25,19 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
public partial class DashboardViewModel : Observable
|
||||
{
|
||||
private const string JsonFileType = ".json";
|
||||
private IFileSystemWatcher _watcher;
|
||||
private DashboardModuleKBMItem _kbmItem;
|
||||
private Dispatcher dispatcher;
|
||||
|
||||
public Func<string, int> SendConfigMSG { get; }
|
||||
|
||||
public ObservableCollection<DashboardListItem> AllModules { get; set; } = new ObservableCollection<DashboardListItem>();
|
||||
public ObservableCollection<DashboardListItem> ActiveModules { get; set; } = new ObservableCollection<DashboardListItem>();
|
||||
|
||||
public ObservableCollection<DashboardListItem> ShortcutModules { get; set; } = new ObservableCollection<DashboardListItem>();
|
||||
public ObservableCollection<DashboardListItem> DisabledModules { get; set; } = new ObservableCollection<DashboardListItem>();
|
||||
|
||||
public ObservableCollection<DashboardListItem> ActionModules { get; set; } = new ObservableCollection<DashboardListItem>();
|
||||
public bool UpdateAvailable { get; set; }
|
||||
|
||||
public string PowerToysVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return Helper.GetProductVersion();
|
||||
}
|
||||
}
|
||||
private List<DashboardListItem> _allModules;
|
||||
|
||||
private ISettingsRepository<GeneralSettings> _settingsRepository;
|
||||
private GeneralSettings generalSettingsConfig;
|
||||
@@ -58,18 +53,24 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
// set the callback functions value to handle outgoing IPC message.
|
||||
SendConfigMSG = ipcMSGCallBackFunc;
|
||||
|
||||
_allModules = new List<DashboardListItem>();
|
||||
|
||||
foreach (ModuleType moduleType in Enum.GetValues<ModuleType>())
|
||||
{
|
||||
AddDashboardListItem(moduleType);
|
||||
}
|
||||
|
||||
GetShortcutModules();
|
||||
ActiveModules = new ObservableCollection<DashboardListItem>(_allModules.Where(x => x.IsEnabled));
|
||||
DisabledModules = new ObservableCollection<DashboardListItem>(_allModules.Where(x => !x.IsEnabled));
|
||||
|
||||
UpdatingSettings updatingSettingsConfig = UpdatingSettings.LoadSettings();
|
||||
UpdateAvailable = updatingSettingsConfig != null && (updatingSettingsConfig.State == UpdatingSettings.UpdatingState.ReadyToInstall || updatingSettingsConfig.State == UpdatingSettings.UpdatingState.ReadyToDownload);
|
||||
}
|
||||
|
||||
private void AddDashboardListItem(ModuleType moduleType)
|
||||
{
|
||||
GpoRuleConfigured gpo = ModuleHelper.GetModuleGpoConfiguration(moduleType);
|
||||
AllModules.Add(new DashboardListItem()
|
||||
_allModules.Add(new DashboardListItem()
|
||||
{
|
||||
Tag = moduleType,
|
||||
Label = resourceLoader.GetString(ModuleHelper.GetModuleLabelResourceName(moduleType)),
|
||||
@@ -79,6 +80,47 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
EnabledChangedCallback = EnabledChangedOnUI,
|
||||
DashboardModuleItems = GetModuleItems(moduleType),
|
||||
});
|
||||
if (moduleType == ModuleType.KeyboardManager && gpo != GpoRuleConfigured.Disabled)
|
||||
{
|
||||
KeyboardManagerSettings kbmSettings = GetKBMSettings();
|
||||
_watcher = Library.Utilities.Helper.GetFileWatcher(KeyboardManagerSettings.ModuleName, kbmSettings.Properties.ActiveConfiguration.Value + JsonFileType, () => LoadKBMSettingsFromJson());
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadKBMSettingsFromJson()
|
||||
{
|
||||
try
|
||||
{
|
||||
KeyboardManagerProfile kbmProfile = GetKBMProfile();
|
||||
_kbmItem.RemapKeys = kbmProfile?.RemapKeys.InProcessRemapKeys;
|
||||
_kbmItem.RemapShortcuts = KeyboardManagerViewModel.CombineShortcutLists(kbmProfile?.RemapShortcuts.GlobalRemapShortcuts, kbmProfile?.RemapShortcuts.AppSpecificRemapShortcuts);
|
||||
dispatcher.Invoke(new Action(() => UpdateKBMItems()));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Failed to load KBM settings: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateKBMItems()
|
||||
{
|
||||
_kbmItem.NotifyPropertyChanged(nameof(_kbmItem.RemapKeys));
|
||||
_kbmItem.NotifyPropertyChanged(nameof(_kbmItem.RemapShortcuts));
|
||||
}
|
||||
|
||||
private KeyboardManagerProfile GetKBMProfile()
|
||||
{
|
||||
KeyboardManagerSettings kbmSettings = GetKBMSettings();
|
||||
const string PowerToyName = KeyboardManagerSettings.ModuleName;
|
||||
string fileName = kbmSettings.Properties.ActiveConfiguration.Value + JsonFileType;
|
||||
return new SettingsUtils().GetSettingsOrDefault<KeyboardManagerProfile>(PowerToyName, fileName);
|
||||
}
|
||||
|
||||
private KeyboardManagerSettings GetKBMSettings()
|
||||
{
|
||||
var settingsUtils = new SettingsUtils();
|
||||
ISettingsRepository<KeyboardManagerSettings> moduleSettingsRepository = SettingsRepository<KeyboardManagerSettings>.GetInstance(settingsUtils);
|
||||
return moduleSettingsRepository.SettingsConfig;
|
||||
}
|
||||
|
||||
private void EnabledChangedOnUI(DashboardListItem dashboardListItem)
|
||||
@@ -97,9 +139,25 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
try
|
||||
{
|
||||
GetShortcutModules();
|
||||
ActiveModules.Clear();
|
||||
DisabledModules.Clear();
|
||||
|
||||
OnPropertyChanged(nameof(ShortcutModules));
|
||||
generalSettingsConfig = _settingsRepository.SettingsConfig;
|
||||
foreach (DashboardListItem item in _allModules)
|
||||
{
|
||||
item.IsEnabled = ModuleHelper.GetIsModuleEnabled(generalSettingsConfig, item.Tag);
|
||||
if (item.IsEnabled)
|
||||
{
|
||||
ActiveModules.Add(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
DisabledModules.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
OnPropertyChanged(nameof(ActiveModules));
|
||||
OnPropertyChanged(nameof(DisabledModules));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -107,71 +165,29 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private void GetShortcutModules()
|
||||
{
|
||||
ShortcutModules.Clear();
|
||||
ActionModules.Clear();
|
||||
|
||||
foreach (var x in AllModules.Where(x => x.IsEnabled))
|
||||
{
|
||||
var filteredItems = x.DashboardModuleItems
|
||||
.Where(m => m is DashboardModuleShortcutItem || m is DashboardModuleActivationItem)
|
||||
.ToList();
|
||||
|
||||
if (filteredItems.Count != 0)
|
||||
{
|
||||
ShortcutModules.Add(new DashboardListItem
|
||||
{
|
||||
EnabledChangedCallback = x.EnabledChangedCallback,
|
||||
Icon = x.Icon,
|
||||
IsLocked = x.IsLocked,
|
||||
Label = x.Label,
|
||||
Tag = x.Tag,
|
||||
IsEnabled = x.IsEnabled,
|
||||
DashboardModuleItems = new ObservableCollection<DashboardModuleItem>(filteredItems),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var x in AllModules.Where(x => x.IsEnabled))
|
||||
{
|
||||
var filteredItems = x.DashboardModuleItems
|
||||
.Where(m => m is DashboardModuleButtonItem)
|
||||
.ToList();
|
||||
|
||||
if (filteredItems.Count != 0)
|
||||
{
|
||||
ActionModules.Add(new DashboardListItem
|
||||
{
|
||||
EnabledChangedCallback = x.EnabledChangedCallback,
|
||||
Icon = x.Icon,
|
||||
IsLocked = x.IsLocked,
|
||||
Label = x.Label,
|
||||
Tag = x.Tag,
|
||||
IsEnabled = x.IsEnabled,
|
||||
DashboardModuleItems = new ObservableCollection<DashboardModuleItem>(filteredItems),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ObservableCollection<DashboardModuleItem> GetModuleItems(ModuleType moduleType)
|
||||
{
|
||||
return moduleType switch
|
||||
{
|
||||
ModuleType.AdvancedPaste => GetModuleItemsAdvancedPaste(),
|
||||
ModuleType.AlwaysOnTop => GetModuleItemsAlwaysOnTop(),
|
||||
ModuleType.Awake => GetModuleItemsAwake(),
|
||||
ModuleType.CmdPal => GetModuleItemsCmdPal(),
|
||||
ModuleType.ColorPicker => GetModuleItemsColorPicker(),
|
||||
ModuleType.CropAndLock => GetModuleItemsCropAndLock(),
|
||||
ModuleType.EnvironmentVariables => GetModuleItemsEnvironmentVariables(),
|
||||
ModuleType.FancyZones => GetModuleItemsFancyZones(),
|
||||
ModuleType.FileLocksmith => GetModuleItemsFileLocksmith(),
|
||||
ModuleType.FindMyMouse => GetModuleItemsFindMyMouse(),
|
||||
ModuleType.Hosts => GetModuleItemsHosts(),
|
||||
ModuleType.ImageResizer => GetModuleItemsImageResizer(),
|
||||
ModuleType.KeyboardManager => GetModuleItemsKeyboardManager(),
|
||||
ModuleType.MouseHighlighter => GetModuleItemsMouseHighlighter(),
|
||||
ModuleType.MouseJump => GetModuleItemsMouseJump(),
|
||||
ModuleType.MousePointerCrosshairs => GetModuleItemsMousePointerCrosshairs(),
|
||||
ModuleType.MouseWithoutBorders => GetModuleItemsMouseWithoutBorders(),
|
||||
ModuleType.Peek => GetModuleItemsPeek(),
|
||||
ModuleType.PowerRename => GetModuleItemsPowerRename(),
|
||||
ModuleType.PowerLauncher => GetModuleItemsPowerLauncher(),
|
||||
ModuleType.PowerAccent => GetModuleItemsPowerAccent(),
|
||||
ModuleType.Workspaces => GetModuleItemsWorkspaces(),
|
||||
@@ -179,6 +195,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
ModuleType.MeasureTool => GetModuleItemsMeasureTool(),
|
||||
ModuleType.ShortcutGuide => GetModuleItemsShortcutGuide(),
|
||||
ModuleType.PowerOCR => GetModuleItemsPowerOCR(),
|
||||
ModuleType.NewPlus => GetModuleItemsNewPlus(),
|
||||
ModuleType.ZoomIt => GetModuleItemsZoomIt(),
|
||||
_ => new ObservableCollection<DashboardModuleItem>(), // never called, all values listed above
|
||||
};
|
||||
}
|
||||
@@ -193,13 +211,22 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
|
||||
private ObservableCollection<DashboardModuleItem> GetModuleItemsAwake()
|
||||
{
|
||||
var list = new List<DashboardModuleItem>
|
||||
{
|
||||
new DashboardModuleTextItem() { Label = resourceLoader.GetString("Awake_ShortDescription") },
|
||||
};
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
|
||||
private ObservableCollection<DashboardModuleItem> GetModuleItemsCmdPal()
|
||||
{
|
||||
var hotkey = new CmdPalProperties().Hotkey;
|
||||
|
||||
var list = new List<DashboardModuleItem>
|
||||
{
|
||||
new DashboardModuleShortcutItem() { Label = resourceLoader.GetString("CmdPal_ActivationDescription"), Shortcut = hotkey.GetKeysList() },
|
||||
new DashboardModuleShortcutItem() { Label = resourceLoader.GetString("CmdPal_ShortDescription"), Shortcut = hotkey.GetKeysList() },
|
||||
};
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
@@ -232,7 +259,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
var list = new List<DashboardModuleItem>
|
||||
{
|
||||
new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("EnvironmentVariables_LaunchButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("EnvironmentVariables_LaunchButtonControl/Description"), ButtonGlyph = "ms-appx:///Assets/Settings/Icons/EnvironmentVariables.png", ButtonClickHandler = EnvironmentVariablesLaunchClicked },
|
||||
new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("EnvironmentVariables_LaunchButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("EnvironmentVariables_LaunchButtonControl/Description"), ButtonGlyph = "\uEA37", ButtonClickHandler = EnvironmentVariablesLaunchClicked },
|
||||
};
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
@@ -241,13 +268,26 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
ISettingsRepository<FancyZonesSettings> moduleSettingsRepository = SettingsRepository<FancyZonesSettings>.GetInstance(new SettingsUtils());
|
||||
var settings = moduleSettingsRepository.SettingsConfig;
|
||||
string activationMode = $"{resourceLoader.GetString(settings.Properties.FancyzonesShiftDrag.Value ? "FancyZones_ActivationShiftDrag" : "FancyZones_ActivationNoShiftDrag")}.";
|
||||
string activationMode = $"{resourceLoader.GetString(settings.Properties.FancyzonesShiftDrag.Value ? "FancyZones_ShiftDragCheckBoxControl_Header/Content" : "FancyZones_ActivationNoShiftDrag")}.";
|
||||
if (settings.Properties.FancyzonesMouseSwitch.Value)
|
||||
{
|
||||
activationMode += $" {resourceLoader.GetString("FancyZones_MouseDragCheckBoxControl_Header/Content")}.";
|
||||
}
|
||||
|
||||
var list = new List<DashboardModuleItem>
|
||||
{
|
||||
new DashboardModuleActivationItem() { Label = resourceLoader.GetString("Activate_Zones"), Activation = activationMode },
|
||||
new DashboardModuleTextItem() { Label = activationMode },
|
||||
new DashboardModuleShortcutItem() { Label = resourceLoader.GetString("FancyZones_OpenEditor"), Shortcut = settings.Properties.FancyzonesEditorHotkey.Value.GetKeysList() },
|
||||
new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("FancyZones_LaunchEditorButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("FancyZones_LaunchEditorButtonControl/Description"), ButtonGlyph = "ms-appx:///Assets/Settings/Icons/FancyZones.png", ButtonClickHandler = FancyZoneLaunchClicked },
|
||||
new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("FancyZones_LaunchEditorButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("FancyZones_LaunchEditorButtonControl/Description"), ButtonGlyph = "\uEB3C", ButtonClickHandler = FancyZoneLaunchClicked },
|
||||
};
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
|
||||
private ObservableCollection<DashboardModuleItem> GetModuleItemsFileLocksmith()
|
||||
{
|
||||
var list = new List<DashboardModuleItem>
|
||||
{
|
||||
new DashboardModuleTextItem() { Label = resourceLoader.GetString("FileLocksmith_ShortDescription") },
|
||||
};
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
@@ -266,16 +306,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
else
|
||||
{
|
||||
string activation = string.Empty;
|
||||
switch (activationMethod)
|
||||
{
|
||||
case 2: activation = resourceLoader.GetString("MouseUtils_FindMyMouse_ActivationShakeMouse/Content"); break;
|
||||
case 1: activation = resourceLoader.GetString("MouseUtils_FindMyMouse_ActivationDoubleRightControlPress/Content"); break;
|
||||
case 2: shortDescription += $". {resourceLoader.GetString("Dashboard_Activation")}: {resourceLoader.GetString("MouseUtils_FindMyMouse_ActivationShakeMouse/Content")}"; break;
|
||||
case 1: shortDescription += $". {resourceLoader.GetString("Dashboard_Activation")}: {resourceLoader.GetString("MouseUtils_FindMyMouse_ActivationDoubleRightControlPress/Content")}"; break;
|
||||
case 0:
|
||||
default: activation = resourceLoader.GetString("MouseUtils_FindMyMouse_ActivationDoubleControlPress/Content"); break;
|
||||
default: shortDescription += $". {resourceLoader.GetString("Dashboard_Activation")}: {resourceLoader.GetString("MouseUtils_FindMyMouse_ActivationDoubleControlPress/Content")}"; break;
|
||||
}
|
||||
|
||||
list.Add(new DashboardModuleActivationItem() { Label = resourceLoader.GetString("Dashboard_Activation"), Activation = activation });
|
||||
list.Add(new DashboardModuleTextItem() { Label = shortDescription });
|
||||
}
|
||||
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
@@ -285,7 +324,36 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
var list = new List<DashboardModuleItem>
|
||||
{
|
||||
new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("Hosts_LaunchButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("Hosts_LaunchButtonControl/Description"), ButtonGlyph = "ms-appx:///Assets/Settings/Icons/Hosts.png", ButtonClickHandler = HostLaunchClicked },
|
||||
new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("Hosts_LaunchButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("Hosts_LaunchButtonControl/Description"), ButtonGlyph = "\uEA37", ButtonClickHandler = HostLaunchClicked },
|
||||
};
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
|
||||
private ObservableCollection<DashboardModuleItem> GetModuleItemsImageResizer()
|
||||
{
|
||||
var list = new List<DashboardModuleItem>
|
||||
{
|
||||
new DashboardModuleTextItem() { Label = resourceLoader.GetString("ImageResizer_ShortDescription") },
|
||||
};
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
|
||||
private ObservableCollection<DashboardModuleItem> GetModuleItemsKeyboardManager()
|
||||
{
|
||||
KeyboardManagerProfile kbmProfile = GetKBMProfile();
|
||||
_kbmItem = new DashboardModuleKBMItem() { RemapKeys = kbmProfile?.RemapKeys.InProcessRemapKeys, RemapShortcuts = KeyboardManagerViewModel.CombineShortcutLists(kbmProfile?.RemapShortcuts.GlobalRemapShortcuts, kbmProfile?.RemapShortcuts.AppSpecificRemapShortcuts) };
|
||||
|
||||
_kbmItem.RemapKeys = _kbmItem.RemapKeys.Concat(kbmProfile?.RemapKeysToText.InProcessRemapKeys).ToList();
|
||||
|
||||
var shortcutsToTextRemappings = KeyboardManagerViewModel.CombineShortcutLists(kbmProfile?.RemapShortcutsToText.GlobalRemapShortcuts, kbmProfile?.RemapShortcutsToText.AppSpecificRemapShortcuts);
|
||||
|
||||
_kbmItem.RemapShortcuts = _kbmItem.RemapShortcuts.Concat(shortcutsToTextRemappings).ToList();
|
||||
|
||||
var list = new List<DashboardModuleItem>
|
||||
{
|
||||
_kbmItem,
|
||||
new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("KeyboardManager_RemapKeyboardButton/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("KeyboardManager_RemapKeyboardButton/Description"), ButtonGlyph = "\uE92E", ButtonClickHandler = KbmKeyLaunchClicked },
|
||||
new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("KeyboardManager_RemapShortcutsButton/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("KeyboardManager_RemapShortcutsButton/Description"), ButtonGlyph = "\uE92E", ButtonClickHandler = KbmShortcutLaunchClicked },
|
||||
};
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
@@ -320,6 +388,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
|
||||
private ObservableCollection<DashboardModuleItem> GetModuleItemsMouseWithoutBorders()
|
||||
{
|
||||
var list = new List<DashboardModuleItem>
|
||||
{
|
||||
new DashboardModuleTextItem() { Label = resourceLoader.GetString("MouseWithoutBorders_ShortDescription") },
|
||||
};
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
|
||||
private ObservableCollection<DashboardModuleItem> GetModuleItemsAdvancedPaste()
|
||||
{
|
||||
ISettingsRepository<AdvancedPasteSettings> moduleSettingsRepository = SettingsRepository<AdvancedPasteSettings>.GetInstance(new SettingsUtils());
|
||||
@@ -352,6 +429,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
|
||||
private ObservableCollection<DashboardModuleItem> GetModuleItemsPowerRename()
|
||||
{
|
||||
var list = new List<DashboardModuleItem>
|
||||
{
|
||||
new DashboardModuleTextItem() { Label = resourceLoader.GetString("PowerRename_ShortDescription") },
|
||||
};
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
|
||||
private ObservableCollection<DashboardModuleItem> GetModuleItemsPowerLauncher()
|
||||
{
|
||||
ISettingsRepository<PowerLauncherSettings> moduleSettingsRepository = SettingsRepository<PowerLauncherSettings>.GetInstance(new SettingsUtils());
|
||||
@@ -364,20 +450,20 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
private ObservableCollection<DashboardModuleItem> GetModuleItemsPowerAccent()
|
||||
{
|
||||
string shortDescription = resourceLoader.GetString("PowerAccent_ShortDescription");
|
||||
var settingsUtils = new SettingsUtils();
|
||||
PowerAccentSettings moduleSettings = settingsUtils.GetSettingsOrDefault<PowerAccentSettings>(PowerAccentSettings.ModuleName);
|
||||
var activationMethod = moduleSettings.Properties.ActivationKey;
|
||||
string activation = string.Empty;
|
||||
switch (activationMethod)
|
||||
{
|
||||
case Library.Enumerations.PowerAccentActivationKey.LeftRightArrow: activation = resourceLoader.GetString("QuickAccent_Activation_Key_Arrows/Content"); break;
|
||||
case Library.Enumerations.PowerAccentActivationKey.Space: activation = resourceLoader.GetString("QuickAccent_Activation_Key_Space/Content"); break;
|
||||
case Library.Enumerations.PowerAccentActivationKey.Both: activation = resourceLoader.GetString("QuickAccent_Activation_Key_Either/Content"); break;
|
||||
case Library.Enumerations.PowerAccentActivationKey.LeftRightArrow: shortDescription += $". {resourceLoader.GetString("Dashboard_Activation")}: {resourceLoader.GetString("QuickAccent_Activation_Key_Arrows/Content")}"; break;
|
||||
case Library.Enumerations.PowerAccentActivationKey.Space: shortDescription += $". {resourceLoader.GetString("Dashboard_Activation")}: {resourceLoader.GetString("QuickAccent_Activation_Key_Space/Content")}"; break;
|
||||
case Library.Enumerations.PowerAccentActivationKey.Both: shortDescription += $". {resourceLoader.GetString("Dashboard_Activation")}: {resourceLoader.GetString("QuickAccent_Activation_Key_Either/Content")}"; break;
|
||||
}
|
||||
|
||||
var list = new List<DashboardModuleItem>
|
||||
{
|
||||
new DashboardModuleActivationItem() { Label = resourceLoader.GetString("Dashboard_Activation"), Activation = activation },
|
||||
new DashboardModuleTextItem() { Label = shortDescription },
|
||||
};
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
@@ -390,7 +476,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
var list = new List<DashboardModuleItem>
|
||||
{
|
||||
new DashboardModuleShortcutItem() { Label = resourceLoader.GetString("Workspaces_ShortDescription"), Shortcut = settings.Properties.Hotkey.Value.GetKeysList() },
|
||||
new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("Workspaces_LaunchEditorButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("FancyZones_LaunchEditorButtonControl/Description"), ButtonGlyph = "ms-appx:///Assets/Settings/Icons/Workspaces.png", ButtonClickHandler = WorkspacesLaunchClicked },
|
||||
new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("Workspaces_LaunchEditorButtonControl/Header"), IsButtonDescriptionVisible = true, ButtonDescription = resourceLoader.GetString("FancyZones_LaunchEditorButtonControl/Description"), ButtonGlyph = "\uEB3C", ButtonClickHandler = WorkspacesLaunchClicked },
|
||||
};
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
@@ -399,7 +485,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
var list = new List<DashboardModuleItem>
|
||||
{
|
||||
new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("RegistryPreview_LaunchButtonControl/Header"), ButtonGlyph = "ms-appx:///Assets/Settings/Icons/RegistryPreview.png", ButtonClickHandler = RegistryPreviewLaunchClicked },
|
||||
new DashboardModuleButtonItem() { ButtonTitle = resourceLoader.GetString("RegistryPreview_LaunchButtonControl/Header"), ButtonGlyph = "\uEA37", ButtonClickHandler = RegistryPreviewLaunchClicked },
|
||||
};
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
@@ -439,6 +525,24 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
|
||||
private ObservableCollection<DashboardModuleItem> GetModuleItemsNewPlus()
|
||||
{
|
||||
var list = new List<DashboardModuleItem>
|
||||
{
|
||||
new DashboardModuleTextItem() { Label = resourceLoader.GetString("NewPlus_Product_Description/Description") },
|
||||
};
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
|
||||
private ObservableCollection<DashboardModuleItem> GetModuleItemsZoomIt()
|
||||
{
|
||||
var list = new List<DashboardModuleItem>
|
||||
{
|
||||
new DashboardModuleTextItem() { Label = resourceLoader.GetString("ZoomIt_ShortDescription") },
|
||||
};
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
|
||||
internal void SWVersionButtonClicked()
|
||||
{
|
||||
NavigationService.Navigate(typeof(GeneralPage));
|
||||
@@ -470,6 +574,20 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
SendConfigMSG("{\"action\":{\"Workspaces\":{\"action_name\":\"LaunchEditor\", \"value\":\"\"}}}");
|
||||
}
|
||||
|
||||
private void KbmKeyLaunchClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var settingsUtils = new SettingsUtils();
|
||||
var kbmViewModel = new KeyboardManagerViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, KeyboardManagerPage.FilterRemapKeysList);
|
||||
kbmViewModel.OnRemapKeyboard();
|
||||
}
|
||||
|
||||
private void KbmShortcutLaunchClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var settingsUtils = new SettingsUtils();
|
||||
var kbmViewModel = new KeyboardManagerViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, KeyboardManagerPage.FilterRemapKeysList);
|
||||
kbmViewModel.OnEditShortcut();
|
||||
}
|
||||
|
||||
private void RegistryPreviewLaunchClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var actionName = "Launch";
|
||||
@@ -478,10 +596,20 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
internal void DashboardListItemClick(object sender)
|
||||
{
|
||||
if (sender is SettingsCard card && card.Tag is ModuleType moduleType)
|
||||
Button button = sender as Button;
|
||||
if (button == null)
|
||||
{
|
||||
NavigationService.Navigate(ModuleHelper.GetModulePageType(moduleType));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(button.Tag is ModuleType))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleType moduleType = (ModuleType)button.Tag;
|
||||
|
||||
NavigationService.Navigate(ModuleHelper.GetModulePageType(moduleType));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
51
tools/README-CmdPal-AOT-Analysis.md
Normal file
51
tools/README-CmdPal-AOT-Analysis.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# PowerToys CmdPal AOT 分析工具
|
||||
|
||||
这个工具包用于分析 PowerToys CmdPal 在启用 AOT (Ahead-of-Time) 编译时被移除的类型。
|
||||
|
||||
## 核心文件
|
||||
|
||||
### 分析工具 (`tools/TrimmingAnalyzer/`)
|
||||
- `TrimmingAnalyzer.csproj` - 项目文件
|
||||
- `Program.cs` - 主程序入口
|
||||
- `TypeAnalyzer.cs` - 程序集类型分析引擎
|
||||
- `ReportGenerator.cs` - 报告生成器 (Markdown/XML/JSON)
|
||||
|
||||
### 脚本文件 (`tools/build/`)
|
||||
- `Generate-CmdPalTrimmingReport.ps1` - 主要分析脚本(包含完整说明和自动化流程)
|
||||
|
||||
## 使用方法
|
||||
|
||||
### 前提条件
|
||||
- Visual Studio 2022 with C++ workload
|
||||
- Windows SDK
|
||||
- 使用 Developer Command Prompt for VS 2022
|
||||
|
||||
### 运行分析
|
||||
```powershell
|
||||
cd C:\Users\yuleng\PowerToys
|
||||
.\tools\build\Generate-CmdPalTrimmingReport.ps1
|
||||
```
|
||||
|
||||
### 输出报告
|
||||
- `TrimmedTypes.md` - 人类可读的 Markdown 报告
|
||||
- `TrimmedTypes.rd.xml` - 运行时指令以保留类型
|
||||
- JSON 格式的分析数据
|
||||
|
||||
## 分析原理
|
||||
|
||||
1. **Debug 构建** - 不启用 AOT,保留所有类型
|
||||
2. **Release 构建** - 启用 AOT,移除未使用的类型
|
||||
3. **程序集比较** - 识别被 AOT 优化移除的类型
|
||||
4. **报告生成** - 生成详细的优化效果报告
|
||||
|
||||
## 价值
|
||||
|
||||
- 显示 AOT 优化的有效性
|
||||
- 识别被消除的未使用代码
|
||||
- 帮助理解二进制大小减少
|
||||
- 协助排查运行时反射问题
|
||||
- 为性能优化决策提供数据
|
||||
|
||||
---
|
||||
|
||||
*工具状态: 已完成,等待 Visual Studio C++ 构建环境配置后即可使用*
|
||||
20
tools/TrimmingAnalyzer/Models/TypeInfo.cs
Normal file
20
tools/TrimmingAnalyzer/Models/TypeInfo.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TrimmingAnalyzer.Models
|
||||
{
|
||||
public class TypeInfo
|
||||
{
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
public string Namespace { get; set; } = string.Empty;
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public bool IsPublic { get; set; }
|
||||
public bool IsSealed { get; set; }
|
||||
public bool IsAbstract { get; set; }
|
||||
public bool IsInterface { get; set; }
|
||||
public bool IsEnum { get; set; }
|
||||
public bool IsDelegate { get; set; }
|
||||
public string? BaseType { get; set; }
|
||||
public List<string> Interfaces { get; set; } = new();
|
||||
public int MemberCount { get; set; }
|
||||
}
|
||||
}
|
||||
59
tools/TrimmingAnalyzer/Program.cs
Normal file
59
tools/TrimmingAnalyzer/Program.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace TrimmingAnalyzer
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (args.Length < 3)
|
||||
{
|
||||
Console.WriteLine("Usage: TrimmingAnalyzer <untrimmed.dll> <trimmed.dll> <output-dir> [formats]");
|
||||
Console.WriteLine("Formats: rdxml,markdown (default: rdxml,markdown)");
|
||||
return;
|
||||
}
|
||||
|
||||
var untrimmedPath = Path.GetFullPath(args[0]);
|
||||
var trimmedPath = Path.GetFullPath(args[1]);
|
||||
var outputDir = Path.GetFullPath(args[2]);
|
||||
var formats = args.Length > 3 ? args[3].Split(',') : new[] { "rdxml", "markdown" };
|
||||
|
||||
try
|
||||
{
|
||||
Console.WriteLine("Analyzing assemblies...");
|
||||
var analyzer = new TypeAnalyzer();
|
||||
var removedTypes = analyzer.GetRemovedTypes(untrimmedPath, trimmedPath);
|
||||
|
||||
Console.WriteLine($"Found {removedTypes.Count} trimmed types");
|
||||
|
||||
var generator = new ReportGenerator();
|
||||
|
||||
foreach (var format in formats)
|
||||
{
|
||||
switch (format.Trim().ToLower())
|
||||
{
|
||||
case "rdxml":
|
||||
var rdxmlPath = Path.Combine(outputDir, "TrimmedTypes.rd.xml");
|
||||
generator.GenerateRdXml(removedTypes, rdxmlPath);
|
||||
Console.WriteLine($"Generated: {rdxmlPath}");
|
||||
break;
|
||||
case "markdown":
|
||||
var markdownPath = Path.Combine(outputDir, "TrimmedTypes.md");
|
||||
generator.GenerateMarkdown(removedTypes, markdownPath);
|
||||
Console.WriteLine($"Generated: {markdownPath}");
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine($"Unknown format: {format}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Error: {ex.Message}");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
167
tools/TrimmingAnalyzer/ReportGenerator.cs
Normal file
167
tools/TrimmingAnalyzer/ReportGenerator.cs
Normal file
@@ -0,0 +1,167 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Xml.Linq;
|
||||
using TrimmingAnalyzer.Models;
|
||||
|
||||
namespace TrimmingAnalyzer
|
||||
{
|
||||
public class ReportGenerator
|
||||
{
|
||||
public void GenerateRdXml(List<TypeInfo> removedTypes, string outputPath)
|
||||
{
|
||||
var typesByNamespace = removedTypes.GroupBy(t => t.Namespace);
|
||||
|
||||
// Define the namespace
|
||||
XNamespace ns = "http://schemas.microsoft.com/netfx/2013/01/metadata";
|
||||
|
||||
var doc = new XDocument(
|
||||
new XElement(ns + "Directives",
|
||||
new XElement(ns + "Application",
|
||||
new XComment($"CmdPal Trimming Report - Generated on {DateTime.Now:yyyy-MM-dd HH:mm:ss}"),
|
||||
new XComment($"Total types trimmed: {removedTypes.Count}"),
|
||||
new XComment("TrimMode: partial (as configured in Microsoft.CmdPal.UI.csproj)"),
|
||||
new XElement(ns + "Assembly",
|
||||
new XAttribute("Name", "Microsoft.CmdPal.UI"),
|
||||
new XAttribute("Dynamic", "Required All"),
|
||||
typesByNamespace.Select(g =>
|
||||
new XElement(ns + "Namespace",
|
||||
new XAttribute("Name", g.Key),
|
||||
new XAttribute("Preserve", "All"),
|
||||
new XAttribute("Dynamic", "Required All"),
|
||||
g.Select(type =>
|
||||
new XElement(ns + "Type",
|
||||
new XAttribute("Name", type.Name),
|
||||
new XAttribute("Dynamic", "Required All"),
|
||||
new XAttribute("Serialize", "All"),
|
||||
new XAttribute("DataContractSerializer", "All"),
|
||||
new XAttribute("DataContractJsonSerializer", "All"),
|
||||
new XAttribute("XmlSerializer", "All"),
|
||||
new XAttribute("MarshalObject", "All"),
|
||||
new XAttribute("MarshalDelegate", "All")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(outputPath) ?? ".");
|
||||
doc.Save(outputPath);
|
||||
}
|
||||
|
||||
public void GenerateMarkdown(List<TypeInfo> removedTypes, string outputPath)
|
||||
{
|
||||
GenerateMarkdown(removedTypes, outputPath, null);
|
||||
}
|
||||
|
||||
public void GenerateMarkdown(List<TypeInfo> removedTypes, string outputPath, List<string>? assemblyNames)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine("# CmdPal Debug vs AOT Release Comparison Report");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine($"**Generated:** {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine($"**Comparison:** Debug Build (no AOT) vs Release Build (with AOT)");
|
||||
sb.AppendLine($"**Purpose:** Show types removed when enabling AOT compilation in Release mode");
|
||||
sb.AppendLine();
|
||||
|
||||
if (assemblyNames != null && assemblyNames.Count > 0)
|
||||
{
|
||||
sb.AppendLine($"**Analyzed assemblies:** {string.Join(", ", assemblyNames.Distinct().OrderBy(x => x))}");
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
sb.AppendLine($"**Total types removed by AOT:** {removedTypes.Count}");
|
||||
sb.AppendLine();
|
||||
|
||||
// Summary by namespace
|
||||
sb.AppendLine("## Summary by Namespace");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("| Namespace | Types Trimmed |");
|
||||
sb.AppendLine("|-----------|---------------|");
|
||||
|
||||
foreach (var group in removedTypes.GroupBy(t => t.Namespace).OrderBy(g => g.Key))
|
||||
{
|
||||
sb.AppendLine($"| `{group.Key}` | {group.Count()} |");
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("## Detailed Type List");
|
||||
sb.AppendLine();
|
||||
|
||||
foreach (var group in removedTypes.GroupBy(t => t.Namespace).OrderBy(g => g.Key))
|
||||
{
|
||||
sb.AppendLine($"### {group.Key}");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("| Type | Kind | Visibility | Base Type | Interfaces | Members |");
|
||||
sb.AppendLine("|------|------|------------|-----------|------------|---------|");
|
||||
|
||||
foreach (var type in group.OrderBy(t => t.Name))
|
||||
{
|
||||
var kind = GetTypeKind(type);
|
||||
var visibility = type.IsPublic ? "Public" : "Internal";
|
||||
var baseType = string.IsNullOrEmpty(type.BaseType) ? "-" : $"`{type.BaseType.Split('.').Last()}`";
|
||||
var interfaces = type.Interfaces.Any()
|
||||
? string.Join(", ", type.Interfaces.Take(3).Select(i => $"`{i.Split('.').Last()}`")) +
|
||||
(type.Interfaces.Count > 3 ? "..." : "")
|
||||
: "-";
|
||||
|
||||
sb.AppendLine($"| `{type.Name}` | {kind} | {visibility} | {baseType} | {interfaces} | {type.MemberCount} |");
|
||||
}
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
// Add usage instructions
|
||||
sb.AppendLine("## How to Use This Report");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("If you need to preserve any of these types from trimming:");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("1. Copy the relevant entries from `TrimmedTypes.rd.xml` to your project's `rd.xml` file");
|
||||
sb.AppendLine("2. Or use `[DynamicallyAccessedMembers]` attributes in your code");
|
||||
sb.AppendLine("3. Or use `[DynamicDependency]` attributes to preserve specific members");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Note: This report shows types that are present in Debug builds but removed in AOT Release builds.");
|
||||
sb.AppendLine("AOT compilation removes unused types and members to reduce binary size and improve startup performance.");
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(outputPath) ?? ".");
|
||||
File.WriteAllText(outputPath, sb.ToString());
|
||||
}
|
||||
|
||||
public void GenerateJson(List<TypeInfo> removedTypes, string outputPath, string assemblyName)
|
||||
{
|
||||
var analysisResult = new
|
||||
{
|
||||
AssemblyName = assemblyName,
|
||||
GeneratedAt = DateTime.Now,
|
||||
TotalTypes = removedTypes.Count,
|
||||
RemovedTypes = removedTypes.OrderBy(t => t.FullName).ToList()
|
||||
};
|
||||
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true,
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
|
||||
};
|
||||
|
||||
var json = JsonSerializer.Serialize(analysisResult, options);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(outputPath) ?? ".");
|
||||
File.WriteAllText(outputPath, json);
|
||||
}
|
||||
|
||||
private string GetTypeKind(TypeInfo type)
|
||||
{
|
||||
if (type.IsInterface) return "Interface";
|
||||
if (type.IsEnum) return "Enum";
|
||||
if (type.IsDelegate) return "Delegate";
|
||||
if (type.IsAbstract) return "Abstract Class";
|
||||
if (type.IsSealed) return "Sealed Class";
|
||||
return "Class";
|
||||
}
|
||||
}
|
||||
}
|
||||
26
tools/TrimmingAnalyzer/TrimmingAnalyzer.csproj
Normal file
26
tools/TrimmingAnalyzer/TrimmingAnalyzer.csproj
Normal file
@@ -0,0 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<EnableDefaultItems>false</EnableDefaultItems>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningsAsErrors />
|
||||
<WarningsNotAsErrors />
|
||||
<NoWarn>SA1633;SA1400;SA1518;SA1516;SA1503;SA1111;SA1116;SA1122;SA1028;SA1413;SA1513;CA1311;CA1304;CA1305;CA1860;CA1852</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="TypeAnalyzer.cs" />
|
||||
<Compile Include="ReportGenerator.cs" />
|
||||
<Compile Include="Models\TypeInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Text.Json" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
79
tools/TrimmingAnalyzer/TypeAnalyzer.cs
Normal file
79
tools/TrimmingAnalyzer/TypeAnalyzer.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Loader;
|
||||
using TrimmingAnalyzer.Models;
|
||||
|
||||
namespace TrimmingAnalyzer
|
||||
{
|
||||
public class TypeAnalyzer
|
||||
{
|
||||
public List<Models.TypeInfo> GetRemovedTypes(string untrimmedPath, string trimmedPath)
|
||||
{
|
||||
if (!File.Exists(untrimmedPath))
|
||||
{
|
||||
throw new FileNotFoundException($"Untrimmed assembly not found: {untrimmedPath}");
|
||||
}
|
||||
|
||||
if (!File.Exists(trimmedPath))
|
||||
{
|
||||
throw new FileNotFoundException($"Trimmed assembly not found: {trimmedPath}");
|
||||
}
|
||||
|
||||
var removedTypes = new List<Models.TypeInfo>();
|
||||
|
||||
var untrimmedContext = new AssemblyLoadContext("Untrimmed", true);
|
||||
var trimmedContext = new AssemblyLoadContext("Trimmed", true);
|
||||
|
||||
try
|
||||
{
|
||||
var untrimmedAssembly = untrimmedContext.LoadFromAssemblyPath(untrimmedPath);
|
||||
var trimmedAssembly = trimmedContext.LoadFromAssemblyPath(trimmedPath);
|
||||
|
||||
var untrimmedTypes = untrimmedAssembly.GetTypes().Where(t => t.FullName != null).ToDictionary(t => t.FullName!);
|
||||
var trimmedTypeNames = trimmedAssembly.GetTypes().Where(t => t.FullName != null).Select(t => t.FullName!).ToHashSet();
|
||||
|
||||
foreach (var kvp in untrimmedTypes)
|
||||
{
|
||||
if (!trimmedTypeNames.Contains(kvp.Key))
|
||||
{
|
||||
var type = kvp.Value;
|
||||
var typeInfo = new Models.TypeInfo
|
||||
{
|
||||
FullName = type.FullName ?? string.Empty,
|
||||
Namespace = type.Namespace ?? "Global",
|
||||
Name = type.Name,
|
||||
IsPublic = type.IsPublic,
|
||||
IsSealed = type.IsSealed,
|
||||
IsAbstract = type.IsAbstract,
|
||||
IsInterface = type.IsInterface,
|
||||
IsEnum = type.IsEnum,
|
||||
IsDelegate = type.IsSubclassOf(typeof(Delegate)),
|
||||
BaseType = type.BaseType?.FullName,
|
||||
Interfaces = type.GetInterfaces().Select(i => i.FullName ?? string.Empty).ToList(),
|
||||
MemberCount = type.GetMembers(
|
||||
BindingFlags.Public | BindingFlags.NonPublic |
|
||||
BindingFlags.Instance | BindingFlags.Static |
|
||||
BindingFlags.DeclaredOnly).Length,
|
||||
};
|
||||
|
||||
removedTypes.Add(typeInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new InvalidOperationException($"Error analyzing assemblies: {ex.Message}", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
untrimmedContext.Unload();
|
||||
trimmedContext.Unload();
|
||||
}
|
||||
|
||||
return removedTypes.OrderBy(t => t.Namespace).ThenBy(t => t.Name).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
168
tools/build/Generate-CmdPalTrimmingReport.ps1
Normal file
168
tools/build/Generate-CmdPalTrimmingReport.ps1
Normal file
@@ -0,0 +1,168 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
PowerToys CmdPal AOT Trimming Analysis - Generates assembly comparison reports
|
||||
|
||||
.DESCRIPTION
|
||||
This script builds CmdPal UI with and without AOT optimization, then uses TrimmingAnalyzer
|
||||
to analyze the differences and generate reports showing which types are removed by AOT.
|
||||
|
||||
ANALYSIS PROCESS:
|
||||
1. Build Debug version (no AOT optimization)
|
||||
2. Build Release version (with AOT optimization)
|
||||
3. Compare assemblies to identify removed types
|
||||
4. Generate reports: TrimmedTypes.md, TrimmedTypes.rd.xml
|
||||
|
||||
REQUIREMENTS:
|
||||
• Visual Studio 2022 with C++ workload
|
||||
• Windows SDK
|
||||
• Use Developer Command Prompt for VS 2022
|
||||
|
||||
OUTPUT REPORTS:
|
||||
• TrimmedTypes.md - Human-readable Markdown report
|
||||
• TrimmedTypes.rd.xml - Runtime directives to preserve types
|
||||
• Analysis JSON data for further processing
|
||||
|
||||
.PARAMETER Configuration
|
||||
Build configuration (Debug/Release). Defaults to Release
|
||||
|
||||
.PARAMETER EnableAOT
|
||||
Whether to enable AOT compilation. Defaults to true
|
||||
|
||||
.EXAMPLE
|
||||
.\Generate-CmdPalTrimmingReport.ps1
|
||||
|
||||
Runs the complete AOT trimming analysis with default settings
|
||||
|
||||
.NOTES
|
||||
Author: PowerToys CmdPal AOT Analysis Tool
|
||||
Purpose: Show types removed when enabling AOT compilation
|
||||
#>
|
||||
|
||||
param(
|
||||
[string]$Configuration = "Release",
|
||||
[bool]$EnableAOT = $true
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Write-Host "======================================" -ForegroundColor Cyan
|
||||
Write-Host "PowerToys CmdPal AOT Trimming Analysis" -ForegroundColor Cyan
|
||||
Write-Host "======================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "PURPOSE: Generate reports showing types removed by AOT optimization" -ForegroundColor Yellow
|
||||
Write-Host "OUTPUT: TrimmedTypes.md, TrimmedTypes.rd.xml, analysis data" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
|
||||
# Get paths
|
||||
$rootDir = Resolve-Path (Join-Path $PSScriptRoot "..\..")
|
||||
$cmdPalProject = Join-Path $rootDir "src\modules\cmdpal\Microsoft.CmdPal.UI\Microsoft.CmdPal.UI.csproj"
|
||||
$cmdPalDir = Split-Path -Parent $cmdPalProject
|
||||
$analyzerProject = Join-Path $rootDir "tools\TrimmingAnalyzer\TrimmingAnalyzer.csproj"
|
||||
|
||||
# Build paths
|
||||
$tempDir = Join-Path $env:TEMP "CmdPalTrimAnalysis_$(Get-Date -Format 'yyyyMMdd_HHmmss')"
|
||||
$untrimmedDir = Join-Path $tempDir "untrimmed"
|
||||
$trimmedDir = Join-Path $tempDir "trimmed"
|
||||
|
||||
# Ensure all NuGet packages are restored
|
||||
Write-Host "Restoring NuGet packages..." -ForegroundColor Yellow
|
||||
& dotnet restore $cmdPalProject
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Warning "Package restore had some issues, but continuing..."
|
||||
}
|
||||
|
||||
try {
|
||||
# Create directories
|
||||
New-Item -ItemType Directory -Path $untrimmedDir -Force | Out-Null
|
||||
New-Item -ItemType Directory -Path $trimmedDir -Force | Out-Null
|
||||
|
||||
# Build TrimmingAnalyzer
|
||||
Write-Host "Building TrimmingAnalyzer tool..." -ForegroundColor Yellow
|
||||
& dotnet build $analyzerProject -c Release
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Failed to build TrimmingAnalyzer"
|
||||
}
|
||||
|
||||
# Build Debug mode without AOT (baseline for comparison)
|
||||
Write-Host "Building CmdPal in Debug mode without AOT (baseline)..." -ForegroundColor Yellow
|
||||
& dotnet publish $cmdPalProject `
|
||||
--configuration Debug `
|
||||
--runtime win-x64 `
|
||||
--self-contained true `
|
||||
--property:PublishTrimmed=false `
|
||||
--property:EnableCmdPalAOT=false `
|
||||
--property:PublishAot=false `
|
||||
--verbosity minimal
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Failed to build Debug baseline version"
|
||||
}
|
||||
|
||||
# Copy baseline (Debug without AOT) output to analysis directory
|
||||
$baselineOutput = Join-Path $cmdPalDir "bin\Debug\net9.0-windows10.0.26100.0\win-x64\publish"
|
||||
Copy-Item "$baselineOutput\Microsoft.CmdPal.UI.dll" $untrimmedDir -Force
|
||||
# Copy all dependencies to help with assembly resolution
|
||||
Get-ChildItem "$baselineOutput\*.dll" | ForEach-Object {
|
||||
if ($_.Name -ne "Microsoft.CmdPal.UI.dll") {
|
||||
Copy-Item $_.FullName $untrimmedDir -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
Write-Host "Copied Debug baseline DLLs from: $baselineOutput"
|
||||
|
||||
# Build Release mode with AOT enabled
|
||||
Write-Host "Building CmdPal in Release mode with AOT enabled..." -ForegroundColor Yellow
|
||||
& dotnet publish $cmdPalProject `
|
||||
--configuration Release `
|
||||
--runtime win-x64 `
|
||||
--self-contained true `
|
||||
--property:PublishTrimmed=false `
|
||||
--property:EnableCmdPalAOT=true `
|
||||
--property:PublishAot=true `
|
||||
--verbosity minimal
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Failed to build AOT+trimmed version"
|
||||
}
|
||||
|
||||
# Copy AOT+trimmed output to analysis directory
|
||||
$trimmedOutput = Join-Path $cmdPalDir "bin\$Configuration\net9.0-windows10.0.26100.0\win-x64\publish"
|
||||
Copy-Item "$trimmedOutput\Microsoft.CmdPal.UI.dll" $trimmedDir -Force
|
||||
# Copy all dependencies to help with assembly resolution
|
||||
Get-ChildItem "$trimmedOutput\*.dll" | ForEach-Object {
|
||||
if ($_.Name -ne "Microsoft.CmdPal.UI.dll") {
|
||||
Copy-Item $_.FullName $trimmedDir -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
Write-Host "Copied Release AOT DLLs from: $trimmedOutput"
|
||||
|
||||
# Use new directory comparison method to compare all types
|
||||
Write-Host "Analyzing differences (Debug baseline vs Release AOT)..." -ForegroundColor Yellow
|
||||
Write-Host "Using advanced directory comparison to detect AOT-optimized types..." -ForegroundColor Cyan
|
||||
|
||||
# Use the new directory comparison feature
|
||||
& $analyzerPath --compare-directories "$untrimmedDir" "$trimmedDir" "$cmdPalDir" "rdxml,markdown,json" "TrimmedTypes"
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "Analysis completed successfully!" -ForegroundColor Green
|
||||
} else {
|
||||
throw "Analysis failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
Write-Host "`n===== Analysis Complete =====" -ForegroundColor Cyan
|
||||
Write-Host "Reports generated in: $cmdPalDir" -ForegroundColor Green
|
||||
|
||||
# List the main combined reports
|
||||
$mainReports = @("TrimmedTypes.md", "TrimmedTypes.rd.xml")
|
||||
foreach ($report in $mainReports) {
|
||||
$reportPath = Join-Path $cmdPalDir $report
|
||||
if (Test-Path $reportPath) {
|
||||
Write-Host " - $report" -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
|
||||
} finally {
|
||||
# Cleanup
|
||||
if (Test-Path $tempDir) {
|
||||
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user