Compare commits
21 Commits
v0.80.1
...
dabhatti/d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dca8ebbe48 | ||
|
|
ca4ee2bced | ||
|
|
f352cf0ead | ||
|
|
7b51a0eca2 | ||
|
|
4e028510b7 | ||
|
|
d0b1247ed1 | ||
|
|
ddf22c106f | ||
|
|
0a9e1ce68d | ||
|
|
071ecc5928 | ||
|
|
bfcc0b002b | ||
|
|
f1c78b0c0d | ||
|
|
126e3f9239 | ||
|
|
7793a19151 | ||
|
|
b6e79b7f93 | ||
|
|
a6525a9c46 | ||
|
|
1aea2a789a | ||
|
|
0835b96b07 | ||
|
|
11faa7702d | ||
|
|
a631518680 | ||
|
|
fada064917 | ||
|
|
2a6d3b2094 |
2
.github/actions/spell-check/allow/names.txt
vendored
@@ -46,7 +46,6 @@ chrdavis
|
||||
Chrzan
|
||||
clayton
|
||||
Coplen
|
||||
craigloewen
|
||||
crutkas
|
||||
damienleroy
|
||||
davidegiacometti
|
||||
@@ -88,7 +87,6 @@ martinchrzan
|
||||
martinmoene
|
||||
Melman
|
||||
Mikhayelyan
|
||||
msft
|
||||
Myrvold
|
||||
Nemeth
|
||||
nielslaute
|
||||
|
||||
7
.github/actions/spell-check/expect.txt
vendored
@@ -54,7 +54,7 @@ Apm
|
||||
APPBARDATA
|
||||
appdata
|
||||
APPEXECLINK
|
||||
Appium
|
||||
appium
|
||||
Applicationcan
|
||||
appmanifest
|
||||
APPNAME
|
||||
@@ -929,7 +929,6 @@ mscorlib
|
||||
msdata
|
||||
msedge
|
||||
MSGFLT
|
||||
msiexec
|
||||
MSIFASTINSTALL
|
||||
MSIHANDLE
|
||||
msiquery
|
||||
@@ -1029,7 +1028,6 @@ NOSIZE
|
||||
NOTIFICATIONSDLL
|
||||
NOTIFYICONDATAW
|
||||
NOTIMPL
|
||||
notlike
|
||||
NOTOPMOST
|
||||
NOTRACK
|
||||
NOTSRCCOPY
|
||||
@@ -1613,7 +1611,6 @@ TRAYMOUSEMESSAGE
|
||||
triaging
|
||||
TRK
|
||||
trl
|
||||
trx
|
||||
Tsd
|
||||
TServer
|
||||
TStr
|
||||
@@ -1715,12 +1712,10 @@ vscdb
|
||||
vsconfig
|
||||
VSCROLL
|
||||
vsetq
|
||||
VSINSTALLDIR
|
||||
VSM
|
||||
vso
|
||||
vsonline
|
||||
vstemplate
|
||||
vstest
|
||||
VSTHRD
|
||||
VSTT
|
||||
vswhere
|
||||
|
||||
33
.github/workflows/similarIssues.yml
vendored
@@ -1,33 +0,0 @@
|
||||
name: GitGudSimilarIssues comments
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
getSimilarIssues:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
message: ${{ steps.getBody.outputs.message }}
|
||||
steps:
|
||||
- id: getBody
|
||||
uses: craigloewen-msft/GitGudSimilarIssues@main
|
||||
with:
|
||||
issueTitle: ${{ github.event.issue.title }}
|
||||
issueBody: ${{ github.event.issue.body }}
|
||||
repo: ${{ github.repository }}
|
||||
similarityTolerance: "0.75"
|
||||
add-comment:
|
||||
needs: getSimilarIssues
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
if: needs.getSimilarIssues.outputs.message != ''
|
||||
steps:
|
||||
- name: Add comment
|
||||
run: gh issue comment "$NUMBER" --repo "$REPO" --body "$BODY"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NUMBER: ${{ github.event.issue.number }}
|
||||
REPO: ${{ github.repository }}
|
||||
BODY: ${{ needs.getSimilarIssues.outputs.message }}
|
||||
2
.gitignore
vendored
@@ -33,8 +33,6 @@ bld/
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
Generated/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
{
|
||||
"Version": "1.0.0",
|
||||
"UseMinimatch": false,
|
||||
"SignBatches": [
|
||||
{
|
||||
"MatchedPath": [
|
||||
"Microsoft.PowerToys.Configure.psm1",
|
||||
"Microsoft.PowerToys.Configure.psd1"
|
||||
],
|
||||
"SigningInfo": {
|
||||
"Operations": [
|
||||
{
|
||||
"KeyCode": "CP-230012",
|
||||
"OperationSetCode": "SigntoolSign",
|
||||
"Parameters": [
|
||||
{
|
||||
"parameterName": "OpusName",
|
||||
"parameterValue": "Microsoft"
|
||||
},
|
||||
{
|
||||
"parameterName": "OpusInfo",
|
||||
"parameterValue": "http://www.microsoft.com"
|
||||
},
|
||||
{
|
||||
"parameterName": "FileDigest",
|
||||
"parameterValue": "/fd \"SHA256\""
|
||||
},
|
||||
{
|
||||
"parameterName": "PageHash",
|
||||
"parameterValue": "/NPH"
|
||||
},
|
||||
{
|
||||
"parameterName": "TimeStamp",
|
||||
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
|
||||
}
|
||||
],
|
||||
"ToolName": "sign",
|
||||
"ToolVersion": "1.0"
|
||||
},
|
||||
{
|
||||
"KeyCode": "CP-230012",
|
||||
"OperationSetCode": "SigntoolVerify",
|
||||
"Parameters": [],
|
||||
"ToolName": "sign",
|
||||
"ToolVersion": "1.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
"*.resources.dll",
|
||||
|
||||
"WinUI3Apps\\Assets\\Settings\\Scripts\\*.ps1",
|
||||
|
||||
|
||||
"PowerToys.ActionRunner.exe",
|
||||
"PowerToys.Update.exe",
|
||||
"PowerToys.BackgroundActivatorDLL.dll",
|
||||
@@ -54,7 +54,6 @@
|
||||
"fancyzones.dll",
|
||||
"PowerToys.FancyZonesEditor.exe",
|
||||
"PowerToys.FancyZonesEditor.dll",
|
||||
"PowerToys.FancyZonesEditorCommon.dll",
|
||||
"PowerToys.FancyZonesModuleInterface.dll",
|
||||
"PowerToys.FancyZones.exe",
|
||||
|
||||
@@ -97,7 +96,8 @@
|
||||
|
||||
"WinUI3Apps\\PowerToys.HostsModuleInterface.dll",
|
||||
"WinUI3Apps\\PowerToys.Hosts.dll",
|
||||
"WinUI3Apps\\PowerToys.Hosts.exe",
|
||||
"WinUI3Apps\\PowerToys.HostsPackageConsumer.dll",
|
||||
"WinUI3Apps\\PowerToys.HostsPackageConsumer.exe",
|
||||
|
||||
"WinUI3Apps\\PowerToys.FileLocksmithLib.Interop.dll",
|
||||
"WinUI3Apps\\PowerToys.FileLocksmithExt.dll",
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
|
||||
$WinAppDriverDownloadUrl = "https://github.com/microsoft/WinAppDriver/releases/download/v1.2.1/WindowsApplicationDriver_1.2.1.msi"
|
||||
|
||||
# Download WinAppDriver and verify their hash sums
|
||||
Invoke-WebRequest -Uri $WinAppDriverDownloadUrl -OutFile "$($ENV:Temp)\WindowsApplicationDriver_1.2.1.msi"
|
||||
$Hash = (Get-FileHash -Algorithm SHA256 "$($ENV:Temp)\WindowsApplicationDriver_1.2.1.msi").Hash
|
||||
if ($Hash -ne 'a76a8f4e44b29bad331acf6b6c248fcc65324f502f28826ad2acd5f3c80857fe')
|
||||
{
|
||||
Write-Error "$WinAppDriverHash"
|
||||
throw "WindowsApplicationDriver_1.2.1.msi has unexpected SHA256 hash: $Hash"
|
||||
}
|
||||
|
||||
# Install WinAppDriver
|
||||
Start-Process msiexec.exe -Wait -ArgumentList "/I $($ENV:Temp)\WindowsApplicationDriver_1.2.1.msi /quiet /passive"
|
||||
@@ -33,7 +33,4 @@ jobs:
|
||||
platform: x64
|
||||
- template: ./templates/build-powertoys-ci.yml
|
||||
parameters:
|
||||
platform: arm64
|
||||
- template: ./templates/run-ui-tests-ci.yml
|
||||
parameters:
|
||||
platform: x64
|
||||
platform: arm64
|
||||
@@ -91,21 +91,21 @@ steps:
|
||||
displayName: 'nuget restore packages.config'
|
||||
|
||||
- task: VSBuild@1
|
||||
displayName: 'Build and Test PowerToys.sln'
|
||||
displayName: 'Build PowerToys.sln'
|
||||
inputs:
|
||||
solution: '**\PowerToys.sln'
|
||||
vsVersion: 17.0
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
${{ if eq(parameters.enableCaching, true) }}:
|
||||
msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} -t:Build;Test -graph -reportfileaccesses -p:MSBuildCacheEnabled=true -p:MSBuildCacheLogDirectory=$(Build.ArtifactStagingDirectory)\logs\MSBuildCache -bl:$(Build.ArtifactStagingDirectory)\logs\PowerToys.binlog -ds:false
|
||||
msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} -graph -reportfileaccesses -p:MSBuildCacheEnabled=true -p:MSBuildCacheLogDirectory=$(Build.ArtifactStagingDirectory)\logs\MSBuildCache -bl:$(Build.ArtifactStagingDirectory)\logs\PowerToys.binlog -ds:false
|
||||
${{ else }}:
|
||||
msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} -t:Build;Test -graph -bl:$(Build.ArtifactStagingDirectory)\logs\PowerToys.binlog -ds:false
|
||||
msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} -bl:$(Build.ArtifactStagingDirectory)\logs\PowerToys.binlog -ds:false
|
||||
msbuildArchitecture: x64
|
||||
maximumCpuCount: true
|
||||
${{ if eq(parameters.enableCaching, true) }}:
|
||||
env:
|
||||
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
||||
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
||||
|
||||
- task: VSBuild@1
|
||||
displayName: 'Build BugReportTool.sln'
|
||||
@@ -114,7 +114,7 @@ steps:
|
||||
vsVersion: 17.0
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} -graph -bl:$(Build.ArtifactStagingDirectory)\logs\BugReportTool.binlog -ds:false
|
||||
msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} -bl:$(Build.ArtifactStagingDirectory)\logs\BugReportTool.binlog -ds:false
|
||||
msbuildArchitecture: x64
|
||||
maximumCpuCount: true
|
||||
|
||||
@@ -125,7 +125,7 @@ steps:
|
||||
vsVersion: 17.0
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} -graph -bl:$(Build.ArtifactStagingDirectory)\logs\WebcamReportTool.binlog -ds:false
|
||||
msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} -bl:$(Build.ArtifactStagingDirectory)\logs\WebcamReportTool.binlog -ds:false
|
||||
msbuildArchitecture: x64
|
||||
maximumCpuCount: true
|
||||
|
||||
@@ -136,7 +136,7 @@ steps:
|
||||
vsVersion: 17.0
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} -graph -bl:$(Build.ArtifactStagingDirectory)\logs\StylesReportTool.binlog -ds:false
|
||||
msbuildArgs: -restore ${{ parameters.additionalBuildArguments }} -bl:$(Build.ArtifactStagingDirectory)\logs\StylesReportTool.binlog -ds:false
|
||||
msbuildArchitecture: x64
|
||||
maximumCpuCount: true
|
||||
|
||||
@@ -222,13 +222,47 @@ steps:
|
||||
arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps'
|
||||
pwsh: true
|
||||
|
||||
# Publish test results which ran in MSBuild
|
||||
- task: PublishTestResults@2
|
||||
displayName: 'Publish Test Results'
|
||||
# directly not doing WinAppDriver testing
|
||||
- task: VSTest@2
|
||||
displayName: 'MS Tests'
|
||||
condition: ne(variables['BuildPlatform'], 'arm64') # No arm64 agents to run the tests.
|
||||
inputs:
|
||||
testResultsFormat: VSTest
|
||||
testResultsFiles: '**/*.trx'
|
||||
condition: always()
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
testSelector: 'testAssemblies'
|
||||
testAssemblyVer2: |
|
||||
**\UnitTests-GcodeThumbnailProvider.dll
|
||||
**\UnitTests-StlThumbnailProvider.dll
|
||||
**\UnitTests-PdfThumbnailProvider.dll
|
||||
**\UnitTests-QoiThumbnailProvider.dll
|
||||
**\Settings.UI.UnitTests.dll
|
||||
**\UnitTests-GcodePreviewHandler.dll
|
||||
**\UnitTests-QoiPreviewHandler.dll
|
||||
**\UnitTests-FancyZonesEditor.dll
|
||||
**\UnitTests-PdfPreviewHandler.dll
|
||||
**\UnitTests-PreviewHandlerCommon.dll
|
||||
**\Microsoft.PowerToys.Run.Plugin.Registry.UnitTests.dll
|
||||
**\UnitTest-ColorPickerUI.dll
|
||||
**\Microsoft.Interop.Tests.dll
|
||||
**\ImageResizer.Test.dll
|
||||
**\Community.PowerToys.Run.Plugin.UnitConverter.UnitTest.dll
|
||||
**\Community.PowerToys.Run.Plugin.ValueGenerator.UnitTests.dll
|
||||
**\Microsoft.Plugin.Folder.UnitTests.dll
|
||||
**\Microsoft.Plugin.Program.UnitTests.dll
|
||||
**\Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.dll
|
||||
**\Microsoft.Plugin.Uri.UnitTests.dll
|
||||
**\Wox.Test.dll
|
||||
**\Microsoft.PowerToys.Run.Plugin.System.UnitTests.dll
|
||||
**\Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests.dll
|
||||
**\Microsoft.Plugin.WindowsTerminal.UnitTests.dll
|
||||
**\Microsoft.Plugin.WindowWalker.UnitTests.dll
|
||||
**\PreviewPaneUnitTests.dll
|
||||
**\UnitTests-SvgThumbnailProvider.dll
|
||||
**\UnitTests-SvgPreviewHandler.dll
|
||||
**\PowerToys.Hosts.Tests.dll
|
||||
**\MouseJumpUI.UnitTests.dll
|
||||
!**\obj\**
|
||||
!**\ref\**
|
||||
|
||||
# Native dlls
|
||||
- task: VSTest@2
|
||||
@@ -243,6 +277,7 @@ steps:
|
||||
**\KeyboardManagerEditorTest.dll
|
||||
**\UnitTests-CommonLib.dll
|
||||
**\PowerRenameUnitTests.dll
|
||||
**\powerpreviewTest.dll
|
||||
**\UnitTests-FancyZones.dll
|
||||
!**\obj\**
|
||||
|
||||
@@ -264,16 +299,3 @@ steps:
|
||||
displayName: Publish Logs
|
||||
artifact: '$(System.JobDisplayName) logs'
|
||||
condition: always()
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: Copy Build Files
|
||||
condition: and(succeeded(), ne(variables['BuildPlatform'],'arm64'))
|
||||
inputs:
|
||||
sourceFolder: '$(Build.SourcesDirectory)'
|
||||
contents: '$(BuildPlatform)/$(BuildConfiguration)/**/*'
|
||||
targetFolder: '$(Build.ArtifactStagingDirectory)\$(BuildPlatform)\$(BuildConfiguration)'
|
||||
|
||||
- publish: $(Build.ArtifactStagingDirectory)\$(BuildPlatform)\$(BuildConfiguration)
|
||||
displayName: Publish Build Artifacts
|
||||
artifact: build-$(BuildPlatform)-$(BuildConfiguration)
|
||||
condition: and(succeeded(), ne(variables['BuildPlatform'],'arm64'))
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
parameters:
|
||||
configuration: 'Release'
|
||||
platform: ''
|
||||
|
||||
jobs:
|
||||
- job: UITest
|
||||
displayName: UI Test ${{ parameters.platform }} ${{ parameters.configuration }}
|
||||
dependsOn: Build${{ parameters.platform }}${{ parameters.configuration }}
|
||||
variables:
|
||||
SrcPath: $(Build.Repository.LocalPath)
|
||||
pool:
|
||||
${{ if eq(variables['System.CollectionUri'], 'https://dev.azure.com/ms/') }}:
|
||||
name: SHINE-OSS-Testing-x64
|
||||
${{ if ne(variables['System.CollectionUri'], 'https://dev.azure.com/ms/') }}:
|
||||
name: SHINE-INT-Testing-x64
|
||||
steps:
|
||||
- checkout: self
|
||||
fetchDepth: 1
|
||||
submodules: false
|
||||
clean: true
|
||||
fetchTags: false
|
||||
|
||||
- download: current
|
||||
displayName: Download artifacts
|
||||
artifact: build-${{ parameters.platform }}-${{ parameters.configuration }}
|
||||
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET 6 SDK'
|
||||
inputs:
|
||||
packageType: sdk
|
||||
version: '6.x'
|
||||
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET 8 SDK'
|
||||
inputs:
|
||||
packageType: sdk
|
||||
version: '8.x'
|
||||
includePreviewVersions: true
|
||||
|
||||
- task: VisualStudioTestPlatformInstaller@1
|
||||
displayName: Ensure VSTest Platform
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Download and install WinAppDriver
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: '$(build.sourcesdirectory)\.pipelines\InstallWinAppDriver.ps1'
|
||||
|
||||
- task: ScreenResolutionUtility@1
|
||||
inputs:
|
||||
displaySettings: 'optimal'
|
||||
|
||||
- task: VSTest@2
|
||||
displayName: 'UI Tests'
|
||||
condition: and(succeeded(), ne(variables['BuildPlatform'],'arm64')) # No arm64 agents to run the tests.
|
||||
inputs:
|
||||
platform: '$(BuildPlatform)'
|
||||
configuration: '$(BuildConfiguration)'
|
||||
testSelector: 'testAssemblies'
|
||||
searchFolder: '$(Pipeline.Workspace)\build-${{ parameters.platform }}-${{ parameters.configuration }}'
|
||||
vstestLocationMethod: 'location' # otherwise fails to find vstest.console.exe
|
||||
#vstestLocation: '$(Agent.ToolsDirectory)\VsTest\**\${{ parameters.platform }}\tools\net462\Common7\IDE\Extensions\TestPlatform'
|
||||
vstestLocation: '$(Agent.ToolsDirectory)\VsTest\17.10.0-release-24177-07\x64\tools\net462\Common7\IDE\Extensions\TestPlatform'
|
||||
uiTests: true
|
||||
rerunFailedTests: true
|
||||
testAssemblyVer2: |
|
||||
**\UITests-FancyZones.dll
|
||||
**\UITests-FancyZonesEditor.dll
|
||||
!**\obj\**
|
||||
!**\ref\**
|
||||
@@ -1,19 +1,19 @@
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
|
||||
$WixDownloadUrl = "https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314.exe"
|
||||
$WixBinariesDownloadUrl = "https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip"
|
||||
$WixDownloadUrl = "https://github.com/wixtoolset/wix3/releases/download/wix314rtm/wix314.exe"
|
||||
$WixBinariesDownloadUrl = "https://github.com/wixtoolset/wix3/releases/download/wix314rtm/wix314-binaries.zip"
|
||||
|
||||
# Download WiX binaries and verify their hash sums
|
||||
Invoke-WebRequest -Uri $WixDownloadUrl -OutFile "$($ENV:Temp)\wix314.exe"
|
||||
$Hash = (Get-FileHash -Algorithm SHA256 "$($ENV:Temp)\wix314.exe").Hash
|
||||
if ($Hash -ne '6BF6D03D6923D9EF827AE1D943B90B42B8EBB1B0F68EF6D55F868FA34C738A29')
|
||||
if ($Hash -ne '704439EA88FC9E5A3647EEDEEB45943F9A392E3D209F58512280130096847937')
|
||||
{
|
||||
Write-Error "$WixHash"
|
||||
throw "wix314.exe has unexpected SHA256 hash: $Hash"
|
||||
}
|
||||
Invoke-WebRequest -Uri $WixBinariesDownloadUrl -OutFile "$($ENV:Temp)\wix314-binaries.zip"
|
||||
$Hash = (Get-FileHash -Algorithm SHA256 "$($ENV:Temp)\wix314-binaries.zip").Hash
|
||||
if($Hash -ne '6AC824E1642D6F7277D0ED7EA09411A508F6116BA6FAE0AA5F2C7DAA2FF43D31')
|
||||
if($Hash -ne '13F067F38969FAF163D93A804B48EA0576790A202C8F10291F2000F0E356E934')
|
||||
{
|
||||
throw "wix314-binaries.zip has unexpected SHA256 hash: $Hash"
|
||||
}
|
||||
|
||||
@@ -43,6 +43,10 @@ steps:
|
||||
- powershell: 'tar czf LocOutput.tar.gz LocOutput'
|
||||
displayName: 'PowerShell Script'
|
||||
|
||||
- publish: LocOutput.tar.gz
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish Artifact: LocOutput'
|
||||
artifact: LocOutput
|
||||
inputs:
|
||||
PathtoPublish: LocOutput.tar.gz
|
||||
ArtifactName: LocOutput
|
||||
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ extends:
|
||||
inputs:
|
||||
solution: '**\PowerToys.sln'
|
||||
vsVersion: 17.0
|
||||
msbuildArgs: -restore -graph /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
|
||||
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
|
||||
platform: $(BuildPlatform)
|
||||
configuration: $(BuildConfiguration)
|
||||
clean: true
|
||||
@@ -167,7 +167,7 @@ extends:
|
||||
inputs:
|
||||
solution: '**/tools/BugReportTool/BugReportTool.sln'
|
||||
vsVersion: 17.0
|
||||
msbuildArgs: -restore -graph /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
|
||||
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
|
||||
platform: $(BuildPlatform)
|
||||
configuration: $(BuildConfiguration)
|
||||
clean: true
|
||||
@@ -178,7 +178,7 @@ extends:
|
||||
inputs:
|
||||
solution: '**/tools/WebcamReportTool/WebcamReportTool.sln'
|
||||
vsVersion: 17.0
|
||||
msbuildArgs: -restore -graph /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
|
||||
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
|
||||
platform: $(BuildPlatform)
|
||||
configuration: $(BuildConfiguration)
|
||||
clean: true
|
||||
@@ -189,7 +189,7 @@ extends:
|
||||
inputs:
|
||||
solution: '**/tools/StylesReportTool/StylesReportTool.sln'
|
||||
vsVersion: 17.0
|
||||
msbuildArgs: -restore -graph /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
|
||||
msbuildArgs: -restore /p:RestorePackagesConfig=true /p:RestoreConfigFile="$(Build.SourcesDirectory)\.pipelines\release-nuget.config" /p:CIBuild=true /bl:$(Build.SourcesDirectory)\msbuild.binlog
|
||||
platform: $(BuildPlatform)
|
||||
configuration: $(BuildConfiguration)
|
||||
clean: true
|
||||
@@ -202,7 +202,6 @@ extends:
|
||||
vsVersion: 17.0
|
||||
msbuildArgs: >-
|
||||
/target:Publish
|
||||
/graph
|
||||
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
|
||||
/p:VCRTForwarders-IncludeDebugCRT=false
|
||||
/p:PowerToysRoot=$(Build.SourcesDirectory)
|
||||
@@ -219,7 +218,6 @@ extends:
|
||||
# The arguments should be the same as the ones for Settings; make sure they are.
|
||||
msbuildArgs: >-
|
||||
/target:Publish
|
||||
/graph
|
||||
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
|
||||
/p:VCRTForwarders-IncludeDebugCRT=false
|
||||
/p:PowerToysRoot=$(Build.SourcesDirectory)
|
||||
@@ -236,7 +234,6 @@ extends:
|
||||
# The arguments should be the same as the ones for Settings; make sure they are.
|
||||
msbuildArgs: >-
|
||||
/target:Publish
|
||||
/graph
|
||||
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
|
||||
/p:VCRTForwarders-IncludeDebugCRT=false
|
||||
/p:PowerToysRoot=$(Build.SourcesDirectory)
|
||||
@@ -253,7 +250,6 @@ extends:
|
||||
# The arguments should be the same as the ones for Settings; make sure they are.
|
||||
msbuildArgs: >-
|
||||
/target:Publish
|
||||
/graph
|
||||
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
|
||||
/p:VCRTForwarders-IncludeDebugCRT=false
|
||||
/p:PowerToysRoot=$(Build.SourcesDirectory)
|
||||
@@ -270,7 +266,6 @@ extends:
|
||||
# The arguments should be the same as the ones for Settings; make sure they are.
|
||||
msbuildArgs: >-
|
||||
/target:Publish
|
||||
/graph
|
||||
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
|
||||
/p:VCRTForwarders-IncludeDebugCRT=false
|
||||
/p:PowerToysRoot=$(Build.SourcesDirectory)
|
||||
@@ -287,7 +282,6 @@ extends:
|
||||
# The arguments should be the same as the ones for Settings; make sure they are.
|
||||
msbuildArgs: >-
|
||||
/target:Publish
|
||||
/graph
|
||||
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
|
||||
/p:VCRTForwarders-IncludeDebugCRT=false
|
||||
/p:PowerToysRoot=$(Build.SourcesDirectory)
|
||||
@@ -304,7 +298,6 @@ extends:
|
||||
# The arguments should be the same as the ones for Settings; make sure they are.
|
||||
msbuildArgs: >-
|
||||
/target:Publish
|
||||
/graph
|
||||
/p:Configuration=$(BuildConfiguration);Platform=$(BuildPlatform);AppxBundle=Never
|
||||
/p:VCRTForwarders-IncludeDebugCRT=false
|
||||
/p:PowerToysRoot=$(Build.SourcesDirectory)
|
||||
@@ -349,15 +342,6 @@ extends:
|
||||
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_core.json'
|
||||
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
|
||||
|
||||
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
|
||||
displayName: Sign DSC Powershell files
|
||||
inputs:
|
||||
ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection'
|
||||
FolderPath: 'src/dsc/Microsoft.PowerToys.Configure'
|
||||
signType: batchSigning
|
||||
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_DSC.json'
|
||||
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
|
||||
|
||||
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
|
||||
displayName: Sign x86 directshow VCM
|
||||
inputs:
|
||||
|
||||
@@ -15,8 +15,7 @@ Param(
|
||||
$referencedFileVersionsPerDll = @{}
|
||||
$totalFailures = 0
|
||||
|
||||
Get-ChildItem $targetDir -Recurse -Filter *.deps.json -Exclude UITests-FancyZones* | ForEach-Object {
|
||||
# Temporarily exclude FancyZones UI tests because of Appium.WebDriver dependencies
|
||||
Get-ChildItem $targetDir -Recurse -Filter *.deps.json | ForEach-Object {
|
||||
$depsJsonFullFileName = $_.FullName
|
||||
$depsJsonFileName = $_.Name
|
||||
$depsJson = Get-Content $depsJsonFullFileName | ConvertFrom-Json
|
||||
|
||||
@@ -44,20 +44,6 @@
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Add ability to run tests via "msbuild /t:Test" -->
|
||||
<Sdk Name="Microsoft.Build.RunVSTest" Version="1.0.319" />
|
||||
<PropertyGroup>
|
||||
<VSTestLogger>trx</VSTestLogger>
|
||||
<!--
|
||||
RunVSTest by default uses %VSINSTALLDIR%\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe,
|
||||
but some of the CI scenarios don't define %VSINSTALLDIR%, so be explicit about where to look for vstest.
|
||||
Note: $(VsInstallRoot) is a built-in MSBuild property, so should always be defined.
|
||||
-->
|
||||
<VSTestToolPath>$(VsInstallRoot)\Common7\IDE\CommonExtensions\Microsoft\TestWindow</VSTestToolPath>
|
||||
<!-- No arm64 agents to run the tests. -->
|
||||
<RunVSTest Condition="'$(Platform)' == 'ARM64'">false</RunVSTest>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- MSBuildCache -->
|
||||
<PropertyGroup>
|
||||
<!-- Off by default -->
|
||||
@@ -86,13 +72,6 @@
|
||||
$(LocalAppData)\Microsoft\Windows\INetCache\**;
|
||||
A:\;
|
||||
E:\;
|
||||
$(windir)\**;
|
||||
</MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>
|
||||
|
||||
<!-- Unit tests of low-priv processes, eg the preview handler tests, may log to this location. -->
|
||||
<MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>
|
||||
$(MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns);
|
||||
$(USERPROFILE)\AppData\LocalLow\Microsoft\PowerToys\**;
|
||||
</MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>
|
||||
|
||||
<!--
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageVersion Include="Appium.WebDriver" Version="4.4.5" />
|
||||
<PackageVersion Include="Appium.WebDriver" Version="4.2.1" />
|
||||
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
<PackageVersion Include="CommunityToolkit.WinUI.Animations" Version="8.0.240109" />
|
||||
<PackageVersion Include="CommunityToolkit.WinUI.Collections" Version="8.0.240109" />
|
||||
@@ -57,6 +57,8 @@
|
||||
<PackageVersion Include="NLog" Version="5.0.4" />
|
||||
<PackageVersion Include="NLog.Extensions.Logging" Version="5.3.8" />
|
||||
<PackageVersion Include="NLog.Schema" Version="5.2.8" />
|
||||
<PackageVersion Include="PowerToys.Hosts" Version="0.0.1" />
|
||||
<PackageVersion Include="PowerToys.RegistryPreviewUILib" Version="0.0.1" />
|
||||
<PackageVersion Include="ScipBe.Common.Office.OneNote" Version="3.0.1" />
|
||||
<PackageVersion Include="SharpCompress" Version="0.33.0" />
|
||||
<PackageVersion Include="StreamJsonRpc" Version="2.14.24" />
|
||||
@@ -73,7 +75,7 @@
|
||||
<PackageVersion Include="System.Diagnostics.EventLog" Version="8.0.0" />
|
||||
<!-- Package System.Diagnostics.PerformanceCounter 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.PerformanceCounter" Version="8.0.0" />
|
||||
<PackageVersion Include="System.Drawing.Common" Version="8.0.4" />
|
||||
<PackageVersion Include="System.Drawing.Common" Version="8.0.3" />
|
||||
<PackageVersion Include="System.IO.Abstractions" Version="17.2.3" />
|
||||
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="17.2.3" />
|
||||
<PackageVersion Include="System.Management" Version="8.0.0" />
|
||||
|
||||
@@ -1296,7 +1296,6 @@ EXHIBIT A -Mozilla Public License.
|
||||
|
||||
## NuGet Packages used by PowerToys
|
||||
|
||||
- Appium.WebDriver 4.4.5
|
||||
- CommunityToolkit.Mvvm 8.2.2
|
||||
- CommunityToolkit.WinUI.Animations 8.0.240109
|
||||
- CommunityToolkit.WinUI.Collections 8.0.240109
|
||||
@@ -1354,7 +1353,7 @@ EXHIBIT A -Mozilla Public License.
|
||||
- System.Data.SqlClient 4.8.6
|
||||
- System.Diagnostics.EventLog 8.0.0
|
||||
- System.Diagnostics.PerformanceCounter 8.0.0
|
||||
- System.Drawing.Common 8.0.4
|
||||
- System.Drawing.Common 8.0.3
|
||||
- System.IO.Abstractions 17.2.3
|
||||
- System.IO.Abstractions.TestingHelpers 17.2.3
|
||||
- System.Management 8.0.0
|
||||
|
||||
@@ -518,7 +518,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PastePlainModuleInterface",
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AllExperiments", "src\common\AllExperiments\AllExperiments.csproj", "{9CE59ED5-7087-4353-88EB-788038A73CEC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RegistryPreviewUI", "src\modules\registrypreview\RegistryPreviewUI\RegistryPreviewUI.csproj", "{FD86C06A-FB54-4D5E-9831-1CDADF60D45F}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RegistryPreviewUILib", "src\modules\registrypreview\RegistryPreviewUILib\RegistryPreviewUILib.csproj", "{FD86C06A-FB54-4D5E-9831-1CDADF60D45F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RegistryPreviewExt", "src\modules\registrypreview\RegistryPreviewExt\RegistryPreviewExt.vcxproj", "{697C6AF9-0A48-49A9-866C-67DA12384015}"
|
||||
EndProject
|
||||
@@ -568,18 +568,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FileLocksmithContextMenu",
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FileLocksmithLib", "src\modules\FileLocksmith\FileLocksmithLib\FileLocksmithLib.vcxproj", "{9D52FD25-EF90-4F9A-A015-91EFC5DAF54F}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UITests-FancyZones", "src\modules\fancyzones\UITests-FancyZones\UITests-FancyZones.csproj", "{FE38FC07-1C05-4B57-ADA3-2FE2F53C6A52}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HostsPackageConsumer", "src\modules\Hosts\HostsPackageConsumer\HostsPackageConsumer.csproj", "{02DD46D3-F761-47D9-8894-2D6DA0124650}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UITests-FancyZonesEditor", "src\modules\fancyzones\UITests-FancyZonesEditor\UITests-FancyZonesEditor.csproj", "{3A9A791E-94A9-49F8-8401-C11CE288D5FB}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FancyZonesEditorCommon", "src\modules\fancyzones\FancyZonesEditorCommon\FancyZonesEditorCommon.csproj", "{C0974915-8A1D-4BF0-977B-9587D3807AB7}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DSC", "DSC", "{557C4636-D7E1-4838-A504-7D19B725EE95}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerToys.Settings.DSC.Schema.Generator", "src\dsc\PowerToys.Settings.DSC.Schema.Generator\PowerToys.Settings.DSC.Schema.Generator.csproj", "{1D6893CB-BC0C-46A8-A76C-9728706CA51A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{020A7474-3601-4160-A159-D7B70B77B15F} = {020A7474-3601-4160-A159-D7B70B77B15F}
|
||||
EndProjectSection
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RegistryPreview", "src\modules\registrypreview\RegistryPreview\RegistryPreview.csproj", "{8E23E173-7127-4A5F-9F93-3049F2B68047}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -2507,54 +2498,30 @@ Global
|
||||
{9D52FD25-EF90-4F9A-A015-91EFC5DAF54F}.Release|x64.Build.0 = Release|x64
|
||||
{9D52FD25-EF90-4F9A-A015-91EFC5DAF54F}.Release|x86.ActiveCfg = Release|x64
|
||||
{9D52FD25-EF90-4F9A-A015-91EFC5DAF54F}.Release|x86.Build.0 = Release|x64
|
||||
{FE38FC07-1C05-4B57-ADA3-2FE2F53C6A52}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{FE38FC07-1C05-4B57-ADA3-2FE2F53C6A52}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{FE38FC07-1C05-4B57-ADA3-2FE2F53C6A52}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FE38FC07-1C05-4B57-ADA3-2FE2F53C6A52}.Debug|x64.Build.0 = Debug|x64
|
||||
{FE38FC07-1C05-4B57-ADA3-2FE2F53C6A52}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{FE38FC07-1C05-4B57-ADA3-2FE2F53C6A52}.Debug|x86.Build.0 = Debug|x64
|
||||
{FE38FC07-1C05-4B57-ADA3-2FE2F53C6A52}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{FE38FC07-1C05-4B57-ADA3-2FE2F53C6A52}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{FE38FC07-1C05-4B57-ADA3-2FE2F53C6A52}.Release|x64.ActiveCfg = Release|x64
|
||||
{FE38FC07-1C05-4B57-ADA3-2FE2F53C6A52}.Release|x64.Build.0 = Release|x64
|
||||
{FE38FC07-1C05-4B57-ADA3-2FE2F53C6A52}.Release|x86.ActiveCfg = Release|x64
|
||||
{FE38FC07-1C05-4B57-ADA3-2FE2F53C6A52}.Release|x86.Build.0 = Release|x64
|
||||
{3A9A791E-94A9-49F8-8401-C11CE288D5FB}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{3A9A791E-94A9-49F8-8401-C11CE288D5FB}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{3A9A791E-94A9-49F8-8401-C11CE288D5FB}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{3A9A791E-94A9-49F8-8401-C11CE288D5FB}.Debug|x64.Build.0 = Debug|x64
|
||||
{3A9A791E-94A9-49F8-8401-C11CE288D5FB}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{3A9A791E-94A9-49F8-8401-C11CE288D5FB}.Debug|x86.Build.0 = Debug|x64
|
||||
{3A9A791E-94A9-49F8-8401-C11CE288D5FB}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{3A9A791E-94A9-49F8-8401-C11CE288D5FB}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{3A9A791E-94A9-49F8-8401-C11CE288D5FB}.Release|x64.ActiveCfg = Release|x64
|
||||
{3A9A791E-94A9-49F8-8401-C11CE288D5FB}.Release|x64.Build.0 = Release|x64
|
||||
{3A9A791E-94A9-49F8-8401-C11CE288D5FB}.Release|x86.ActiveCfg = Release|x64
|
||||
{3A9A791E-94A9-49F8-8401-C11CE288D5FB}.Release|x86.Build.0 = Release|x64
|
||||
{C0974915-8A1D-4BF0-977B-9587D3807AB7}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{C0974915-8A1D-4BF0-977B-9587D3807AB7}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{C0974915-8A1D-4BF0-977B-9587D3807AB7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C0974915-8A1D-4BF0-977B-9587D3807AB7}.Debug|x64.Build.0 = Debug|x64
|
||||
{C0974915-8A1D-4BF0-977B-9587D3807AB7}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{C0974915-8A1D-4BF0-977B-9587D3807AB7}.Debug|x86.Build.0 = Debug|x64
|
||||
{C0974915-8A1D-4BF0-977B-9587D3807AB7}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{C0974915-8A1D-4BF0-977B-9587D3807AB7}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{C0974915-8A1D-4BF0-977B-9587D3807AB7}.Release|x64.ActiveCfg = Release|x64
|
||||
{C0974915-8A1D-4BF0-977B-9587D3807AB7}.Release|x64.Build.0 = Release|x64
|
||||
{C0974915-8A1D-4BF0-977B-9587D3807AB7}.Release|x86.ActiveCfg = Release|x64
|
||||
{C0974915-8A1D-4BF0-977B-9587D3807AB7}.Release|x86.Build.0 = Release|x64
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A}.Debug|x64.Build.0 = Debug|x64
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A}.Debug|x86.Build.0 = Debug|x64
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A}.Release|x64.ActiveCfg = Release|x64
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A}.Release|x64.Build.0 = Release|x64
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A}.Release|x86.ActiveCfg = Release|x64
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A}.Release|x86.Build.0 = Release|x64
|
||||
{02DD46D3-F761-47D9-8894-2D6DA0124650}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{02DD46D3-F761-47D9-8894-2D6DA0124650}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{02DD46D3-F761-47D9-8894-2D6DA0124650}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{02DD46D3-F761-47D9-8894-2D6DA0124650}.Debug|x64.Build.0 = Debug|x64
|
||||
{02DD46D3-F761-47D9-8894-2D6DA0124650}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{02DD46D3-F761-47D9-8894-2D6DA0124650}.Debug|x86.Build.0 = Debug|x64
|
||||
{02DD46D3-F761-47D9-8894-2D6DA0124650}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{02DD46D3-F761-47D9-8894-2D6DA0124650}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{02DD46D3-F761-47D9-8894-2D6DA0124650}.Release|x64.ActiveCfg = Release|x64
|
||||
{02DD46D3-F761-47D9-8894-2D6DA0124650}.Release|x64.Build.0 = Release|x64
|
||||
{02DD46D3-F761-47D9-8894-2D6DA0124650}.Release|x86.ActiveCfg = Release|x64
|
||||
{02DD46D3-F761-47D9-8894-2D6DA0124650}.Release|x86.Build.0 = Release|x64
|
||||
{8E23E173-7127-4A5F-9F93-3049F2B68047}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{8E23E173-7127-4A5F-9F93-3049F2B68047}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{8E23E173-7127-4A5F-9F93-3049F2B68047}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8E23E173-7127-4A5F-9F93-3049F2B68047}.Debug|x64.Build.0 = Debug|x64
|
||||
{8E23E173-7127-4A5F-9F93-3049F2B68047}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{8E23E173-7127-4A5F-9F93-3049F2B68047}.Debug|x86.Build.0 = Debug|x64
|
||||
{8E23E173-7127-4A5F-9F93-3049F2B68047}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{8E23E173-7127-4A5F-9F93-3049F2B68047}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{8E23E173-7127-4A5F-9F93-3049F2B68047}.Release|x64.ActiveCfg = Release|x64
|
||||
{8E23E173-7127-4A5F-9F93-3049F2B68047}.Release|x64.Build.0 = Release|x64
|
||||
{8E23E173-7127-4A5F-9F93-3049F2B68047}.Release|x86.ActiveCfg = Release|x64
|
||||
{8E23E173-7127-4A5F-9F93-3049F2B68047}.Release|x86.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -2764,10 +2731,8 @@ Global
|
||||
{0014D652-901F-4456-8D65-06FC5F997FB0} = {4C0D0746-BE5B-49EE-BD5D-A7811628AE8B}
|
||||
{799A50D8-DE89-4ED1-8FF8-AD5A9ED8C0CA} = {AB82E5DD-C32D-4F28-9746-2C780846188E}
|
||||
{9D52FD25-EF90-4F9A-A015-91EFC5DAF54F} = {AB82E5DD-C32D-4F28-9746-2C780846188E}
|
||||
{FE38FC07-1C05-4B57-ADA3-2FE2F53C6A52} = {D1D6BC88-09AE-4FB4-AD24-5DED46A791DD}
|
||||
{3A9A791E-94A9-49F8-8401-C11CE288D5FB} = {D1D6BC88-09AE-4FB4-AD24-5DED46A791DD}
|
||||
{C0974915-8A1D-4BF0-977B-9587D3807AB7} = {D1D6BC88-09AE-4FB4-AD24-5DED46A791DD}
|
||||
{1D6893CB-BC0C-46A8-A76C-9728706CA51A} = {557C4636-D7E1-4838-A504-7D19B725EE95}
|
||||
{02DD46D3-F761-47D9-8894-2D6DA0124650} = {F05E590D-AD46-42BE-9C25-6A63ADD2E3EA}
|
||||
{8E23E173-7127-4A5F-9F93-3049F2B68047} = {929C1324-22E8-4412-A9A8-80E85F3985A5}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
|
||||
|
||||
172
README.md
@@ -40,19 +40,19 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline
|
||||
Go to the [Microsoft PowerToys GitHub releases page][github-release-link] and click on `Assets` at the bottom to show the files available in the release. Please use the appropriate PowerToys installer that matches your machine's architecture and install scope. For most, it is `x64` and per-user.
|
||||
|
||||
<!-- items that need to be updated release to release -->
|
||||
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F54
|
||||
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F53
|
||||
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.80.0/PowerToysUserSetup-0.80.0-x64.exe
|
||||
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.80.0/PowerToysUserSetup-0.80.0-arm64.exe
|
||||
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.80.0/PowerToysSetup-0.80.0-x64.exe
|
||||
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.80.0/PowerToysSetup-0.80.0-arm64.exe
|
||||
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F53
|
||||
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F52
|
||||
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.79.0/PowerToysUserSetup-0.79.0-x64.exe
|
||||
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.79.0/PowerToysUserSetup-0.79.0-arm64.exe
|
||||
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.79.0/PowerToysSetup-0.79.0-x64.exe
|
||||
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.79.0/PowerToysSetup-0.79.0-arm64.exe
|
||||
|
||||
| Description | Filename | sha256 hash |
|
||||
|----------------|----------|-------------|
|
||||
| Per user - x64 | [PowerToysUserSetup-0.80.0-x64.exe][ptUserX64] | 4D20EB01C4035BB41F57D43AED2A546547E1FAA660FE29DC1CC699F1916DE1CC |
|
||||
| Per user - ARM64 | [PowerToysUserSetup-0.80.0-arm64.exe][ptUserArm64] | 1B85E95B0EC7D8CE1EE51B987449DA9A36DAAA4C27DF8EE4796001848EA2CBD1 |
|
||||
| Machine wide - x64 | [PowerToysSetup-0.80.0-x64.exe][ptMachineX64] | 2D17C1920D970332D93449184D7C2470052686FD4B3EB8ED49EF6475D1D1D62F |
|
||||
| Machine wide - ARM64 | [PowerToysSetup-0.80.0-arm64.exe][ptMachineArm64] | 0DD40B7A31E35472688A55A8E1ECE58847EA423F3F19FD7B8C557F1271F73F24 |
|
||||
| Per user - x64 | [PowerToysUserSetup-0.79.0-x64.exe][ptUserX64] | CF1C715F952A34416CDBE5D06D24FFF47790DDA1D4CA3F81BCAD9D28FF0039A1 |
|
||||
| Per user - ARM64 | [PowerToysUserSetup-0.79.0-arm64.exe][ptUserArm64] | ADE572B6F1B59DCDC60A2550D9FD00B8CC7C78BE9330F534691CE4B056ED76F1 |
|
||||
| Machine wide - x64 | [PowerToysSetup-0.79.0-x64.exe][ptMachineX64] | 3FD2A6BD9C8F8973BFBBF5DB9236C3D8AF3AE57E5AEC275DDEB5EF31581F80FE |
|
||||
| Machine wide - ARM64 | [PowerToysSetup-0.79.0-arm64.exe][ptMachineArm64] | B93017C2A5CFB0DEF708DB412570AA39828E91D85E800EFD22481B46F0DC6852 |
|
||||
|
||||
This is our preferred method.
|
||||
|
||||
@@ -98,136 +98,144 @@ For guidance on developing for PowerToys, please read the [developer docs](/doc/
|
||||
|
||||
Our [prioritized roadmap][roadmap] of features and utilities that the core team is focusing on.
|
||||
|
||||
### 0.80 - March 2024 Update
|
||||
### 0.79 - February 2024 Update
|
||||
|
||||
In this release, we focused on stability and improvements. The next release is planned to be released during [Microsoft Build 2024](https://build.microsoft.com/) (late May).
|
||||
In this release, we focused on stability and improvements.
|
||||
|
||||
**Highlights**
|
||||
|
||||
- New feature: Desired State Configuration support, allowing the use of winget configure for PowerToys. Check the [DSC documentation](https://aka.ms/powertoys-docs-dsc-configure) for more information.
|
||||
- The Windows App SDK dependency was updated to 1.5.1, fixing many underlying UI issues.
|
||||
- WebP/WebM files support was added to Peek. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Audio files support was added to Peek. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Automated UI testing for FancyZones Editor was added to CI.
|
||||
- New feature: Keyboard Manager allows mapping shortcuts to start applications or opening URIs. Thanks [@jefflord](https://github.com/jefflord)!
|
||||
- New feature: Keyboard Manager allows shortcuts with chords. Thanks [@jefflord](https://github.com/jefflord)!
|
||||
- Modernized Color Picker with Fluent UX. Thanks [@niels9001](https://github.com/niels9001)!
|
||||
- Peek now is able to preview drives. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- File Locksmith has now an entry in the Windows 11 tier 1 context menu.
|
||||
|
||||
### General
|
||||
|
||||
- Added a Quick Access entry to access the flyout from PowerToys' tray icon right click menu. Thanks [@pekvasnovsky](https://github.com/pekvasnovsky)!
|
||||
- Added support for Desired State Configuration in PowerToys, allowing the use of winget configure to configure many settings.
|
||||
- Refactored code so that English is used as a fallback language when a localized resource cannot be found.
|
||||
|
||||
### Awake
|
||||
|
||||
- Fix an issue causing the "Keep screen on" option to disable after Awake deactivated itself.
|
||||
- The setting now reverts to "Keep using the current power plan" after Awake deactivates itself after any of the timed modes has expired.
|
||||
|
||||
### Color Picker
|
||||
|
||||
- Fixed a UI issue causing the color picker modal to hide part of the color bar. Thanks [@TheChilledBuffalo](https://github.com/TheChilledBuffalo)!
|
||||
- Now uses WPFUI and the UI was updated to follow Fluent UX principles. Thanks [@niels9001](https://github.com/niels9001)!
|
||||
- Added enable and disable telemetry to align it with the other utilities.
|
||||
|
||||
### Command Not Found
|
||||
|
||||
- Now tries to find a preview version of PowerShell if no stable version is found.
|
||||
- Added telemetry for when a module instance is created in PowerShell.
|
||||
|
||||
### FancyZones
|
||||
|
||||
- Fixed a crash loading the editor when there's a layout with an empty name in the configuration file.
|
||||
- Refactored layout internal data structures and common code to allow for automated testing.
|
||||
- The pressing of the shift key is now detected through raw input to fix an issue causing the shift key to be locked for some users.
|
||||
- Fixed a memory leak occurring on work area changes.
|
||||
|
||||
### File Explorer add-ons
|
||||
|
||||
- Fixed a crash occurring in the Monaco previewer when a file being previewed isn't found by the code behind.
|
||||
- Fixed an issue in the Markdown previewer adding a leading space to code blocks. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)!
|
||||
- Fixed wrong location and scaling of preview results on screens with different DPIs.
|
||||
- Added better clean up code to thumbnail handlers to prevent locking files.
|
||||
- Added support to the .ksh, .zsh, .bsh and .env file types to Monaco previewer. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)!
|
||||
- Re-enabled the RendererAppContainer feature in WebView2, since the associated crash has been fixed in the latest WebView2 releases.
|
||||
|
||||
### File Locksmith
|
||||
|
||||
- Allow multiple lines to wrap when viewing the modal with selected file paths. Thanks [@sanidhyas3s](https://github.com/sanidhyas3s)!
|
||||
- Added as an entry in the Windows 11 tier 1 context menu.
|
||||
|
||||
### Installer
|
||||
### Hosts File Editor
|
||||
|
||||
- Fixed the final directory name of the PowerToys Run VSCode Workspaces plugin in the installation directory to match the plugin name. Thanks [@zetaloop](https://github.com/zetaloop)!
|
||||
- Used more generic names for the bootstrap steps, so that "Installing PowerToys" is not shown when uninstalling.
|
||||
- Tweaked filter button style to indicate if filters are applied.
|
||||
- Added an error indicator to each input field to indicate why a new entry can't be created.
|
||||
- Added an in-line delete button for each entry.
|
||||
|
||||
### Image Resizer
|
||||
|
||||
- Units and resize modes are now localized.
|
||||
- Tweaked and improved UI. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)!
|
||||
|
||||
### Keyboard Manager
|
||||
|
||||
- Fixed an issue that would clear out KBM mappings when certain numpad keys were used as the second key of a chord.
|
||||
- Added a comment in localization files so that translators won't translate "Text" as "SMS".
|
||||
- Added a feature that allows remapping a shortcut to starting an application. Thanks [@jefflord](https://github.com/jefflord)!
|
||||
- Added a feature that allows remapping a shortcut to open a URI. Thanks [@jefflord](https://github.com/jefflord)!
|
||||
- Added chords to shortcuts. Thanks [@jefflord](https://github.com/jefflord)!
|
||||
- Send telemetry about the key/shortcut to key/shortcut remappings that are set. This doesn't include remap to text, application or URI since those might contain personal information.
|
||||
- Added telemetry to send a daily event that at least a key/shortcut to key/shortcut remapping was used.
|
||||
- Tweaked and fixed the chords code to better follow conventions when trying to call the same chord multiple times.
|
||||
|
||||
### Mouse Without Borders
|
||||
- Fixed an issue causing the target path string to be corrupted when registering as a service.
|
||||
|
||||
### Paste as Plain Text
|
||||
|
||||
- Prevent the start menu from activating when the Windows key is part of the activation shortcut and is released sooner.
|
||||
|
||||
### Peek
|
||||
|
||||
- Added support to .WebP/.WebM files in the image/video previewer. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Added support for audio files. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Fixed an issue causing the open file button in the title bar to be un-clickable. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Fixed an issue when previewing a folder with a dot in the name that caused Peek to try to preview it as a file. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Fixed a title bar issue after maximizing Peek's window. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Fixed a crash when trying to use Peek in File Explorer alternatives.
|
||||
- Added a previewer for drives. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- The folder previewer will now asynchronously calculate size, similar to the Properties screen in File Explorer. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Added support to the .ksh, .zsh, .bsh and .env file types to Monaco previewer. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)!
|
||||
|
||||
### PowerRename
|
||||
|
||||
- PowerRename context menu accelerator key readded.
|
||||
- Tweaked PowerRename apply button style. Thanks [@niels9001](https://github.com/niels9001)!
|
||||
|
||||
### PowerToys Run
|
||||
|
||||
- Added a setting to the Windows Search plugin to exclude files and patterns from the results. Thanks [@HydroH](https://github.com/HydroH)!
|
||||
- Fixed an issue showing thumbnails caused by a hash collision between similar images.
|
||||
- Added the "checkbox and multiline text box" additional property type for plugins and improved multiline text handling. Thanks [@htcfreek](https://github.com/htcfreek)!
|
||||
- Fixed an issue causing win32 application icons to not appear correctly in the Programs plugin.
|
||||
- Unified phrasing in the plugin descriptions.
|
||||
- Fixed an issue causing the PowerToys Run plugin settings to be cleared with each upgrade.
|
||||
- Fixed an issue causing VSCodeWorkspaces plugin to not find WSL workspaces.
|
||||
- Fixed results tooltip closing fast. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Improved the Registry plugin tooltip spacing. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Allow pressing '=' to replace the query with the current result when using the calculator plugin. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Optimized the code that gathers results from the plugin to reduce CPU consumption.
|
||||
- Optimized memory usage in the Window Walker plugin.
|
||||
- Fixed crashes and improved error handling when saving json configuration files.
|
||||
- The Program plugin will now correctly get the icon for a newly installed packaged application. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
|
||||
### Quick Accent
|
||||
|
||||
- Added the Schwa character to the Italian character set. Thanks [@damantioworks](https://github.com/damantioworks)!
|
||||
- Added support for the Slovenian character set. Thanks [@aklemen](https://github.com/aklemen)!
|
||||
|
||||
### Registry Preview
|
||||
|
||||
- Allow alternative valid names for the root keys. Thanks [@e-t-l](https://github.com/e-t-l)!
|
||||
- Fixed an issue causing many pick file windows to be opened simultaneously. Thanks [@randyrants](https://github.com/randyrants)!
|
||||
|
||||
### Screen Ruler
|
||||
|
||||
- Updated the measure icons for clarity. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker) and [@niels9001](https://github.com/niels9001)!
|
||||
|
||||
### Shortcut Guide
|
||||
|
||||
- Updated the Emoji shortcut that is shown to the new Windows key + period (.) hotkey.
|
||||
|
||||
### Text Extractor
|
||||
|
||||
- Fixed issues creating the extract layout on certain monitor configurations.
|
||||
|
||||
### Video Conference Mute
|
||||
|
||||
- Added enable/disable telemetry to get usage data.
|
||||
- Fixed a crash when closing the application and the editor's right click menu is opened.
|
||||
|
||||
### Settings
|
||||
|
||||
- Added locks to some terms (like the name of some utilities) so that they aren't localized.
|
||||
- Fixed some shortcuts not being shown properly in the Flyout and Dashboard. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Updated image for Color Picker and outdated animations for utilities in OOBE. Thanks [@niels9001](https://github.com/niels9001)!
|
||||
- Fixed an alignment issue in the flyout icons causing some icons to be centered when they shouldn't. Thanks [@niels9001](https://github.com/niels9001)!
|
||||
- Added the mention that Monaco supports .txt files. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)!
|
||||
- Fixed an issue causing the Settings window to lose its previous maximized state. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
|
||||
### Documentation
|
||||
|
||||
- Added FastWeb plugin to PowerToys Run thirdPartyRunPlugins.md docs. Thanks [@CCcat8059](https://github.com/CCcat8059)!
|
||||
- Removed the old security link to MSRC from the create new issue page, since security.md is already linked there.
|
||||
- Added clarity regarding unofficial plugins to the PowerToys Run thirdPartyRunPlugins.md docs.
|
||||
- Fixed broken links in doc/devdocs/readme.md. Thanks [@jem-experience](https://github.com/jem-experience)!
|
||||
|
||||
### Development
|
||||
|
||||
- Updated System.Drawing.Common to 8.0.3 to fix CI builds after the .NET 8.0.3 upgrade was released.
|
||||
- Adjusted the GitHub action names for releasing to winget and Microsoft Store so they're clearer in the UI.
|
||||
- Upgraded WinAppSDK to 1.5.1, fixing many related issues.
|
||||
- Consolidate the WebView2 version used by WinUI 2 in the Keyboard Manager Editor.
|
||||
- Unified the use of Precompiled Headers when building on CI. Thanks [@dfederm](https://github.com/dfederm)!
|
||||
- Added UI tests for FancyZones Editor in CI.
|
||||
- Added a GitHub bot to identify possible duplicates when a new issue is created. Thanks [@craigloewen-msft](https://github.com/craigloewen-msft)!
|
||||
- Updated the WiX installer dependency to 3.14.1 to fix possible security issues.
|
||||
- Changed the pipelines to use pipeline artifacts instead of build artifacts. Thanks [@dfederm](https://github.com/dfederm)!
|
||||
- Added the -graph parameter for pipelines. Thanks [@dfederm](https://github.com/dfederm)!
|
||||
- Tests in the pipelines now run as part of the build step to save on CI time. Thanks [@dfederm](https://github.com/dfederm)!
|
||||
- Updated Microsoft.MSBuildCache to 0.1.258-preview. Thanks [@dfederm](https://github.com/dfederm)!
|
||||
- Fixed CI to point VCToolsVersion to VC.CRT instead of VC.Redist version. Thanks [@snickler](https://github.com/snickler)!
|
||||
- Updated MSTest adapter and framework to 3.2.
|
||||
- Fixed CI by pointing WiX 3.14 urls and hashes to the latest release on GitHub.
|
||||
- Added Pro and Enterprise editions of Visual Studio to the repository's development configuration DSC scripts.
|
||||
- Updated CppWinRT to 2.0.240111.5.
|
||||
- Updated System.Drawing.Common to 8.0.2 to fix CI builds after the .NET 8.0.2 upgrade was released.
|
||||
- Updated WPFUI version to 3.0.0. Thanks [@niels9001](https://github.com/niels9001)!
|
||||
- XAML Styler is now fully tested in the solution when CI runs. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Fixed a faulty XAML binding in the Text Extractor settings page.
|
||||
- Updated Microsoft.Web.WebView2 to 1.0.2365.46.
|
||||
|
||||
#### What is being planned for version 0.81
|
||||
#### What is being planned for version 0.80
|
||||
|
||||
For [v0.81][github-next-release-work], we'll work on the items below:
|
||||
For [v0.80][github-next-release-work], we'll work on the items below:
|
||||
|
||||
- Stability / bug fixes
|
||||
- Language selection
|
||||
- Automated UI testing through WinAppDriver
|
||||
- Develop support for Desired State Configuration
|
||||
- New module: File Actions Menu
|
||||
|
||||
The next release is planned to be released during Microsoft Build 2024.
|
||||
|
||||
## PowerToys Community
|
||||
|
||||
The PowerToys team is extremely grateful to have the [support of an amazing active community][community-link]. The work you do is incredibly important. PowerToys wouldn’t be nearly what it is today without your help filing bugs, updating documentation, guiding the design, or writing features. We want to say thank you and take time to recognize your work. Month by month, you directly help make PowerToys a better piece of software.
|
||||
|
||||
@@ -1,26 +1,85 @@
|
||||
# FancyZones UI tests
|
||||
## FancyZones Lib
|
||||
|
||||
UI tests are implemented using [Windows Application Driver](https://github.com/microsoft/WinAppDriver).
|
||||
#### [`FancyZones.cpp`](/src/modules/fancyzones/lib/FancyZones.cpp)
|
||||
TODO
|
||||
|
||||
## Before running tests
|
||||
#### [`Settings.cpp`](/src/modules/fancyzones/lib/Settings.cpp)
|
||||
TODO
|
||||
|
||||
- Install Windows Application Driver v1.2.1 from https://github.com/microsoft/WinAppDriver/releases/tag/v1.2.1.
|
||||
- Enable Developer Mode in Windows settings
|
||||
#### [`trace.cpp`](/src/modules/fancyzones/lib/trace.cpp)
|
||||
TODO
|
||||
|
||||
## Running tests
|
||||
|
||||
- Exit PowerToys if it's running
|
||||
- Run WinAppDriver.exe from the installation directory. Skip this step if installed in the default directory (`C:\Program Files (x86)\Windows Application Driver`); in this case, it'll be launched automatically during tests.
|
||||
- Open `PowerToys.sln` in Visual Studio and build the solution.
|
||||
- Run tests in the Test Explorer (`Test > Test Explorer` or `Ctrl+E, T`).
|
||||
#### [`Zone.cpp`](/src/modules/fancyzones/lib/Zone.cpp)
|
||||
TODO
|
||||
|
||||
>Note: notifications or other application windows, that are shown above the window under test, can disrupt the testing process.
|
||||
#### [`ZoneSet.cpp`](/src/modules/fancyzones/lib/ZoneSet.cpp)
|
||||
TODO
|
||||
|
||||
#### [`WorkArea.cpp`](/src/modules/fancyzones/lib/WorkArea.cpp)
|
||||
TODO
|
||||
|
||||
## Extra tools and information
|
||||
## FancyZones Editor
|
||||
|
||||
**Test samples**: https://github.com/microsoft/WinAppDriver/tree/master/Samples
|
||||
#### [`App.xaml.cs`](/src/modules/fancyzones/editor/App.xaml.cs)
|
||||
TODO
|
||||
|
||||
While working on tests, you may need a tool that helps you to view the element's accessibility data, e.g. for finding the button to click. For this purpose, you could use [AccessibilityInsights](https://accessibilityinsights.io/docs/windows/overview) or [WinAppDriver UI Recorder](https://github.com/microsoft/WinAppDriver/wiki/WinAppDriver-UI-Recorder).
|
||||
#### [`Properties\AssemblyInfo.cs`](/src/modules/fancyzones/editor/Properties\AssemblyInfo.cs)
|
||||
TODO
|
||||
|
||||
#### [`CanvasEditor.xaml.cs`](/src/modules/fancyzones/editor/CanvasEditor.xaml.cs)
|
||||
TODO
|
||||
|
||||
#### [`CanvasEditorWindow.xaml.cs`](/src/modules/fancyzones/editor/CanvasEditorWindow.xaml.cs)
|
||||
TODO
|
||||
|
||||
#### [`Models\CanvasLayoutModel.cs`](/src/modules/fancyzones/editor/Models\CanvasLayoutModel.cs)
|
||||
TODO
|
||||
|
||||
#### [`CanvasZone.xaml.cs`](/src/modules/fancyzones/editor/CanvasZone.xaml.cs)
|
||||
TODO
|
||||
|
||||
#### [`EditorOverlay.xaml.cs`](/src/modules/fancyzones/editor/EditorOverlay.xaml.cs)
|
||||
TODO
|
||||
|
||||
#### [`EditorWindow.cs`](/src/modules/fancyzones/editor/EditorWindow.cs)
|
||||
TODO
|
||||
|
||||
#### [`GridEditor.xaml.cs`](/src/modules/fancyzones/editor/GridEditor.xaml.cs)
|
||||
TODO
|
||||
|
||||
#### [`GridEditorWindow.xaml.cs`](/src/modules/fancyzones/editor/GridEditorWindow.xaml.cs)
|
||||
TODO
|
||||
|
||||
#### [`Models\GridLayoutModel.cs`](/src/modules/fancyzones/editor/Models\GridLayoutModel.cs)
|
||||
TODO
|
||||
|
||||
#### [`GridResizer.xaml.cs`](/src/modules/fancyzones/editor/GridResizer.xaml.cs)
|
||||
TODO
|
||||
|
||||
#### [`GridZone.xaml.cs`](/src/modules/fancyzones/editor/GridZone.xaml.cs)
|
||||
TODO
|
||||
|
||||
#### [`Models\LayoutModel.cs`](/src/modules/fancyzones/editor/Models/LayoutModel.cs)
|
||||
TODO
|
||||
|
||||
#### [`LayoutPreview.xaml.cs`](/src/modules/fancyzones/editor/LayoutPreview.xaml.cs)
|
||||
TODO
|
||||
|
||||
#### [`MainWindow.xaml.cs`](/src/modules/fancyzones/editor/MainWindow.xaml.cs)
|
||||
TODO
|
||||
|
||||
#### [`Properties\Resources.Designer.cs`](/src/modules/fancyzones/editor/Properties/Resources.Designer.cs)
|
||||
TODO
|
||||
|
||||
#### [`RowColInfo.cs`](/src/modules/fancyzones/editor/RowColInfo.cs)
|
||||
TODO
|
||||
|
||||
#### [`Models\Settings.cs`](/src/modules/fancyzones/editor/Models/Settings.cs)
|
||||
TODO
|
||||
|
||||
#### [`Properties\Settings.Designer.cs`](/src/modules/fancyzones/editor/Properties/Settings.Designer.cs)
|
||||
TODO
|
||||
|
||||
#### [`WindowLayout.xaml.cs`](/src/modules/fancyzones/editor/WindowLayout.xaml.cs)
|
||||
TODO
|
||||
|
||||
>Note: close helper tools while running tests. Overlapping windows can affect test results.
|
||||
@@ -80,8 +80,8 @@ The installer can only be compiled in `Release` mode; steps 1 and 2 must be perf
|
||||
### Prerequisites for building the MSI installer
|
||||
|
||||
1. Install the [WiX Toolset Visual Studio 2022 Extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2022Extension).
|
||||
1. Install the [WiX Toolset build tools](https://github.com/wixtoolset/wix3/releases/tag/wix3141rtm). (installer [direct link](https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314.exe))
|
||||
1. Download [WiX binaries](https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip) and extract `wix.targets` to `C:\Program Files (x86)\WiX Toolset v3.14`.
|
||||
1. Install the [WiX Toolset build tools](https://github.com/wixtoolset/wix3/releases/tag/wix314rtm). (installer [direct link](https://github.com/wixtoolset/wix3/releases/download/wix314rtm/wix314.exe))
|
||||
1. Download [WiX binaries](https://github.com/wixtoolset/wix3/releases/download/wix314rtm/wix314-binaries.zip) and extract `wix.targets` to `C:\Program Files (x86)\WiX Toolset v3.14`.
|
||||
|
||||
### Building prerequisite projects
|
||||
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
# What is it
|
||||
|
||||
We would like to enable our users to use [`winget configure`](https://learn.microsoft.com/en-us/windows/package-manager/winget/configure) command to install PowerToys and configure its settings with a [Winget configuration file](https://learn.microsoft.com/en-us/windows/package-manager/configuration/create). For example:
|
||||
|
||||
```yaml
|
||||
properties:
|
||||
resources:
|
||||
- resource: Microsoft.WinGet.DSC/WinGetPackage
|
||||
directives:
|
||||
description: Install PowerToys
|
||||
allowPrerelease: true
|
||||
settings:
|
||||
id: PowerToys (Preview)
|
||||
source: winget
|
||||
|
||||
- resource: PowerToysConfigure
|
||||
directives:
|
||||
description: Configure PowerToys
|
||||
settings:
|
||||
ShortcutGuide:
|
||||
Enabled: false
|
||||
OverlayOpacity: 1
|
||||
FancyZones:
|
||||
Enabled: true
|
||||
FancyzonesEditorHotkey: "Shift+Ctrl+Alt+F"
|
||||
configurationVersion: 0.2.0
|
||||
```
|
||||
|
||||
This should install PowerToys and make `PowerToysConfigure` resource available. We can use it in the same file.
|
||||
|
||||
# How it works
|
||||
|
||||
`PowerToysConfigure` is a [class-based DSC resource](https://learn.microsoft.com/en-us/powershell/dsc/concepts/class-based-resources?view=dsc-2.0). It looks up whether each setting was specified or not by checking whether it's `$null` or `0` for `enum`s and invokes `PowerToys.Settings.exe` with the updated value like so:
|
||||
```
|
||||
PowerToys.Settings.exe set <ModuleName>.<SettingName> <SettingValue>
|
||||
```
|
||||
|
||||
So for the example the config above should perform 3 following invocations:
|
||||
```
|
||||
PowerToys.Settings.exe set ShortcutGuide.Enabled false
|
||||
PowerToys.Settings.exe set FancyZones.Enabled true
|
||||
PowerToys.Settings.exe set FancyZones.FancyzonesEditorHotkey "Shift+Ctrl+Alt+F"
|
||||
```
|
||||
|
||||
`PowerToys.Settings` uses dotnet reflection capabilities to determine `SettingName` type and tries to convert the supplied `SettingValue` string accordingly. We use `ICmdReprParsable` for custom setting types.
|
||||
|
||||
|
||||
# How DSC is implemented
|
||||
|
||||
We use `PowerToys.Settings.DSC.Schema.Generator` to generate the bulk of `PowerToysConfigure.psm1` and `PowerToysConfigure.psd1` files. It also uses dotnet reflection capabilities to inspect `PowerToys.Settings.UI.Lib.dll` assembly and generate properties for the modules we have. The actual generation is done as a `PowerToys.Settings.DSC.Schema.Generator.csproj` post-build action.
|
||||
|
||||
# Debugging DSC resources
|
||||
|
||||
First, make sure that PowerShell 7.4+ is installed. Then make sure that you have DSC installed:
|
||||
|
||||
```ps
|
||||
Install-Module -Name PSDesiredStateConfiguration -RequiredVersion 2.0.7
|
||||
```
|
||||
|
||||
After that, start a new `pwsh` session and `cd` to `src\dsc\Microsoft.PowerToys.Configure\Generated` directory. From there, you should execute:
|
||||
```ps
|
||||
$env:PSModulePath += ";$pwd"
|
||||
```
|
||||
|
||||
You should have the generated `Microsoft.PowerToys.Configure.psm1` and `Microsoft.PowerToys.Configure.psd1` files inside the `src\dsc\Microsoft.PowerToys.Configure\Generated\Microsoft.PowerToys.Configure\0.0.1\` folder.
|
||||
|
||||
This will allow DSC to discover our DSC Resource module. See [PSModulePath](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_psmodulepath?view=powershell-7.4#long-description) for more info.
|
||||
|
||||
If everything works, you should see that your module is discovered by executing the following command:
|
||||
|
||||
```ps
|
||||
Get-Module -ListAvailable | grep PowerToys
|
||||
```
|
||||
|
||||
The resource itself should also be available:
|
||||
```ps
|
||||
Get-DSCResource | grep PowerToys
|
||||
```
|
||||
|
||||
Otherwise, you can force-import the module to diagnose issues:
|
||||
|
||||
```
|
||||
Import-Module .\Microsoft.PowerToys.Configure.psd1
|
||||
```
|
||||
|
||||
If it's imported successfully, you could also try to invoke it directly:
|
||||
|
||||
```ps
|
||||
Invoke-DscResource -Name PowerToysConfigure -Method Set -ModuleName Microsoft.PowerToys.Configure -Property @{ Debug = $true; Awake = @{ Enabled = $false; Mode = "TIMED"; IntervalMinutes = "10" } }
|
||||
```
|
||||
|
||||
Note that we've supplied `Debug` option, so a `%TEMP\PowerToys.DSC.TestConfigure.txt` is created with the supplied properties, a current timestamp, and other debug output.
|
||||
|
||||
Finally, you can test it with winget by invoking it as such:
|
||||
|
||||
```ps
|
||||
winget configure .\configuration.dsc.yaml --accept-configuration-agreements --disable-interactivity
|
||||
```
|
||||
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 206 KiB |
@@ -46,51 +46,6 @@
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
<?if $(var.PerUser) = "true" ?>
|
||||
<DirectoryRef Id="PersonalFolder">
|
||||
<Directory Id="WindowsPowerShellFolder" Name="PowerShell">
|
||||
<Directory Id="PowerShellModulesFolder" Name="Modules">
|
||||
<Directory Id="PowerToysDscFolder" Name="Microsoft.PowerToys.Configure">
|
||||
<Directory Id="PowerToysDscVerFolder" Name="$(var.Version)">
|
||||
<Component Id="PowerToysDSC" Win64="yes" Guid="4A033E3B-6590-43FD-8FBD-27F9DF557F7F">
|
||||
<RegistryValue Root="HKCU"
|
||||
Key="Software\[Manufacturer]\[ProductName]"
|
||||
Name="DSCInstalled"
|
||||
Type="integer"
|
||||
Value="1"
|
||||
KeyPath="yes"/>
|
||||
<!-- Don't fail installation because of DSC. Files are marked as not vital. -->
|
||||
<File Vital="no" Source="$(var.RepoDir)\src\dsc\Microsoft.PowerToys.Configure\Generated\Microsoft.PowerToys.Configure\$(var.Version)\Microsoft.PowerToys.Configure.psd1" Id="PTConf.psd1" />
|
||||
<File Vital="no" Source="$(var.RepoDir)\src\dsc\Microsoft.PowerToys.Configure\Generated\Microsoft.PowerToys.Configure\$(var.Version)\Microsoft.PowerToys.Configure.psm1" Id="PTConf.psm1" />
|
||||
<RemoveFolder Id="RemoveThisFolder" On="uninstall" />
|
||||
<RemoveFolder Id="RemovePowerToysDscVerFolder" Directory="PowerToysDscVerFolder" On="uninstall" />
|
||||
<RemoveFolder Id="RemovePowerToysDscFolder" Directory="PowerToysDscFolder" On="uninstall" />
|
||||
<RemoveFolder Id="RemovePowerShellModulesFolder" Directory="PowerShellModulesFolder" On="uninstall" />
|
||||
<RemoveFolder Id="RemoveWindowsPowerShellFolder" Directory="WindowsPowerShellFolder" On="uninstall" />
|
||||
</Component>
|
||||
</Directory>
|
||||
</Directory>
|
||||
</Directory>
|
||||
</Directory>
|
||||
</DirectoryRef>
|
||||
<?else?>
|
||||
<DirectoryRef Id="ProgramFiles64Folder">
|
||||
<Directory Id="WindowsPowerShellFolder" Name="WindowsPowerShell">
|
||||
<Directory Id="PowerShellModulesFolder" Name="Modules">
|
||||
<Directory Id="PowerToysDscFolder" Name="Microsoft.PowerToys.Configure">
|
||||
<Directory Id="PowerToysDscVerFolder" Name="$(var.Version)">
|
||||
<Component Id="PowerToysDSC" Win64="yes" Guid="C52AECA0-DA73-49B8-BB49-31EF6640FF1F">
|
||||
<!-- Don't fail installation because of DSC. Files are marked as not vital. -->
|
||||
<File Vital="no" Source="$(var.RepoDir)\src\dsc\Microsoft.PowerToys.Configure\Generated\Microsoft.PowerToys.Configure\$(var.Version)\Microsoft.PowerToys.Configure.psd1" Id="PTConf.psd1" />
|
||||
<File Vital="no" Source="$(var.RepoDir)\src\dsc\Microsoft.PowerToys.Configure\Generated\Microsoft.PowerToys.Configure\$(var.Version)\Microsoft.PowerToys.Configure.psm1" Id="PTConf.psm1" />
|
||||
</Component>
|
||||
</Directory>
|
||||
</Directory>
|
||||
</Directory>
|
||||
</Directory>
|
||||
</DirectoryRef>
|
||||
<?endif?>
|
||||
|
||||
<DirectoryRef Id="ApplicationProgramsFolder">
|
||||
<Component Id="PowerToysStartMenuShortcut" >
|
||||
<Shortcut Id="ApplicationStartMenuShortcut"
|
||||
@@ -146,7 +101,6 @@
|
||||
<ComponentRef Id="License_rtf" />
|
||||
<ComponentRef Id="Notice_md" />
|
||||
<ComponentRef Id="DesktopShortcut" />
|
||||
<ComponentRef Id="PowerToysDSC" />
|
||||
</ComponentGroup>
|
||||
</Fragment>
|
||||
</Wix>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<?include $(sys.CURRENTDIR)\Common.wxi?>
|
||||
|
||||
<?define HostsAssetsFiles=?>
|
||||
<?define HostsAssetsFilesPath=$(var.BinDir)WinUI3Apps\Assets\Hosts\?>
|
||||
<?define HostsAssetsFilesPath=$(var.BinDir)WinUI3Apps\Assets\HostsPackageConsumer\?>
|
||||
|
||||
<Fragment>
|
||||
<DirectoryRef Id="WinUI3AppsAssetsFolder">
|
||||
|
||||
@@ -25,11 +25,6 @@
|
||||
<?if $(sys.BUILDARCH) = x64 ?>
|
||||
<File Source="$(var.BinDir)KeyboardManagerEditor\vcruntime140_1_app.dll" />
|
||||
<?endif ?>
|
||||
<!-- Latest CppWinRT upgrade made Keyboard Manager Editor depend on additional VC Runtime libraries. -->
|
||||
<!-- These are not in the Keyboard Manager Editor build output. So we copy them from the base build directory. -->
|
||||
<File Source="$(var.BinDir)vcruntime140.dll" />
|
||||
<File Source="$(var.BinDir)vcruntime140_1.dll" />
|
||||
<File Source="$(var.BinDir)msvcp140.dll" />
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
Vital="no">
|
||||
</ExePackage>
|
||||
<ExePackage
|
||||
DisplayName="Microsoft Edge WebView2"
|
||||
DisplayName="Installing Microsoft Edge WebView2"
|
||||
Name="MicrosoftEdgeWebview2Setup.exe"
|
||||
Compressed="yes"
|
||||
Id="WebView2"
|
||||
@@ -81,7 +81,7 @@
|
||||
UninstallCommand="/silent /uninstall">
|
||||
</ExePackage>
|
||||
<MsiPackage
|
||||
DisplayName="PowerToys MSI"
|
||||
DisplayName="Installing PowerToys"
|
||||
SourceFile="$(var.PowerToysPlatform)\Release\$(var.MSIPath)\$(var.MSIName)"
|
||||
Compressed="yes"
|
||||
DisplayInternalUI="no">
|
||||
|
||||
@@ -395,7 +395,6 @@
|
||||
<Directory Id="ApplicationProgramsFolder" Name="PowerToys (Preview)"/>
|
||||
</Directory>
|
||||
<Directory Id="DesktopFolder" Name="Desktop" />
|
||||
<Directory Id="PersonalFolder" Name="UserHomeDocuments" />
|
||||
</Directory>
|
||||
</Fragment>
|
||||
</Wix>
|
||||
|
||||
@@ -47,7 +47,7 @@ Invoke-Expression -Command "$PSScriptRoot\generateFileList.ps1 -fileDepsJson """
|
||||
Invoke-Expression -Command "$PSScriptRoot\generateFileComponents.ps1 -fileListName ""FileLocksmithAssetsFiles"" -wxsFilePath $PSScriptRoot\FileLocksmith.wxs -regroot $registryroot"
|
||||
|
||||
#Hosts
|
||||
Invoke-Expression -Command "$PSScriptRoot\generateFileList.ps1 -fileDepsJson """" -fileListName HostsAssetsFiles -wxsFilePath $PSScriptRoot\Hosts.wxs -depsPath ""$PSScriptRoot..\..\..\$platform\Release\WinUI3Apps\Assets\Hosts"""
|
||||
Invoke-Expression -Command "$PSScriptRoot\generateFileList.ps1 -fileDepsJson """" -fileListName HostsAssetsFiles -wxsFilePath $PSScriptRoot\Hosts.wxs -depsPath ""$PSScriptRoot..\..\..\$platform\Release\WinUI3Apps\Assets\HostsPackageConsumer"""
|
||||
Invoke-Expression -Command "$PSScriptRoot\generateFileComponents.ps1 -fileListName ""HostsAssetsFiles"" -wxsFilePath $PSScriptRoot\Hosts.wxs -regroot $registryroot"
|
||||
|
||||
#ImageResizer
|
||||
|
||||
@@ -1038,7 +1038,7 @@ UINT __stdcall TerminateProcessesCA(MSIHANDLE hInstall)
|
||||
L"PowerToys.ColorPickerUI.exe",
|
||||
L"PowerToys.AlwaysOnTop.exe",
|
||||
L"PowerToys.RegistryPreview.exe",
|
||||
L"PowerToys.Hosts.exe",
|
||||
L"PowerToys.HostsPackageConsumer.exe",
|
||||
L"PowerToys.PowerRename.exe",
|
||||
L"PowerToys.ImageResizer.exe",
|
||||
L"PowerToys.GcodeThumbnailProvider.exe",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.MSBuildCache.AzurePipelines" version="0.1.271-preview" />
|
||||
<package id="Microsoft.MSBuildCache.Local" version="0.1.271-preview" />
|
||||
<package id="Microsoft.MSBuildCache.SharedCompilation" version="0.1.271-preview" />
|
||||
<package id="Microsoft.MSBuildCache.AzurePipelines" version="0.1.258-preview" />
|
||||
<package id="Microsoft.MSBuildCache.Local" version="0.1.258-preview" />
|
||||
<package id="Microsoft.MSBuildCache.SharedCompilation" version="0.1.258-preview" />
|
||||
</packages>
|
||||
@@ -65,7 +65,7 @@ namespace Common.UI
|
||||
case SettingsWindow.MeasureTool:
|
||||
return "MeasureTool";
|
||||
case SettingsWindow.PowerOCR:
|
||||
return "PowerOcr";
|
||||
return "PowerOCR";
|
||||
case SettingsWindow.RegistryPreview:
|
||||
return "RegistryPreview";
|
||||
case SettingsWindow.CropAndLock:
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <common/version/version.h>
|
||||
|
||||
|
||||
using namespace System;
|
||||
using namespace System::Runtime::InteropServices;
|
||||
using System::Collections::Generic::List;
|
||||
@@ -39,17 +40,11 @@ public
|
||||
delete _map;
|
||||
}
|
||||
|
||||
String ^ GetKeyName(DWORD key)
|
||||
{
|
||||
String ^ GetKeyName(DWORD key) {
|
||||
return gcnew String(_map->GetKeyName(key).c_str());
|
||||
}
|
||||
|
||||
DWORD GetKeyValue(String ^ name)
|
||||
{
|
||||
return _map->GetKeyFromName(msclr::interop::marshal_as<std::wstring>(name));
|
||||
}
|
||||
|
||||
void Updatelayout()
|
||||
void Updatelayout()
|
||||
{
|
||||
_map->UpdateLayout();
|
||||
}
|
||||
@@ -134,13 +129,13 @@ public
|
||||
}
|
||||
|
||||
static List<String ^> ^ GetAllActiveMicrophoneDeviceNames() {
|
||||
auto names = gcnew List<String ^>();
|
||||
for (const auto& device : MicrophoneDevice::getAllActive())
|
||||
{
|
||||
names->Add(gcnew String(device->name().data()));
|
||||
}
|
||||
return names;
|
||||
auto names = gcnew List<String ^>();
|
||||
for (const auto& device : MicrophoneDevice::getAllActive())
|
||||
{
|
||||
names->Add(gcnew String(device->name().data()));
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
static List<String ^> ^
|
||||
GetAllVideoCaptureDeviceNames() {
|
||||
|
||||
@@ -262,7 +262,7 @@ inline registry::ChangeSet getRegistryPreviewChangeSet(const std::wstring instal
|
||||
changes.push_back({ scope, L"Software\\Classes\\regfile\\shell\\preview\\command", std::nullopt, command });
|
||||
|
||||
std::wstring icon_path = installationDir;
|
||||
icon_path.append(L"\\WinUI3Apps\\Assets\\RegistryPreview\\app.ico");
|
||||
icon_path.append(L"\\WinUI3Apps\\Assets\\RegistryPreview\\RegistryPreview.ico");
|
||||
changes.push_back({ scope, L"Software\\Classes\\regfile\\shell\\preview", L"icon", icon_path });
|
||||
|
||||
return { changes };
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
properties:
|
||||
resources:
|
||||
# - resource: Microsoft.WinGet.DSC/WinGetPackage
|
||||
# directives:
|
||||
# description: Install PowerToys
|
||||
# allowPrerelease: true
|
||||
# settings:
|
||||
# id: PowerToys (Preview)
|
||||
# source: winget
|
||||
|
||||
- resource: PowerToysConfigure
|
||||
directives:
|
||||
description: Configure PowerToys
|
||||
settings:
|
||||
ShortcutGuide:
|
||||
Enabled: false
|
||||
OverlayOpacity: 50
|
||||
FancyZones:
|
||||
Enabled: true
|
||||
FancyzonesEditorHotkey: "Shift+Ctrl+Alt+F"
|
||||
FileLocksmith:
|
||||
Enabled: false
|
||||
configurationVersion: 0.2.0
|
||||
@@ -1,53 +0,0 @@
|
||||
properties:
|
||||
resources:
|
||||
- resource: PowerToysConfigure
|
||||
directives:
|
||||
description: Configure PowerToys
|
||||
settings:
|
||||
PowerLauncher:
|
||||
Enabled: true
|
||||
Plugins:
|
||||
- Name: "Calculator"
|
||||
Disabled: false
|
||||
- Name: "Folder"
|
||||
Disabled: false
|
||||
- Name: "History"
|
||||
Disabled: false
|
||||
- Name: "Windows Search"
|
||||
Disabled: false
|
||||
- Name: "OneNote"
|
||||
Disabled: false
|
||||
- Name: "PowerToys"
|
||||
Disabled: false
|
||||
- Name: "Program"
|
||||
Disabled: false
|
||||
ActionKeyword: "P:"
|
||||
IsGlobal: false
|
||||
- Name: "Registry Plugin"
|
||||
Disabled: false
|
||||
- Name: "Service"
|
||||
Disabled: false
|
||||
- Name: "Shell"
|
||||
Disabled: false
|
||||
- Name: "Windows System Commands"
|
||||
Disabled: false
|
||||
- Name: "Time and Date"
|
||||
Disabled: false
|
||||
- Name: "Unit Converter"
|
||||
Disabled: false
|
||||
- Name: "URI Handler"
|
||||
Disabled: false
|
||||
- Name: "Value Generator"
|
||||
Disabled: false
|
||||
- Name: "Visual Studio Code Workspaces"
|
||||
Disabled: false
|
||||
- Name: "Web Search"
|
||||
Disabled: false
|
||||
- Name: "Windows settings"
|
||||
Disabled: false
|
||||
- Name: "Windows Terminal"
|
||||
Disabled: false
|
||||
- Name: "Window Walker"
|
||||
Disabled: false
|
||||
|
||||
configurationVersion: 0.2.0
|
||||
@@ -1,70 +0,0 @@
|
||||
properties:
|
||||
resources:
|
||||
- resource: PowerToysConfigure
|
||||
directives:
|
||||
description: Configure PowerToys
|
||||
settings:
|
||||
AlwaysOnTop:
|
||||
Enabled: false
|
||||
Awake:
|
||||
Enabled: false
|
||||
ColorPicker:
|
||||
Enabled: false
|
||||
CropAndLock:
|
||||
Enabled: false
|
||||
EnvironmentVariables:
|
||||
Enabled: false
|
||||
FancyZones:
|
||||
Enabled: false
|
||||
FileLocksmith:
|
||||
Enabled: false
|
||||
ImageResizer:
|
||||
Enabled: false
|
||||
KeyboardManager:
|
||||
Enabled: false
|
||||
FindMyMouse:
|
||||
Enabled: false
|
||||
MouseHighlighter:
|
||||
Enabled: false
|
||||
MouseJump:
|
||||
Enabled: false
|
||||
MousePointerCrosshairs:
|
||||
Enabled: false
|
||||
MouseWithoutBorders:
|
||||
Enabled: false
|
||||
Peek:
|
||||
Enabled: false
|
||||
PowerRename:
|
||||
Enabled: false
|
||||
PowerLauncher:
|
||||
Enabled: false
|
||||
PowerAccent:
|
||||
Enabled: false
|
||||
PowerPreview:
|
||||
EnableSvgPreview: false
|
||||
EnableSvgThumbnail: false
|
||||
EnableMdPreview: false
|
||||
EnableMonacoPreview: false
|
||||
EnablePdfPreview: false
|
||||
EnablePdfThumbnail: false
|
||||
EnableGcodePreview: false
|
||||
EnableGcodeThumbnail: false
|
||||
EnableStlThumbnail: false
|
||||
EnableQoiPreview: false
|
||||
EnableQoiThumbnail: false
|
||||
PowerOcr:
|
||||
Enabled: false
|
||||
ShortcutGuide:
|
||||
Enabled: false
|
||||
VideoConference:
|
||||
Enabled: false
|
||||
MeasureTool:
|
||||
Enabled: false
|
||||
Hosts:
|
||||
Enabled: false
|
||||
PastePlain:
|
||||
Enabled: false
|
||||
RegistryPreview:
|
||||
Enabled: false
|
||||
|
||||
configurationVersion: 0.2.0
|
||||
@@ -1,70 +0,0 @@
|
||||
properties:
|
||||
resources:
|
||||
- resource: PowerToysConfigure
|
||||
directives:
|
||||
description: Configure PowerToys
|
||||
settings:
|
||||
AlwaysOnTop:
|
||||
Enabled: true
|
||||
Awake:
|
||||
Enabled: true
|
||||
ColorPicker:
|
||||
Enabled: true
|
||||
CropAndLock:
|
||||
Enabled: true
|
||||
EnvironmentVariables:
|
||||
Enabled: true
|
||||
FancyZones:
|
||||
Enabled: true
|
||||
FileLocksmith:
|
||||
Enabled: true
|
||||
ImageResizer:
|
||||
Enabled: true
|
||||
KeyboardManager:
|
||||
Enabled: true
|
||||
FindMyMouse:
|
||||
Enabled: true
|
||||
MouseHighlighter:
|
||||
Enabled: true
|
||||
MouseJump:
|
||||
Enabled: true
|
||||
MousePointerCrosshairs:
|
||||
Enabled: true
|
||||
MouseWithoutBorders:
|
||||
Enabled: true
|
||||
Peek:
|
||||
Enabled: true
|
||||
PowerRename:
|
||||
Enabled: true
|
||||
PowerLauncher:
|
||||
Enabled: true
|
||||
PowerAccent:
|
||||
Enabled: true
|
||||
PowerPreview:
|
||||
EnableSvgPreview: true
|
||||
EnableSvgThumbnail: true
|
||||
EnableMdPreview: true
|
||||
EnableMonacoPreview: true
|
||||
EnablePdfPreview: true
|
||||
EnablePdfThumbnail: true
|
||||
EnableGcodePreview: true
|
||||
EnableGcodeThumbnail: true
|
||||
EnableStlThumbnail: true
|
||||
EnableQoiPreview: true
|
||||
EnableQoiThumbnail: true
|
||||
PowerOcr:
|
||||
Enabled: true
|
||||
ShortcutGuide:
|
||||
Enabled: true
|
||||
VideoConference:
|
||||
Enabled: true
|
||||
MeasureTool:
|
||||
Enabled: true
|
||||
Hosts:
|
||||
Enabled: true
|
||||
PastePlain:
|
||||
Enabled: true
|
||||
RegistryPreview:
|
||||
Enabled: true
|
||||
|
||||
configurationVersion: 0.2.0
|
||||
@@ -1,31 +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.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PowerToys.Settings.DSC.Schema;
|
||||
|
||||
internal sealed class Common
|
||||
{
|
||||
private static string[] TypeParts(string name)
|
||||
{
|
||||
return Regex.Split(name.ToLower(CultureInfo.CurrentCulture), @"(?<!^)(?=[A-Z])|\.");
|
||||
}
|
||||
|
||||
internal static bool InferIsBool(Type propertyInfo)
|
||||
{
|
||||
return TypeParts(propertyInfo.Name).Any(word => word.Equals("Bool", StringComparison.OrdinalIgnoreCase) || word.Equals("Boolean", StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
internal static bool InferIsInt(Type propertyInfo)
|
||||
{
|
||||
return TypeParts(propertyInfo.Name).Any(word => word.Contains("Int", StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
}
|
||||
@@ -1,477 +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.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using static PowerToys.Settings.DSC.Schema.Introspection;
|
||||
|
||||
namespace PowerToys.Settings.DSC.Schema;
|
||||
|
||||
internal sealed class DSCGeneration
|
||||
{
|
||||
private static readonly string DoubleNewLine = Environment.NewLine + Environment.NewLine;
|
||||
|
||||
private struct AdditionalPropertiesInfo
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public string Type;
|
||||
}
|
||||
|
||||
private static readonly Dictionary<string, AdditionalPropertiesInfo> AdditionalPropertiesInfoPerModule = new Dictionary<string, AdditionalPropertiesInfo> { { "PowerLauncher", new AdditionalPropertiesInfo { Name = "Plugins", Type = "Hashtable[]" } } };
|
||||
|
||||
private static string EmitEnumDefinition(Type type)
|
||||
{
|
||||
var values = string.Empty;
|
||||
|
||||
int i = 0;
|
||||
foreach (var name in Enum.GetNames(type))
|
||||
{
|
||||
values += " " + name;
|
||||
|
||||
// Nullable enums seem to be not supported by winget, so the workaround is to always start with '1', because by default the values are initialized to zero. That allows us to use zero as a "lack of value" indicator.
|
||||
if (i == 0)
|
||||
{
|
||||
values += " = 1";
|
||||
}
|
||||
|
||||
values += Environment.NewLine;
|
||||
i++;
|
||||
}
|
||||
|
||||
return $$"""
|
||||
enum {{type.Name}} {
|
||||
{{values}}}
|
||||
""";
|
||||
}
|
||||
|
||||
private struct PropertyEmitInfo
|
||||
{
|
||||
public string Name;
|
||||
public string Type;
|
||||
public string Initializer;
|
||||
public string EqualityOperator;
|
||||
public string DefaultValue;
|
||||
|
||||
public PropertyEmitInfo(string name, Type property)
|
||||
{
|
||||
Name = name;
|
||||
|
||||
bool intLike = Common.InferIsInt(property);
|
||||
bool boolLike = Common.InferIsBool(property);
|
||||
|
||||
var rawType = "string";
|
||||
var isNullable = true;
|
||||
DefaultValue = "$null";
|
||||
EqualityOperator = "-ne";
|
||||
Initializer = "= $null";
|
||||
|
||||
if (intLike)
|
||||
{
|
||||
rawType = "int";
|
||||
isNullable = false;
|
||||
}
|
||||
else if (boolLike)
|
||||
{
|
||||
rawType = "bool";
|
||||
isNullable = false;
|
||||
}
|
||||
else if (property.IsEnum)
|
||||
{
|
||||
rawType = property.Name;
|
||||
isNullable = true;
|
||||
Initializer = string.Empty;
|
||||
DefaultValue = "0";
|
||||
}
|
||||
|
||||
// For strings
|
||||
else
|
||||
{
|
||||
EqualityOperator = "-notlike";
|
||||
DefaultValue = "''";
|
||||
}
|
||||
|
||||
// We must make all our properties nullable to be able to detect which of them weren't supplied
|
||||
Type = isNullable ? rawType : $"Nullable[{rawType}]";
|
||||
}
|
||||
}
|
||||
|
||||
private static string EmitPropertyDefinition(PropertyEmitInfo info)
|
||||
{
|
||||
return $$"""
|
||||
[DscProperty()] [{{info.Type}}]
|
||||
${{info.Name}} {{info.Initializer}}
|
||||
""";
|
||||
}
|
||||
|
||||
private static string EmitPropertyApplyChangeStatements(string moduleName, PropertyEmitInfo info, string localPropertyName = null)
|
||||
{
|
||||
if (localPropertyName == null)
|
||||
{
|
||||
localPropertyName = info.Name;
|
||||
}
|
||||
|
||||
return $$"""
|
||||
if ($this.{{localPropertyName}} {{info.EqualityOperator}} {{info.DefaultValue}}) {
|
||||
$Changes.Value += "set {{moduleName}}.{{info.Name}} `"$($this.{{localPropertyName}})`""
|
||||
}
|
||||
""";
|
||||
}
|
||||
|
||||
private static string EmitModuleDefinition(SettingsStructure module)
|
||||
{
|
||||
bool generalSettings = module.Name == "GeneralSettings";
|
||||
|
||||
var properties = module.Properties
|
||||
.Where(property => !property.Value.IsIgnored)
|
||||
.Select(property => new PropertyEmitInfo(property.Key, property.Value.Type));
|
||||
|
||||
var propertyDefinitionsBlock = string.Empty;
|
||||
var applyChangesBlock = string.Empty;
|
||||
|
||||
foreach (var property in properties)
|
||||
{
|
||||
var definition = EmitPropertyDefinition(property);
|
||||
var applyChanges = EmitPropertyApplyChangeStatements(module.Name, property);
|
||||
|
||||
propertyDefinitionsBlock += definition + DoubleNewLine;
|
||||
applyChangesBlock += applyChanges + DoubleNewLine;
|
||||
}
|
||||
|
||||
bool hasAdditionalProperties = AdditionalPropertiesInfoPerModule.TryGetValue(module.Name, out var additionalPropertiesInfo);
|
||||
|
||||
// Enabled property of each module is contained in General settings
|
||||
if (!generalSettings)
|
||||
{
|
||||
propertyDefinitionsBlock += $$"""
|
||||
[DscProperty(Key)] [Nullable[bool]]
|
||||
$Enabled = $null
|
||||
|
||||
""";
|
||||
|
||||
if (hasAdditionalProperties)
|
||||
{
|
||||
propertyDefinitionsBlock += $$"""
|
||||
|
||||
[DscProperty()] [{{additionalPropertiesInfo.Type}}]
|
||||
${{additionalPropertiesInfo.Name}} = @()
|
||||
|
||||
|
||||
""";
|
||||
}
|
||||
|
||||
applyChangesBlock += EmitPropertyApplyChangeStatements("General.Enabled", new PropertyEmitInfo($"{module.Name}", typeof(bool)), "Enabled");
|
||||
}
|
||||
|
||||
var additionalPropertiesCheckBlock = string.Empty;
|
||||
if (hasAdditionalProperties)
|
||||
{
|
||||
additionalPropertiesCheckBlock = $$"""
|
||||
if ($this.{{additionalPropertiesInfo.Name}}.Count -gt 0) {
|
||||
$AdditionalPropertiesTmpPath = [System.IO.Path]::GetTempFileName()
|
||||
$this.{{additionalPropertiesInfo.Name}} | ConvertTo-Json | Set-Content -Path $AdditionalPropertiesTmpPath
|
||||
$Changes.Value += "setAdditional {{module.Name}} `"$AdditionalPropertiesTmpPath`""
|
||||
}
|
||||
""";
|
||||
}
|
||||
|
||||
return $$"""
|
||||
class {{module.Name}} {
|
||||
{{propertyDefinitionsBlock}} ApplyChanges([ref]$Changes) {
|
||||
{{applyChangesBlock}}
|
||||
|
||||
{{additionalPropertiesCheckBlock}}
|
||||
}
|
||||
}
|
||||
|
||||
""";
|
||||
}
|
||||
|
||||
public static string EmitModuleFileContents(SettingsStructure[] moduleSettings, SettingsStructure generalSettings, string debugSettingsPath)
|
||||
{
|
||||
var enumsToEmit = new HashSet<Type>();
|
||||
|
||||
var modulesBlock = string.Empty;
|
||||
var modulesResourcePropertiesBlock = string.Empty;
|
||||
var applyModulesChangesBlock = string.Empty;
|
||||
|
||||
foreach (var module in moduleSettings.Append(generalSettings))
|
||||
{
|
||||
enumsToEmit.UnionWith(module.Properties
|
||||
.Where(property => property.Value.Type.IsEnum)
|
||||
.Select(property => property.Value.Type));
|
||||
|
||||
modulesBlock += EmitModuleDefinition(module);
|
||||
|
||||
applyModulesChangesBlock += $$"""
|
||||
$this.{{module.Name}}.ApplyChanges([ref]$ChangesToApply)
|
||||
|
||||
""";
|
||||
|
||||
modulesResourcePropertiesBlock += $$"""
|
||||
[DscProperty()]
|
||||
[{{module.Name}}]${{module.Name}} = [{{module.Name}}]::new()
|
||||
|
||||
|
||||
""";
|
||||
}
|
||||
|
||||
var enumsBlock = string.Join(DoubleNewLine, enumsToEmit.Select(EmitEnumDefinition));
|
||||
var version = interop.CommonManaged.GetProductVersion().Replace("v", string.Empty);
|
||||
var outputResult = string.Empty;
|
||||
|
||||
outputResult += $$"""
|
||||
#region enums
|
||||
enum PowerToysConfigureEnsure {
|
||||
Absent
|
||||
Present
|
||||
}
|
||||
|
||||
{{enumsBlock}}
|
||||
#endregion enums
|
||||
|
||||
#region DscResources
|
||||
{{modulesBlock}}
|
||||
[DscResource()]
|
||||
class PowerToysConfigure {
|
||||
[DscProperty(Key)] [PowerToysConfigureEnsure]
|
||||
$Ensure = [PowerToysConfigureEnsure]::Present
|
||||
|
||||
[bool] $Debug = $false
|
||||
|
||||
{{modulesResourcePropertiesBlock}}
|
||||
|
||||
""";
|
||||
|
||||
#if DEBUG
|
||||
// Only output PowerToysSettings local build for debug builds. No need to expose release build locations.
|
||||
outputResult += $$"""
|
||||
[string] GetPowerToysSettingsPath() {
|
||||
if ($this.Debug -eq $true) {
|
||||
$SettingsExePath = "{{debugSettingsPath}}"
|
||||
} else {
|
||||
$installation = Get-CimInstance Win32_Product | Where-Object {$_.Name -eq "PowerToys (Preview)" -and $_.Version -eq "{{version}}"}
|
||||
|
||||
if ($installation) {
|
||||
$SettingsExePath = Join-Path (Join-Path $installation.InstallLocation WinUI3Apps) PowerToys.Settings.exe
|
||||
$SettingsExePath = "`"$SettingsExePath`""
|
||||
} else {
|
||||
throw "PowerToys installation wasn't found."
|
||||
}
|
||||
}
|
||||
|
||||
return $SettingsExePath
|
||||
}
|
||||
|
||||
""";
|
||||
#else
|
||||
outputResult += $$"""
|
||||
[string] GetPowerToysSettingsPath() {
|
||||
$installation = Get-CimInstance Win32_Product | Where-Object {$_.Name -eq "PowerToys (Preview)" -and $_.Version -eq "{{version}}"}
|
||||
|
||||
if ($installation) {
|
||||
$SettingsExePath = Join-Path (Join-Path $installation.InstallLocation WinUI3Apps) PowerToys.Settings.exe
|
||||
$SettingsExePath = "`"$SettingsExePath`""
|
||||
} else {
|
||||
throw "PowerToys installation wasn't found."
|
||||
}
|
||||
|
||||
return $SettingsExePath
|
||||
}
|
||||
|
||||
""";
|
||||
#endif
|
||||
|
||||
outputResult += $$"""
|
||||
|
||||
[PowerToysConfigure] Get() {
|
||||
$CurrentState = [PowerToysConfigure]::new()
|
||||
$SettingsExePath = $this.GetPowerToysSettingsPath()
|
||||
$SettingsTmpFilePath = [System.IO.Path]::GetTempFileName()
|
||||
|
||||
$SettingsToRequest = @{}
|
||||
foreach ($module in $CurrentState.PSObject.Properties) {
|
||||
$moduleName = $module.Name
|
||||
# Skip utility properties
|
||||
if ($moduleName -eq "Ensure" -or $moduleName -eq "Debug") {
|
||||
continue
|
||||
}
|
||||
|
||||
$moduleProperties = $module.Value
|
||||
$propertiesArray = @()
|
||||
foreach ($property in $moduleProperties.PSObject.Properties) {
|
||||
$propertyName = $property.Name
|
||||
# Skip Enabled properties - they should be requested from GeneralSettings
|
||||
if ($propertyName -eq "Enabled") {
|
||||
continue
|
||||
}
|
||||
|
||||
$propertiesArray += $propertyName
|
||||
}
|
||||
|
||||
$SettingsToRequest[$moduleName] = $propertiesArray
|
||||
}
|
||||
|
||||
$settingsJson = $SettingsToRequest | ConvertTo-Json
|
||||
$settingsJson | Set-Content -Path $SettingsTmpFilePath
|
||||
|
||||
Start-Process -FilePath $SettingsExePath -Wait -Args "get `"$SettingsTmpFilePath`""
|
||||
$SettingsValues = Get-Content -Path $SettingsTmpFilePath -Raw
|
||||
|
||||
if ($this.Debug -eq $true) {
|
||||
$TempFilePath = Join-Path -Path $env:TEMP -ChildPath "PowerToys.DSC.TestConfigure.txt"
|
||||
Set-Content -Path "$TempFilePath" -Value ("Requested:`r`n" + $settingsJson + "`r`n" + "Got:`r`n" + $SettingsValues + "`r`n" + (Get-Date -Format "o")) -Force
|
||||
}
|
||||
|
||||
$SettingsValues = $SettingsValues | ConvertFrom-Json
|
||||
foreach ($module in $SettingsValues.PSObject.Properties) {
|
||||
$moduleName = $module.Name
|
||||
$obtainedModuleSettings = $module.Value
|
||||
$moduleRef = $CurrentState.$moduleName
|
||||
foreach ($property in $obtainedModuleSettings.PSObject.Properties) {
|
||||
$propertyName = $property.Name
|
||||
$moduleRef.$propertyName = $property.Value
|
||||
}
|
||||
}
|
||||
|
||||
Remove-Item -Path $SettingsTmpFilePath
|
||||
|
||||
return $CurrentState
|
||||
}
|
||||
|
||||
[bool] Test() {
|
||||
# NB: we must always assume that the configuration isn't applied, because changing some settings produce external side-effects
|
||||
return $false
|
||||
}
|
||||
|
||||
[void] Set() {
|
||||
$SettingsExePath = $this.GetPowerToysSettingsPath()
|
||||
$ChangesToApply = @()
|
||||
|
||||
{{applyModulesChangesBlock}}
|
||||
if ($this.Debug -eq $true) {
|
||||
$tmp_info = $ChangesToApply
|
||||
# $tmp_info = $this | ConvertTo-Json -Depth 10
|
||||
|
||||
$TempFilePath = Join-Path -Path $env:TEMP -ChildPath "PowerToys.DSC.TestConfigure.txt"
|
||||
Set-Content -Path "$TempFilePath" -Value ($tmp_info + "`r`n" + (Get-Date -Format "o")) -Force
|
||||
}
|
||||
|
||||
# Stop any running PowerToys instances
|
||||
Stop-Process -Name "PowerToys.Settings" -Force -PassThru | Wait-Process
|
||||
$PowerToysProcessStopped = Stop-Process -Name "PowerToys" -Force -PassThru
|
||||
$PowerToysProcessStopped | Wait-Process
|
||||
|
||||
foreach ($change in $ChangesToApply) {
|
||||
Start-Process -FilePath $SettingsExePath -Wait -Args "$change"
|
||||
}
|
||||
|
||||
# If the PowerToys process was stopped, restart it.
|
||||
if ($PowerToysProcessStopped -ne $null) {
|
||||
Start-Process -FilePath $SettingsExePath
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion DscResources
|
||||
""";
|
||||
|
||||
return outputResult;
|
||||
}
|
||||
|
||||
public static string EmitManifestFileContents()
|
||||
{
|
||||
var version = interop.CommonManaged.GetProductVersion().Replace("v", string.Empty);
|
||||
var generatedDate = DateTime.Now.ToString("dd.MM.yyyy", CultureInfo.InvariantCulture);
|
||||
|
||||
return $$"""
|
||||
#
|
||||
# Module manifest for module 'Microsoft.PowerToys.Configure'
|
||||
#
|
||||
# Generated by: Microsoft Corporation
|
||||
#
|
||||
# Generated on: {{generatedDate}}
|
||||
#
|
||||
|
||||
@{
|
||||
|
||||
# Script module or binary module file associated with this manifest.
|
||||
RootModule = 'Microsoft.PowerToys.Configure.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '{{version}}'
|
||||
|
||||
# ID used to uniquely identify this module
|
||||
GUID = '778ed7a1-489d-4dc9-b0f2-2da3b1fe14cb'
|
||||
|
||||
# Author of this module
|
||||
Author = 'Microsoft Corporation'
|
||||
|
||||
# Company or vendor of this module
|
||||
CompanyName = 'Microsoft'
|
||||
|
||||
# Copyright statement for this module
|
||||
Copyright = '(c) Microsoft Corporation. All rights reserved.'
|
||||
|
||||
# Description of the functionality provided by this module
|
||||
Description = 'The module enables settings configuration for an installed PowerToys application.'
|
||||
|
||||
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
|
||||
FunctionsToExport = '*'
|
||||
|
||||
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
|
||||
CmdletsToExport = @()
|
||||
|
||||
# Variables to export from this module
|
||||
VariablesToExport = @()
|
||||
|
||||
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
|
||||
AliasesToExport = @()
|
||||
|
||||
# DSC resources to export from this module
|
||||
DscResourcesToExport = @(
|
||||
'PowerToysConfigure'
|
||||
)
|
||||
|
||||
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
|
||||
PrivateData = @{
|
||||
|
||||
PSData = @{
|
||||
|
||||
# Tags applied to this module. These help with module discovery in online galleries.
|
||||
# Tags = @()
|
||||
|
||||
# A URL to the license for this module.
|
||||
# LicenseUri = ''
|
||||
|
||||
# A URL to the main website for this project.
|
||||
# ProjectUri = ''
|
||||
|
||||
# A URL to an icon representing this module.
|
||||
# IconUri = ''
|
||||
|
||||
# ReleaseNotes of this module
|
||||
# ReleaseNotes = ''
|
||||
|
||||
# Prerelease string of this module
|
||||
# Prerelease = ''
|
||||
|
||||
# Flag to indicate whether the module requires explicit user acceptance for install/update/save
|
||||
# RequireLicenseAcceptance = $false
|
||||
|
||||
# External dependent modules of this module
|
||||
# ExternalModuleDependencies = @()
|
||||
|
||||
} # End of PSData hashtable
|
||||
|
||||
} # End of PrivateData hashtable
|
||||
|
||||
}
|
||||
|
||||
|
||||
""";
|
||||
}
|
||||
}
|
||||
@@ -1,79 +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.Linq;
|
||||
using static PowerToys.Settings.DSC.Schema.Introspection;
|
||||
|
||||
namespace PowerToys.Settings.DSC.Schema;
|
||||
|
||||
internal sealed class DocumentationGeneration
|
||||
{
|
||||
private static readonly string IsAvailableSymbol = "✅";
|
||||
private static readonly string IsUnavailableSymbol = "❌";
|
||||
private static readonly string MissingValueIndicator = "—";
|
||||
|
||||
private static readonly string PropertySuffix = "Property";
|
||||
|
||||
private static string SimplifyPropertyType(string typeName)
|
||||
{
|
||||
if (typeName.EndsWith(PropertySuffix, StringComparison.InvariantCulture))
|
||||
{
|
||||
typeName = typeName.Remove(typeName.LastIndexOf(PropertySuffix, StringComparison.InvariantCulture), PropertySuffix.Length);
|
||||
}
|
||||
|
||||
return typeName;
|
||||
}
|
||||
|
||||
private static string EmitPropertyTableLine(string name, ModulePropertyStructure info)
|
||||
{
|
||||
bool isAvailable = !info.IsIgnored;
|
||||
var availabilitySymbol = isAvailable ? IsAvailableSymbol : IsUnavailableSymbol;
|
||||
var documentation = MissingValueIndicator;
|
||||
if (info.Type.IsEnum)
|
||||
{
|
||||
documentation = "Possible values: ";
|
||||
foreach (var enumValue in Enum.GetValues(info.Type))
|
||||
{
|
||||
documentation += enumValue.ToString() + ' ';
|
||||
}
|
||||
}
|
||||
|
||||
var propertyType = isAvailable ? SimplifyPropertyType(info.Type.Name) : MissingValueIndicator;
|
||||
return $"| {name} | {propertyType} | {documentation} | {availabilitySymbol} |";
|
||||
}
|
||||
|
||||
private static string EmitModulePropertiesTable(SettingsStructure module)
|
||||
{
|
||||
bool generalSettings = module.Name == "GeneralSettings";
|
||||
|
||||
var properties = module.Properties
|
||||
.Where(p => !p.Value.IsIgnoredByJsonSerializer)
|
||||
.Select(property => EmitPropertyTableLine(property.Key, property.Value)).Aggregate((acc, line) => string.Join(Environment.NewLine, [acc, line]));
|
||||
|
||||
var propertyDefinitionsBlock = string.Empty;
|
||||
var applyChangesBlock = string.Empty;
|
||||
return $$"""
|
||||
### {{module.Name}}
|
||||
|
||||
| Name | Type | Description | Available |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
{{properties}}
|
||||
|
||||
|
||||
""";
|
||||
}
|
||||
|
||||
public static string EmitDocumentationFileContents(SettingsStructure[] moduleSettings, SettingsStructure generalSettings)
|
||||
{
|
||||
var moduleTables = string.Empty;
|
||||
|
||||
foreach (var module in moduleSettings.Append(generalSettings))
|
||||
{
|
||||
moduleTables += EmitModulePropertiesTable(module);
|
||||
}
|
||||
|
||||
return moduleTables;
|
||||
}
|
||||
}
|
||||
@@ -1,93 +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.Reflection;
|
||||
using System.Text.Json.Serialization;
|
||||
using Settings.UI.Library.Attributes;
|
||||
|
||||
namespace PowerToys.Settings.DSC.Schema;
|
||||
|
||||
public class Introspection
|
||||
{
|
||||
public struct ModulePropertyStructure
|
||||
{
|
||||
public bool IsIgnoredByJsonSerializer;
|
||||
public bool IsIgnoredByCmdConfigureAttribute;
|
||||
|
||||
public bool IsIgnored
|
||||
{
|
||||
get { return IsIgnoredByJsonSerializer || IsIgnoredByCmdConfigureAttribute; }
|
||||
}
|
||||
|
||||
public Type Type;
|
||||
}
|
||||
|
||||
public struct SettingsStructure
|
||||
{
|
||||
public string Name;
|
||||
public Dictionary<string, ModulePropertyStructure> Properties;
|
||||
}
|
||||
|
||||
private static bool IsModuleNameField(FieldInfo info)
|
||||
{
|
||||
return info != null && info.IsLiteral && !info.IsInitOnly
|
||||
&& info.FieldType == typeof(string);
|
||||
}
|
||||
|
||||
private static bool IsSettingsClassType(Type type)
|
||||
{
|
||||
return type.IsClass && type.FullName.EndsWith("Settings", StringComparison.InvariantCulture);
|
||||
}
|
||||
|
||||
private static Dictionary<string, ModulePropertyStructure> ParseProperties(Type propertiesType)
|
||||
{
|
||||
return propertiesType.GetProperties().Select(property =>
|
||||
{
|
||||
var jsonIgnoreAttr = property.GetCustomAttribute<JsonIgnoreAttribute>();
|
||||
var cmdIgnoreAttr = property.GetCustomAttribute<CmdConfigureIgnoreAttribute>();
|
||||
|
||||
return (property.Name, new ModulePropertyStructure
|
||||
{
|
||||
Type = property.PropertyType,
|
||||
IsIgnoredByJsonSerializer = jsonIgnoreAttr != null,
|
||||
IsIgnoredByCmdConfigureAttribute = cmdIgnoreAttr != null,
|
||||
});
|
||||
}).ToDictionary();
|
||||
}
|
||||
|
||||
public static SettingsStructure ParseGeneralSettings(Assembly assembly)
|
||||
{
|
||||
return assembly
|
||||
.GetTypes()
|
||||
.Where(IsSettingsClassType)
|
||||
.Where(type => type.Name == "GeneralSettings")
|
||||
.Select(type => new SettingsStructure
|
||||
{
|
||||
Name = type.Name,
|
||||
Properties = ParseProperties(type),
|
||||
}).FirstOrDefault();
|
||||
}
|
||||
|
||||
public static SettingsStructure[] ParseModuleSettings(Assembly assembly)
|
||||
{
|
||||
return assembly
|
||||
.GetTypes()
|
||||
.Where(IsSettingsClassType)
|
||||
.Select(type => new
|
||||
{
|
||||
Properties = type.GetProperty("Properties"),
|
||||
ModuleNameInfo = type.GetField("ModuleName", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy),
|
||||
TypeName = type.Name,
|
||||
})
|
||||
.Where(x => x.Properties?.PropertyType.IsClass == true && IsModuleNameField(x.ModuleNameInfo))
|
||||
.Select(x => new SettingsStructure
|
||||
{
|
||||
Name = x.TypeName.Replace("Settings", string.Empty),
|
||||
Properties = ParseProperties(x.Properties.PropertyType),
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\..\Version.props" />
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<RootNamespace>PowerToys.Settings.DSC.Schema</RootNamespace>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
<WindowsPackageType>None</WindowsPackageType>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<SelfContained>true</SelfContained>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- SelfContained=true requires RuntimeIdentifier to be set -->
|
||||
<PropertyGroup Condition="'$(Platform)'=='x64'">
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Platform)'=='ARM64'">
|
||||
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<NoWarn></NoWarn>
|
||||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
|
||||
<WarningsNotAsErrors>CA1720</WarningsNotAsErrors>
|
||||
<Optimize>False</Optimize>
|
||||
<DebugType>full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<NoWarn></NoWarn>
|
||||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
|
||||
<WarningsNotAsErrors>CA1720</WarningsNotAsErrors>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- See https://learn.microsoft.com/windows/apps/develop/platform/csharp-winrt/net-projection-from-cppwinrt-component for more info -->
|
||||
<PropertyGroup>
|
||||
<CsWinRTGeneratedFilesDir>$(OutDir)</CsWinRTGeneratedFilesDir>
|
||||
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\common\ManagedCommon\ManagedCommon.csproj" />
|
||||
<ProjectReference Include="..\..\settings-ui\Settings.UI.Library\Settings.UI.Library.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<GeneratedDSCModule>"$(ProjectDir)..\Microsoft.PowerToys.Configure\Generated\Microsoft.PowerToys.Configure\$(Version)\Microsoft.PowerToys.Configure.psm1"</GeneratedDSCModule>
|
||||
<GeneratedDSCManifest>"$(ProjectDir)..\Microsoft.PowerToys.Configure\Generated\Microsoft.PowerToys.Configure\$(Version)\Microsoft.PowerToys.Configure.psd1"</GeneratedDSCManifest>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- The following sections assume that the machine we're building on is always x64. That means we won't be able to run/inspect arm64 executables, therefore we must always execute x64 generator. -->
|
||||
|
||||
<Target Name="PostBuildAction" AfterTargets="Build" Outputs="$(GeneratedDSCModule)" Condition="'$(Platform)'!='ARM64'">
|
||||
<Exec Command=""$(OutDir)$(AssemblyName).exe" "$(SolutionDir)x64\$(Configuration)\WinUI3Apps\PowerToys.Settings.UI.Lib.dll" $(GeneratedDSCModule) $(GeneratedDSCManifest)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent" Condition="'$(Platform)'=='ARM64'">
|
||||
<Exec Command=""$(MSBuildToolsPath)\msbuild.exe" PowerToys.sln -p:Configuration="$(Configuration)" -p:Platform="x64" -verbosity:m -t:DSC\PowerToys_Settings_DSC_Schema_Generator" WorkingDirectory="$(SolutionDir)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -1,102 +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.Reflection;
|
||||
|
||||
namespace PowerToys.Settings.DSC.Schema;
|
||||
|
||||
internal sealed class Program
|
||||
{
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
if (args.Length < 2)
|
||||
{
|
||||
Console.WriteLine("Usage: Generator.exe <PowerToys.Settings.UI.Lib.dll path> <module output path> <manifest output path>");
|
||||
return 1;
|
||||
}
|
||||
|
||||
var dllPath = args[0];
|
||||
var moduleOutputPath = args[1];
|
||||
var manifestOutputPath = string.Empty;
|
||||
|
||||
bool documentationMode = Path.GetExtension(moduleOutputPath) == ".md";
|
||||
bool sampleMode = Path.GetExtension(moduleOutputPath) == ".yaml";
|
||||
|
||||
if (!documentationMode && !sampleMode)
|
||||
{
|
||||
if (args.Length < 3)
|
||||
{
|
||||
Console.WriteLine("Usage: Generator.exe <PowerToys.Settings.UI.Lib.dll path> <module output path> <manifest output path>");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
manifestOutputPath = args[2];
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(moduleOutputPath));
|
||||
|
||||
var assembly = Assembly.LoadFrom(dllPath);
|
||||
var moduleSettings = Introspection.ParseModuleSettings(assembly);
|
||||
var generalSettings = Introspection.ParseGeneralSettings(assembly);
|
||||
#if DEBUG
|
||||
PrintUniquePropertyTypes(moduleSettings);
|
||||
#endif
|
||||
var outputFileContents = string.Empty;
|
||||
if (documentationMode)
|
||||
{
|
||||
outputFileContents = DocumentationGeneration.EmitDocumentationFileContents(moduleSettings, generalSettings);
|
||||
}
|
||||
else if (sampleMode)
|
||||
{
|
||||
outputFileContents = SampleGeneration.EmitSampleFileContents(moduleSettings, generalSettings);
|
||||
}
|
||||
else
|
||||
{
|
||||
var manifestFileContents = DSCGeneration.EmitManifestFileContents();
|
||||
File.WriteAllText(manifestOutputPath, manifestFileContents);
|
||||
var debugSettingsPath = Path.Combine(Directory.GetParent(dllPath).FullName, "PowerToys.Settings.exe");
|
||||
outputFileContents = DSCGeneration.EmitModuleFileContents(moduleSettings, generalSettings, debugSettingsPath);
|
||||
}
|
||||
|
||||
File.WriteAllText(moduleOutputPath, outputFileContents);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Error: {ex.Message}");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static void PrintUniquePropertyTypes(Introspection.SettingsStructure[] moduleSettings)
|
||||
{
|
||||
Console.WriteLine("Detected the following module properties types:");
|
||||
var propertyTypes = new HashSet<Type>();
|
||||
foreach (var settings in moduleSettings)
|
||||
{
|
||||
Console.WriteLine($"{settings.Name}");
|
||||
foreach (var (_, property) in settings.Properties)
|
||||
{
|
||||
if (!property.IsIgnored)
|
||||
{
|
||||
propertyTypes.Add(property.Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine("\nDetected the following unique property types:");
|
||||
foreach (var type in propertyTypes)
|
||||
{
|
||||
Console.WriteLine($"{type}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,80 +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.Globalization;
|
||||
using System.Linq;
|
||||
using static PowerToys.Settings.DSC.Schema.Introspection;
|
||||
|
||||
namespace PowerToys.Settings.DSC.Schema;
|
||||
|
||||
internal sealed class SampleGeneration
|
||||
{
|
||||
private const int FixedSeed = 12345;
|
||||
private static readonly Random _random = new Random(FixedSeed);
|
||||
|
||||
private static string EmitPropertySetter(string name, ModulePropertyStructure info)
|
||||
{
|
||||
var randomPropertyValue = "\"<string>\"";
|
||||
if (Common.InferIsBool(info.Type))
|
||||
{
|
||||
randomPropertyValue = _random.Next(2) == 1 ? "true" : "false";
|
||||
}
|
||||
else if (Common.InferIsInt(info.Type))
|
||||
{
|
||||
randomPropertyValue = _random.Next(256).ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
else if (info.Type.IsEnum)
|
||||
{
|
||||
var enumValues = Enum.GetValues(info.Type);
|
||||
randomPropertyValue = enumValues.GetValue(_random.Next(enumValues.Length)).ToString();
|
||||
}
|
||||
|
||||
return $" {name}: {randomPropertyValue}";
|
||||
}
|
||||
|
||||
private static string EmitModulePropertiesSection(SettingsStructure module)
|
||||
{
|
||||
bool generalSettings = module.Name == "GeneralSettings";
|
||||
|
||||
var propertiesCollection = module.Properties
|
||||
.Where(p => !p.Value.IsIgnored)
|
||||
.Select(property => EmitPropertySetter(property.Key, property.Value))
|
||||
.ToList();
|
||||
|
||||
string properties = propertiesCollection.Count != 0
|
||||
? propertiesCollection.Aggregate((acc, line) => string.Join(Environment.NewLine, acc, line))
|
||||
: string.Empty;
|
||||
|
||||
var propertyDefinitionsBlock = string.Empty;
|
||||
var applyChangesBlock = string.Empty;
|
||||
return $$"""
|
||||
{{module.Name}}:
|
||||
{{properties}}
|
||||
|
||||
|
||||
""";
|
||||
}
|
||||
|
||||
public static string EmitSampleFileContents(SettingsStructure[] moduleSettings, SettingsStructure generalSettings)
|
||||
{
|
||||
var moduleTables = $$"""
|
||||
properties:
|
||||
resources:
|
||||
- resource: PowerToysConfigure
|
||||
directives:
|
||||
description: Configure PowerToys
|
||||
settings:
|
||||
|
||||
""";
|
||||
|
||||
foreach (var module in moduleSettings.Append(generalSettings))
|
||||
{
|
||||
moduleTables += EmitModulePropertiesSection(module);
|
||||
}
|
||||
|
||||
moduleTables += " configurationVersion: 0.2.0";
|
||||
return moduleTables;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="PowerToys.Settings.app"/>
|
||||
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<!-- The combination of below two tags have the following effect:
|
||||
1) Per-Monitor for >= Windows 10 Anniversary Update
|
||||
2) System < Windows 10 Anniversary Update
|
||||
-->
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
@@ -90,12 +90,14 @@ public:
|
||||
}
|
||||
|
||||
m_enabled = true;
|
||||
save_settings();
|
||||
}
|
||||
|
||||
virtual void disable() override
|
||||
{
|
||||
Logger::info(L"File Locksmith disabled");
|
||||
m_enabled = false;
|
||||
save_settings();
|
||||
}
|
||||
|
||||
virtual bool is_enabled() override
|
||||
@@ -121,7 +123,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_enabled = false;
|
||||
bool m_enabled;
|
||||
bool m_extended_only;
|
||||
|
||||
void init_settings()
|
||||
@@ -134,7 +136,7 @@ private:
|
||||
void save_settings()
|
||||
{
|
||||
auto& settings = FileLocksmithSettingsInstance();
|
||||
m_enabled = FileLocksmithSettingsInstance().GetEnabled();
|
||||
settings.SetEnabled(m_enabled);
|
||||
settings.SetExtendedContextMenuOnly(m_extended_only);
|
||||
|
||||
settings.Save();
|
||||
|
||||
@@ -18,12 +18,10 @@ static bool LastModifiedTime(const std::wstring& filePath, FILETIME* lpFileTime)
|
||||
|
||||
FileLocksmithSettings::FileLocksmithSettings()
|
||||
{
|
||||
generalJsonFilePath = PTSettingsHelper::get_powertoys_general_save_file_location();
|
||||
std::wstring savePath = PTSettingsHelper::get_module_save_folder_location(constants::nonlocalizable::PowerToyKey);
|
||||
std::error_code ec;
|
||||
|
||||
jsonFilePath = savePath + constants::nonlocalizable::DataFilePath;
|
||||
RefreshEnabledState();
|
||||
Load();
|
||||
}
|
||||
|
||||
@@ -31,6 +29,7 @@ void FileLocksmithSettings::Save()
|
||||
{
|
||||
json::JsonObject jsonData;
|
||||
|
||||
jsonData.SetNamedValue(constants::nonlocalizable::JsonKeyEnabled, json::value(settings.enabled));
|
||||
jsonData.SetNamedValue(constants::nonlocalizable::JsonKeyShowInExtendedContextMenu, json::value(settings.showInExtendedContextMenu));
|
||||
|
||||
json::to_file(jsonFilePath, jsonData);
|
||||
@@ -49,32 +48,6 @@ void FileLocksmithSettings::Load()
|
||||
}
|
||||
}
|
||||
|
||||
void FileLocksmithSettings::RefreshEnabledState()
|
||||
{
|
||||
// Load json settings from data file if it is modified in the meantime.
|
||||
FILETIME lastModifiedTime{};
|
||||
if (!(LastModifiedTime(generalJsonFilePath, &lastModifiedTime) &&
|
||||
CompareFileTime(&lastModifiedTime, &lastLoadedGeneralSettingsTime) == 1))
|
||||
return;
|
||||
|
||||
lastLoadedGeneralSettingsTime = lastModifiedTime;
|
||||
|
||||
auto json = json::from_file(generalJsonFilePath);
|
||||
if (!json)
|
||||
return;
|
||||
|
||||
const json::JsonObject& jsonSettings = json.value();
|
||||
try
|
||||
{
|
||||
json::JsonObject modulesEnabledState;
|
||||
json::get(jsonSettings, L"enabled", modulesEnabledState, json::JsonObject{});
|
||||
json::get(modulesEnabledState, L"File Locksmith", settings.enabled, true);
|
||||
}
|
||||
catch (const winrt::hresult_error&)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void FileLocksmithSettings::Reload()
|
||||
{
|
||||
// Load json settings from data file if it is modified in the meantime.
|
||||
@@ -94,6 +67,11 @@ void FileLocksmithSettings::ParseJson()
|
||||
const json::JsonObject& jsonSettings = json.value();
|
||||
try
|
||||
{
|
||||
if (json::has(jsonSettings, constants::nonlocalizable::JsonKeyEnabled, json::JsonValueType::Boolean))
|
||||
{
|
||||
settings.enabled = jsonSettings.GetNamedBoolean(constants::nonlocalizable::JsonKeyEnabled);
|
||||
}
|
||||
|
||||
if (json::has(jsonSettings, constants::nonlocalizable::JsonKeyShowInExtendedContextMenu, json::JsonValueType::Boolean))
|
||||
{
|
||||
settings.showInExtendedContextMenu = jsonSettings.GetNamedBoolean(constants::nonlocalizable::JsonKeyShowInExtendedContextMenu);
|
||||
|
||||
@@ -16,10 +16,15 @@ public:
|
||||
if (gpoSetting == powertoys_gpo::gpo_rule_configured_disabled)
|
||||
return false;
|
||||
Reload();
|
||||
RefreshEnabledState();
|
||||
return settings.enabled;
|
||||
}
|
||||
|
||||
inline void SetEnabled(bool enabled)
|
||||
{
|
||||
settings.enabled = enabled;
|
||||
Save();
|
||||
}
|
||||
|
||||
inline bool GetShowInExtendedContextMenu() const
|
||||
{
|
||||
return settings.showInExtendedContextMenu;
|
||||
@@ -40,15 +45,12 @@ private:
|
||||
bool showInExtendedContextMenu{ false };
|
||||
};
|
||||
|
||||
void RefreshEnabledState();
|
||||
void Reload();
|
||||
void ParseJson();
|
||||
|
||||
Settings settings;
|
||||
std::wstring generalJsonFilePath;
|
||||
std::wstring jsonFilePath;
|
||||
FILETIME lastLoadedTime{};
|
||||
FILETIME lastLoadedGeneralSettingsTime{};
|
||||
FILETIME lastLoadedTime;
|
||||
};
|
||||
|
||||
FileLocksmithSettings& FileLocksmithSettingsInstance();
|
||||
|
||||
@@ -12,7 +12,6 @@ using Hosts.Settings;
|
||||
using Hosts.Tests.Mocks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Moq;
|
||||
using Settings.UI.Library.Enumerations;
|
||||
|
||||
namespace Hosts.Tests
|
||||
{
|
||||
|
||||
@@ -16,9 +16,7 @@ using System.Threading.Tasks;
|
||||
using Hosts.Exceptions;
|
||||
using Hosts.Models;
|
||||
using Hosts.Settings;
|
||||
using ManagedCommon;
|
||||
using Microsoft.Win32;
|
||||
using Settings.UI.Library.Enumerations;
|
||||
|
||||
namespace Hosts.Helpers
|
||||
{
|
||||
@@ -277,7 +275,7 @@ namespace Hosts.Helpers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Failed to open default editor", ex);
|
||||
LoggerInstance.Logger.LogError("Failed to open default editor", ex);
|
||||
notepadFallback = true;
|
||||
}
|
||||
|
||||
@@ -289,7 +287,7 @@ namespace Hosts.Helpers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Failed to open notepad", ex);
|
||||
LoggerInstance.Logger.LogError("Failed to open notepad", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
23
src/modules/Hosts/Hosts/Helpers/ILogger.cs
Normal file
@@ -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 System;
|
||||
|
||||
namespace Hosts.Helpers
|
||||
{
|
||||
public interface ILogger
|
||||
{
|
||||
public void LogError(string message);
|
||||
|
||||
public void LogError(string message, Exception ex);
|
||||
|
||||
public void LogWarning(string message);
|
||||
|
||||
public void LogInfo(string message);
|
||||
|
||||
public void LogDebug(string message);
|
||||
|
||||
public void LogTrace();
|
||||
}
|
||||
}
|
||||
10
src/modules/Hosts/Hosts/Helpers/LoggerInstance.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
// 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.
|
||||
namespace Hosts.Helpers
|
||||
{
|
||||
public static class LoggerInstance
|
||||
{
|
||||
public static ILogger Logger { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ namespace Hosts.Helpers
|
||||
|
||||
static ResourceLoaderInstance()
|
||||
{
|
||||
ResourceLoader = new Microsoft.Windows.ApplicationModel.Resources.ResourceLoader("PowerToys.Hosts.pri");
|
||||
ResourceLoader = new Microsoft.Windows.ApplicationModel.Resources.ResourceLoader("PowerToys.Hosts.pri", "PowerToys.Hosts/Resources");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,71 +1,58 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\..\..\Version.props" />
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
|
||||
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
|
||||
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>net8.0-windows10.0.20348</TargetFramework>
|
||||
<RootNamespace>Hosts</RootNamespace>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
<UseWinUI>true</UseWinUI>
|
||||
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
|
||||
<WindowsPackageType>None</WindowsPackageType>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
|
||||
<OutputPath>..\..\..\..\$(Platform)\$(Configuration)\WinUI3Apps</OutputPath>
|
||||
<RootNamespace>Hosts</RootNamespace>
|
||||
<AssemblyName>PowerToys.Hosts</AssemblyName>
|
||||
<DefineConstants>DISABLE_XAML_GENERATED_MAIN,TRACE</DefineConstants>
|
||||
<ApplicationIcon>Assets/Hosts/Hosts.ico</ApplicationIcon>
|
||||
<SelfContained>true</SelfContained>
|
||||
<!-- MRT from windows app sdk will search for a pri file with the same name of the module before defaulting to resources.pri -->
|
||||
<ProjectPriFileName>PowerToys.Hosts.pri</ProjectPriFileName>
|
||||
|
||||
<GenerateLibraryLayout>true</GenerateLibraryLayout>
|
||||
<IsPackable>true</IsPackable>
|
||||
<Version>4.0.1</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Remove="HostsXAML\App.xaml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="HostsXAML\App.xaml" />
|
||||
<None Include="$(OutDir)\PowerToys.Hosts.pri" Pack="True" PackageCopyToOutput="True" PackagePath="contentFiles\any\$(TargetFramework)" />
|
||||
<XBFFile Include="$(OutDir)**\*.xbf" />
|
||||
<None Include="@(XBFFile)" Pack="True" PackageCopyToOutput="True" PackagePath="contentFiles\any\$(TargetFramework)" />
|
||||
<None Include="$(OutDir)\PowerToys.Hosts.pdb" Pack="True" PackageCopyToOutput="true" PackagePath="lib/$(TargetFramework)" />
|
||||
<None Include="PowerToys.Hosts.Assets\*" Pack="True" PackageCopyToOutput="True" PackagePath="contentFiles\any\$(TargetFramework)\PowerToys.Hosts.Assets"/>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- SelfContained=true requires RuntimeIdentifier to be set -->
|
||||
<PropertyGroup Condition="'$(Platform)'=='x64'">
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Platform)'=='ARM64'">
|
||||
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- See https://learn.microsoft.com/windows/apps/develop/platform/csharp-winrt/net-projection-from-cppwinrt-component for more info -->
|
||||
<PropertyGroup>
|
||||
<CsWinRTIncludes>PowerToys.GPOWrapper</CsWinRTIncludes>
|
||||
<CsWinRTGeneratedFilesDir>$(OutDir)</CsWinRTGeneratedFilesDir>
|
||||
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Assets\Hosts\AppList.scale-100.png" />
|
||||
<None Remove="Assets\Hosts\AppList.scale-125.png" />
|
||||
<None Remove="Assets\Hosts\AppList.scale-150.png" />
|
||||
<None Remove="Assets\Hosts\AppList.scale-200.png" />
|
||||
<None Remove="Assets\Hosts\AppList.scale-400.png" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Converters" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Extensions" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Collections" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" />
|
||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" />
|
||||
<PackageReference Include="System.IO.Abstractions" />
|
||||
<PackageReference Include="WinUIEx" />
|
||||
<Manifest Include="$(ApplicationManifest)" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -73,11 +60,4 @@
|
||||
<ProjectCapability Include="Msix" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\common\GPOWrapper\GPOWrapper.vcxproj" />
|
||||
<ProjectReference Include="..\..\..\common\interop\PowerToys.Interop.vcxproj" />
|
||||
<ProjectReference Include="..\..\..\common\Common.UI\Common.UI.csproj" />
|
||||
<ProjectReference Include="..\..\..\settings-ui\Settings.UI.Library\Settings.UI.Library.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<Page
|
||||
x:Class="Hosts.Views.MainPage"
|
||||
x:Class="Hosts.Views.HostsMainPage"
|
||||
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"
|
||||
@@ -21,21 +21,182 @@
|
||||
</i:Interaction.Behaviors>
|
||||
|
||||
<Page.Resources>
|
||||
<tkconverters:StringVisibilityConverter
|
||||
x:Key="StringVisibilityConverter"
|
||||
EmptyValue="Collapsed"
|
||||
NotEmptyValue="Visible" />
|
||||
<tkconverters:BoolNegationConverter x:Key="BoolNegationConverter" />
|
||||
<tkconverters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
|
||||
<tkconverters:BoolToVisibilityConverter
|
||||
x:Key="BoolToInvertedVisibilityConverter"
|
||||
FalseValue="Visible"
|
||||
TrueValue="Collapsed" />
|
||||
<tkconverters:DoubleToVisibilityConverter
|
||||
x:Key="DoubleToVisibilityConverter"
|
||||
FalseValue="Visible"
|
||||
GreaterThan="0"
|
||||
TrueValue="Collapsed" />
|
||||
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
|
||||
<!-- Other merged dictionaries here -->
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Default">
|
||||
<StaticResource x:Key="SubtleButtonBackground" ResourceKey="SubtleFillColorTransparent" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundPointerOver" ResourceKey="SubtleFillColorSecondary" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundPressed" ResourceKey="SubtleFillColorTertiary" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundDisabled" ResourceKey="SubtleFillColorTransparent" />
|
||||
|
||||
<StaticResource x:Key="SubtleButtonBorderBrush" ResourceKey="SubtleFillColorTransparent" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushPointerOver" ResourceKey="SubtleFillColorSecondary" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushPressed" ResourceKey="SubtleFillColorTertiary" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushDisabled" ResourceKey="SubtleFillColorTransparent" />
|
||||
|
||||
<StaticResource x:Key="SubtleButtonForeground" ResourceKey="TextFillColorPrimary" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundPointerOver" ResourceKey="TextFillColorPrimary" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundPressed" ResourceKey="TextFillColorSecondary" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundDisabled" ResourceKey="TextFillColorDisabled" />
|
||||
</ResourceDictionary>
|
||||
|
||||
<ResourceDictionary x:Key="Light">
|
||||
<StaticResource x:Key="SubtleButtonBackground" ResourceKey="SubtleFillColorTransparent" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundPointerOver" ResourceKey="SubtleFillColorSecondary" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundPressed" ResourceKey="SubtleFillColorTertiary" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundDisabled" ResourceKey="SubtleFillColorTransparent" />
|
||||
|
||||
<StaticResource x:Key="SubtleButtonBorderBrush" ResourceKey="SubtleFillColorTransparent" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushPointerOver" ResourceKey="SubtleFillColorSecondary" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushPressed" ResourceKey="SubtleFillColorTertiary" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushDisabled" ResourceKey="SubtleFillColorTransparent" />
|
||||
|
||||
<StaticResource x:Key="SubtleButtonForeground" ResourceKey="TextFillColorPrimary" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundPointerOver" ResourceKey="TextFillColorPrimary" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundPressed" ResourceKey="TextFillColorSecondary" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundDisabled" ResourceKey="TextFillColorDisabled" />
|
||||
</ResourceDictionary>
|
||||
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
<StaticResource x:Key="SubtleButtonBackground" ResourceKey="SystemColorWindowColorBrush" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundPointerOver" ResourceKey="SystemColorHighlightTextColorBrush" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundPressed" ResourceKey="SystemColorWindowColorBrush" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundDisabled" ResourceKey="SystemControlBackgroundBaseLowBrush" />
|
||||
|
||||
<StaticResource x:Key="SubtleButtonBorderBrush" ResourceKey="SystemColorWindowColorBrush" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushPointerOver" ResourceKey="SystemColorHighlightColorBrush" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushPressed" ResourceKey="SystemColorHighlightColorBrush" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushDisabled" ResourceKey="SystemColorGrayTextColor" />
|
||||
|
||||
<StaticResource x:Key="SubtleButtonForeground" ResourceKey="SystemColorButtonTextColorBrush" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundPointerOver" ResourceKey="SystemControlHighlightBaseHighBrush" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundPressed" ResourceKey="SystemControlHighlightBaseHighBrush" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundDisabled" ResourceKey="SystemControlDisabledBaseMediumLowBrush" />
|
||||
</ResourceDictionary>
|
||||
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
|
||||
<Style x:Key="SubtleButtonStyle" TargetType="Button">
|
||||
<Setter Property="Background" Value="{ThemeResource SubtleButtonBackground}" />
|
||||
<Setter Property="BackgroundSizing" Value="InnerBorderEdge" />
|
||||
<Setter Property="Foreground" Value="{ThemeResource SubtleButtonForeground}" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource SubtleButtonBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}" />
|
||||
<Setter Property="Padding" Value="{StaticResource ButtonPadding}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
|
||||
<Setter Property="FontWeight" Value="Normal" />
|
||||
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
|
||||
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
|
||||
<Setter Property="FocusVisualMargin" Value="-3" />
|
||||
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<ContentPresenter
|
||||
x:Name="ContentPresenter"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
AnimatedIcon.State="Normal"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Background="{TemplateBinding Background}"
|
||||
BackgroundSizing="{TemplateBinding BackgroundSizing}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
ContentTransitions="{TemplateBinding ContentTransitions}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
Foreground="{TemplateBinding Foreground}">
|
||||
<ContentPresenter.BackgroundTransition>
|
||||
<BrushTransition Duration="0:0:0.083" />
|
||||
</ContentPresenter.BackgroundTransition>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="PointerOver">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonBackgroundPointerOver}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonBorderBrushPointerOver}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonForegroundPointerOver}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="ContentPresenter.(AnimatedIcon.State)" Value="PointerOver" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Pressed">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonBackgroundPressed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonBorderBrushPressed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonForegroundPressed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="ContentPresenter.(AnimatedIcon.State)" Value="Pressed" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Disabled">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonBackgroundDisabled}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonBorderBrushDisabled}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonForegroundDisabled}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
<VisualState.Setters>
|
||||
<!-- DisabledVisual Should be handled by the control, not the animated icon. -->
|
||||
<Setter Target="ContentPresenter.(AnimatedIcon.State)" Value="Normal" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</ContentPresenter>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
|
||||
<tkconverters:StringVisibilityConverter
|
||||
x:Key="StringVisibilityConverter"
|
||||
EmptyValue="Collapsed"
|
||||
NotEmptyValue="Visible" />
|
||||
<tkconverters:BoolNegationConverter x:Key="BoolNegationConverter" />
|
||||
<tkconverters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
|
||||
<tkconverters:BoolToVisibilityConverter
|
||||
x:Key="BoolToInvertedVisibilityConverter"
|
||||
FalseValue="Visible"
|
||||
TrueValue="Collapsed" />
|
||||
<tkconverters:DoubleToVisibilityConverter
|
||||
x:Key="DoubleToVisibilityConverter"
|
||||
FalseValue="Visible"
|
||||
GreaterThan="0"
|
||||
TrueValue="Collapsed" />
|
||||
</ResourceDictionary>
|
||||
</Page.Resources>
|
||||
|
||||
<Grid Margin="16" RowSpacing="8">
|
||||
@@ -8,16 +8,14 @@ using System.Windows.Input;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Hosts.Helpers;
|
||||
using Hosts.Models;
|
||||
using Hosts.Settings;
|
||||
using Hosts.ViewModels;
|
||||
using ManagedCommon;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
|
||||
namespace Hosts.Views
|
||||
{
|
||||
public sealed partial class MainPage : Page
|
||||
public partial class HostsMainPage : Page
|
||||
{
|
||||
public MainViewModel ViewModel { get; private set; }
|
||||
|
||||
@@ -35,10 +33,11 @@ namespace Hosts.Views
|
||||
|
||||
public ICommand ExitCommand => new RelayCommand(() => { Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread().TryEnqueue(Application.Current.Exit); });
|
||||
|
||||
public MainPage()
|
||||
public HostsMainPage(MainViewModel viewModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
ViewModel = App.GetService<MainViewModel>();
|
||||
ViewModel = viewModel;
|
||||
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
@@ -128,7 +127,9 @@ namespace Hosts.Views
|
||||
|
||||
private async void Page_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var userSettings = App.GetService<IUserSettings>();
|
||||
ViewModel.ReadHosts();
|
||||
|
||||
var userSettings = ViewModel.UserSettings;
|
||||
if (userSettings.ShowStartupWarning)
|
||||
{
|
||||
var resourceLoader = Helpers.ResourceLoaderInstance.ResourceLoader;
|
||||
@@ -219,11 +220,14 @@ namespace Hosts.Views
|
||||
{
|
||||
// Based on the template from dev/CommonStyles/ContentDialog_themeresources.xaml in https://github.com/microsoft/microsoft-ui-xaml
|
||||
var border = VisualTreeUtils.FindVisualChildByName(sender as ContentDialog, "BackgroundElement") as Border;
|
||||
border.Margin = new Thickness(0, 32, 0, 0); // Should be the size reserved for the title bar as in MainWindow.xaml
|
||||
if (border is not null)
|
||||
{
|
||||
border.Margin = new Thickness(0, 32, 0, 0); // Should be the size reserved for the title bar as in MainWindow.
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Couldn't set the margin for a content dialog. It will appear on top of the title bar.", ex);
|
||||
LoggerInstance.Logger.LogError("Couldn't set the margin for a content dialog. It will appear on top of the title bar.", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
<Application
|
||||
x:Class="Hosts.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Hosts">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
|
||||
<!-- Other merged dictionaries here -->
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Default">
|
||||
<StaticResource x:Key="SubtleButtonBackground" ResourceKey="SubtleFillColorTransparent" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundPointerOver" ResourceKey="SubtleFillColorSecondary" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundPressed" ResourceKey="SubtleFillColorTertiary" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundDisabled" ResourceKey="SubtleFillColorTransparent" />
|
||||
|
||||
<StaticResource x:Key="SubtleButtonBorderBrush" ResourceKey="SubtleFillColorTransparent" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushPointerOver" ResourceKey="SubtleFillColorSecondary" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushPressed" ResourceKey="SubtleFillColorTertiary" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushDisabled" ResourceKey="SubtleFillColorTransparent" />
|
||||
|
||||
<StaticResource x:Key="SubtleButtonForeground" ResourceKey="TextFillColorPrimary" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundPointerOver" ResourceKey="TextFillColorPrimary" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundPressed" ResourceKey="TextFillColorSecondary" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundDisabled" ResourceKey="TextFillColorDisabled" />
|
||||
</ResourceDictionary>
|
||||
|
||||
<ResourceDictionary x:Key="Light">
|
||||
<StaticResource x:Key="SubtleButtonBackground" ResourceKey="SubtleFillColorTransparent" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundPointerOver" ResourceKey="SubtleFillColorSecondary" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundPressed" ResourceKey="SubtleFillColorTertiary" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundDisabled" ResourceKey="SubtleFillColorTransparent" />
|
||||
|
||||
<StaticResource x:Key="SubtleButtonBorderBrush" ResourceKey="SubtleFillColorTransparent" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushPointerOver" ResourceKey="SubtleFillColorSecondary" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushPressed" ResourceKey="SubtleFillColorTertiary" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushDisabled" ResourceKey="SubtleFillColorTransparent" />
|
||||
|
||||
<StaticResource x:Key="SubtleButtonForeground" ResourceKey="TextFillColorPrimary" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundPointerOver" ResourceKey="TextFillColorPrimary" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundPressed" ResourceKey="TextFillColorSecondary" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundDisabled" ResourceKey="TextFillColorDisabled" />
|
||||
</ResourceDictionary>
|
||||
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
<StaticResource x:Key="SubtleButtonBackground" ResourceKey="SystemColorWindowColorBrush" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundPointerOver" ResourceKey="SystemColorHighlightTextColorBrush" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundPressed" ResourceKey="SystemColorWindowColorBrush" />
|
||||
<StaticResource x:Key="SubtleButtonBackgroundDisabled" ResourceKey="SystemControlBackgroundBaseLowBrush" />
|
||||
|
||||
<StaticResource x:Key="SubtleButtonBorderBrush" ResourceKey="SystemColorWindowColorBrush" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushPointerOver" ResourceKey="SystemColorHighlightColorBrush" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushPressed" ResourceKey="SystemColorHighlightColorBrush" />
|
||||
<StaticResource x:Key="SubtleButtonBorderBrushDisabled" ResourceKey="SystemColorGrayTextColor" />
|
||||
|
||||
<StaticResource x:Key="SubtleButtonForeground" ResourceKey="SystemColorButtonTextColorBrush" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundPointerOver" ResourceKey="SystemControlHighlightBaseHighBrush" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundPressed" ResourceKey="SystemControlHighlightBaseHighBrush" />
|
||||
<StaticResource x:Key="SubtleButtonForegroundDisabled" ResourceKey="SystemControlDisabledBaseMediumLowBrush" />
|
||||
</ResourceDictionary>
|
||||
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
|
||||
<Style x:Key="SubtleButtonStyle" TargetType="Button">
|
||||
<Setter Property="Background" Value="{ThemeResource SubtleButtonBackground}" />
|
||||
<Setter Property="BackgroundSizing" Value="InnerBorderEdge" />
|
||||
<Setter Property="Foreground" Value="{ThemeResource SubtleButtonForeground}" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource SubtleButtonBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}" />
|
||||
<Setter Property="Padding" Value="{StaticResource ButtonPadding}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
|
||||
<Setter Property="FontWeight" Value="Normal" />
|
||||
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
|
||||
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
|
||||
<Setter Property="FocusVisualMargin" Value="-3" />
|
||||
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<ContentPresenter
|
||||
x:Name="ContentPresenter"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
AnimatedIcon.State="Normal"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Background="{TemplateBinding Background}"
|
||||
BackgroundSizing="{TemplateBinding BackgroundSizing}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
ContentTransitions="{TemplateBinding ContentTransitions}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
Foreground="{TemplateBinding Foreground}">
|
||||
<ContentPresenter.BackgroundTransition>
|
||||
<BrushTransition Duration="0:0:0.083" />
|
||||
</ContentPresenter.BackgroundTransition>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="PointerOver">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonBackgroundPointerOver}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonBorderBrushPointerOver}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonForegroundPointerOver}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="ContentPresenter.(AnimatedIcon.State)" Value="PointerOver" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Pressed">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonBackgroundPressed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonBorderBrushPressed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonForegroundPressed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
<VisualState.Setters>
|
||||
<Setter Target="ContentPresenter.(AnimatedIcon.State)" Value="Pressed" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Disabled">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonBackgroundDisabled}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonBorderBrushDisabled}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SubtleButtonForegroundDisabled}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
<VisualState.Setters>
|
||||
<!-- DisabledVisual Should be handled by the control, not the animated icon. -->
|
||||
<Setter Target="ContentPresenter.(AnimatedIcon.State)" Value="Normal" />
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</ContentPresenter>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
Before Width: | Height: | Size: 567 B After Width: | Height: | Size: 567 B |
|
Before Width: | Height: | Size: 768 B After Width: | Height: | Size: 768 B |
|
Before Width: | Height: | Size: 1001 B After Width: | Height: | Size: 1001 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 174 KiB After Width: | Height: | Size: 174 KiB |
@@ -2,12 +2,11 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Peek.Common.Models;
|
||||
|
||||
namespace Peek.FilePreviewer.Previewers.Interfaces
|
||||
namespace Hosts.Settings
|
||||
{
|
||||
public interface IPreviewTarget
|
||||
public enum HostsAdditionalLinesPosition
|
||||
{
|
||||
static abstract bool IsItemSupported(IFileSystemItem item);
|
||||
Top = 0,
|
||||
Bottom = 1,
|
||||
}
|
||||
}
|
||||
12
src/modules/Hosts/Hosts/Settings/HostsEncoding.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
// 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.
|
||||
|
||||
namespace Hosts.Settings
|
||||
{
|
||||
public enum HostsEncoding
|
||||
{
|
||||
Utf8 = 0,
|
||||
Utf8Bom = 1,
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using Settings.UI.Library.Enumerations;
|
||||
using System.Net;
|
||||
|
||||
namespace Hosts.Settings
|
||||
{
|
||||
@@ -18,5 +18,7 @@ namespace Hosts.Settings
|
||||
public HostsEncoding Encoding { get; }
|
||||
|
||||
event EventHandler LoopbackDuplicatesChanged;
|
||||
|
||||
public delegate void OpenSettingsFunction();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Common.UI;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using CommunityToolkit.WinUI;
|
||||
@@ -19,8 +18,8 @@ using Hosts.Exceptions;
|
||||
using Hosts.Helpers;
|
||||
using Hosts.Models;
|
||||
using Hosts.Settings;
|
||||
using ManagedCommon;
|
||||
using Microsoft.UI.Dispatching;
|
||||
using static Hosts.Settings.IUserSettings;
|
||||
|
||||
namespace Hosts.ViewModels
|
||||
{
|
||||
@@ -90,13 +89,22 @@ namespace Hosts.ViewModels
|
||||
|
||||
public int NextId => _entries?.Count > 0 ? _entries.Max(e => e.Id) + 1 : 0;
|
||||
|
||||
public MainViewModel(IHostsService hostService, IUserSettings userSettings)
|
||||
public IUserSettings UserSettings => _userSettings;
|
||||
|
||||
public static MainViewModel Instance { get; set; }
|
||||
|
||||
private OpenSettingsFunction _openSettingsFunction;
|
||||
|
||||
public MainViewModel(IHostsService hostService, IUserSettings userSettings, ILogger logger, OpenSettingsFunction openSettingsFunction)
|
||||
{
|
||||
_hostsService = hostService;
|
||||
_userSettings = userSettings;
|
||||
|
||||
_hostsService.FileChanged += (s, e) => _dispatcherQueue.TryEnqueue(() => FileChanged = true);
|
||||
_userSettings.LoopbackDuplicatesChanged += (s, e) => ReadHosts();
|
||||
|
||||
LoggerInstance.Logger = logger;
|
||||
_openSettingsFunction = openSettingsFunction;
|
||||
}
|
||||
|
||||
public void Add(Entry entry)
|
||||
@@ -270,7 +278,7 @@ namespace Hosts.ViewModels
|
||||
[RelayCommand]
|
||||
public void OpenSettings()
|
||||
{
|
||||
SettingsDeepLink.OpenSettings(SettingsDeepLink.SettingsWindow.Hosts, true);
|
||||
_openSettingsFunction();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
@@ -335,7 +343,7 @@ namespace Hosts.ViewModels
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
Logger.LogInfo("FindDuplicates cancelled");
|
||||
LoggerInstance.Logger.LogInfo("FindDuplicates cancelled");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -424,7 +432,7 @@ namespace Hosts.ViewModels
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Failed to save hosts file", ex);
|
||||
LoggerInstance.Logger.LogError("Failed to save hosts file", ex);
|
||||
var resourceLoader = ResourceLoaderInstance.ResourceLoader;
|
||||
errorMessage = resourceLoader.GetString("FileSaveError_Generic");
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
|
||||
SHELLEXECUTEINFOW sei{ sizeof(sei) };
|
||||
sei.fMask = { SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI };
|
||||
sei.lpFile = L"WinUI3Apps\\PowerToys.Hosts.exe";
|
||||
sei.lpFile = L"WinUI3Apps\\PowerToys.HostsPackageConsumer.exe";
|
||||
sei.nShow = SW_SHOWNORMAL;
|
||||
sei.lpParameters = executable_args.data();
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 567 B |
|
After Width: | Height: | Size: 768 B |
|
After Width: | Height: | Size: 1001 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 174 KiB |
28
src/modules/Hosts/HostsPackageConsumer/Helpers/Host.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
// 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 Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace HostsPackageConsumer.Helpers
|
||||
{
|
||||
public static class Host
|
||||
{
|
||||
public static IHost HostInstance
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public static T GetService<T>()
|
||||
where T : class
|
||||
{
|
||||
if (HostInstance!.Services.GetService(typeof(T)) is not T service)
|
||||
{
|
||||
throw new ArgumentException($"{typeof(T)} needs to be registered in ConfigureServices within App.xaml.cs.");
|
||||
}
|
||||
|
||||
return service;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\..\..\Version.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
|
||||
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
|
||||
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
|
||||
<RootNamespace>HostsPackageConsumer</RootNamespace>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
|
||||
<UseWinUI>true</UseWinUI>
|
||||
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
|
||||
<WindowsPackageType>None</WindowsPackageType>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
|
||||
<OutputPath>..\..\..\..\$(Platform)\$(Configuration)\WinUI3Apps</OutputPath>
|
||||
<AssemblyName>PowerToys.HostsPackageConsumer</AssemblyName>
|
||||
<DefineConstants>DISABLE_XAML_GENERATED_MAIN,TRACE</DefineConstants>
|
||||
<SelfContained>true</SelfContained>
|
||||
<ApplicationIcon>Assets/HostsPackageConsumer/Hosts.ico</ApplicationIcon>
|
||||
<!-- MRT from windows app sdk will search for a pri file with the same name of the module before defaulting to resources.pri -->
|
||||
<ProjectPriFileName>PowerToys.HostsPackageConsumer.pri</ProjectPriFileName>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Assets\HostsPackageConsumer\AppList.scale-100.png" />
|
||||
<None Remove="Assets\HostsPackageConsumer\AppList.scale-125.png" />
|
||||
<None Remove="Assets\HostsPackageConsumer\AppList.scale-150.png" />
|
||||
<None Remove="Assets\HostsPackageConsumer\AppList.scale-200.png" />
|
||||
<None Remove="Assets\HostsPackageConsumer\AppList.scale-400.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="CopyPRIFileToOutputDir" AfterTargets="Build">
|
||||
<Message Text="Executing CopyPRIFileToOutputDir task" Importance="High" />
|
||||
|
||||
<ItemGroup>
|
||||
<PRIFile Include="$(OutDir)**\PowerToys.Hosts.pri" />
|
||||
</ItemGroup>
|
||||
|
||||
<Copy SourceFiles="@(PRIFile)" DestinationFolder="$(OutDir)" />
|
||||
|
||||
<Message Text="Copied CopyPRIFileToOutputDir files" Importance="High" />
|
||||
</Target>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Remove="HostsPackageConsumerXAML\App.xaml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="HostsPackageConsumerXAML\App.xaml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\HostsPackageConsumer\Hosts.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- SelfContained=true requires RuntimeIdentifier to be set -->
|
||||
<PropertyGroup Condition="'$(Platform)'=='x64'">
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Platform)'=='ARM64'">
|
||||
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- See https://learn.microsoft.com/windows/apps/develop/platform/csharp-winrt/net-projection-from-cppwinrt-component for more info -->
|
||||
<PropertyGroup>
|
||||
<CsWinRTIncludes>PowerToys.GPOWrapper</CsWinRTIncludes>
|
||||
<CsWinRTGeneratedFilesDir>$(OutDir)</CsWinRTGeneratedFilesDir>
|
||||
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" />
|
||||
<PackageReference Include="Microsoft.Windows.CsWinRT" />
|
||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
|
||||
<PackageReference Include="WinUIEx" />
|
||||
<Manifest Include="$(ApplicationManifest)" />
|
||||
</ItemGroup>
|
||||
|
||||
<!--
|
||||
Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
|
||||
Tools extension to be activated for this project even if the Windows App SDK Nuget
|
||||
package has not yet been restored.
|
||||
-->
|
||||
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
|
||||
<ProjectCapability Include="Msix" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\common\Common.UI\Common.UI.csproj" />
|
||||
<ProjectReference Include="..\..\..\common\GPOWrapper\GPOWrapper.vcxproj" />
|
||||
<ProjectReference Include="..\..\..\common\ManagedCommon\ManagedCommon.csproj" />
|
||||
<ProjectReference Include="..\..\..\settings-ui\Settings.UI.Library\Settings.UI.Library.csproj" />
|
||||
<ProjectReference Include="..\..\..\common\interop\PowerToys.Interop.vcxproj" />
|
||||
<ProjectReference Include="..\Hosts\Hosts.csproj" />
|
||||
</ItemGroup>
|
||||
<!--
|
||||
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
|
||||
Explorer "Package and Publish" context menu entry to be enabled for this project even if
|
||||
the Windows App SDK Nuget package has not yet been restored.
|
||||
-->
|
||||
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
|
||||
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,8 +1,9 @@
|
||||
<Application
|
||||
x:Class="RegistryPreview.App"
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Application
|
||||
x:Class="HostsPackageConsumer.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:RegistryPreview">
|
||||
xmlns:local="using:HostsPackageConsumer">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
@@ -1,48 +1,44 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.IO.Abstractions;
|
||||
using System.Threading;
|
||||
using Common.UI;
|
||||
using Hosts.Helpers;
|
||||
using Hosts.Settings;
|
||||
using Hosts.ViewModels;
|
||||
using Hosts.Views;
|
||||
using HostsPackageConsumer.Helpers;
|
||||
using ManagedCommon;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.UI.Dispatching;
|
||||
using Microsoft.UI.Xaml;
|
||||
using static Hosts.Settings.IUserSettings;
|
||||
using Host = HostsPackageConsumer.Helpers.Host;
|
||||
|
||||
namespace Hosts
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||
namespace HostsPackageConsumer
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides application-specific behavior to supplement the default Application class.
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
private Window _window;
|
||||
|
||||
public IHost Host
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public static T GetService<T>()
|
||||
where T : class
|
||||
{
|
||||
if ((App.Current as App)!.Host.Services.GetService(typeof(T)) is not T service)
|
||||
{
|
||||
throw new ArgumentException($"{typeof(T)} needs to be registered in ConfigureServices within App.xaml.cs.");
|
||||
}
|
||||
|
||||
return service;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="App"/> class.
|
||||
/// Initializes the singleton application object. This is the first line of authored code
|
||||
/// executed, and as such is the logical equivalent of main() or WinMain().
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Host = Microsoft.Extensions.Hosting.Host.
|
||||
Host.HostInstance = Microsoft.Extensions.Hosting.Host.
|
||||
CreateDefaultBuilder().
|
||||
UseContentRoot(AppContext.BaseDirectory).
|
||||
ConfigureServices((context, services) =>
|
||||
@@ -50,28 +46,33 @@ namespace Hosts
|
||||
// Core Services
|
||||
services.AddSingleton<IFileSystem, FileSystem>();
|
||||
services.AddSingleton<IHostsService, HostsService>();
|
||||
services.AddSingleton<IUserSettings, UserSettings>();
|
||||
services.AddSingleton<IUserSettings, HostsPackageConsumer.Settings.UserSettings>();
|
||||
services.AddSingleton<IElevationHelper, ElevationHelper>();
|
||||
|
||||
// Views and ViewModels
|
||||
services.AddTransient<MainPage>();
|
||||
services.AddTransient<MainViewModel>();
|
||||
services.AddSingleton<ILogger, LoggerWrapper>();
|
||||
services.AddSingleton<IElevationHelper, ElevationHelper>();
|
||||
services.AddSingleton<OpenSettingsFunction>(() =>
|
||||
{
|
||||
SettingsDeepLink.OpenSettings(SettingsDeepLink.SettingsWindow.Hosts, true);
|
||||
});
|
||||
|
||||
services.AddSingleton<MainViewModel, MainViewModel>();
|
||||
services.AddSingleton<HostsMainPage, HostsMainPage>();
|
||||
}).
|
||||
Build();
|
||||
|
||||
UnhandledException += App_UnhandledException;
|
||||
|
||||
var cleanupBackupThread = new Thread(() =>
|
||||
{
|
||||
// Delete old backups only if running elevated
|
||||
if (!GetService<IElevationHelper>().IsElevated)
|
||||
if (!Host.GetService<IElevationHelper>().IsElevated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
GetService<IHostsService>().CleanupBackup();
|
||||
Host.GetService<IHostsService>().CleanupBackup();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -81,8 +82,14 @@ namespace Hosts
|
||||
|
||||
cleanupBackupThread.IsBackground = true;
|
||||
cleanupBackupThread.Start();
|
||||
|
||||
UnhandledException += App_UnhandledException;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when the application is launched.
|
||||
/// </summary>
|
||||
/// <param name="args">Details about the launch request and process.</param>
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
||||
{
|
||||
var cmdArgs = Environment.GetCommandLineArgs();
|
||||
@@ -105,15 +112,17 @@ namespace Hosts
|
||||
Logger.LogInfo($"Hosts started detached from PowerToys Runner.");
|
||||
}
|
||||
|
||||
PowerToysTelemetry.Log.WriteEvent(new Hosts.Telemetry.HostsFileEditorOpenedEvent());
|
||||
PowerToysTelemetry.Log.WriteEvent(new Telemetry.HostsFileEditorOpenedEvent());
|
||||
|
||||
_window = new MainWindow();
|
||||
_window.Activate();
|
||||
window = new MainWindow();
|
||||
window.Activate();
|
||||
}
|
||||
|
||||
private void App_UnhandledException(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e)
|
||||
{
|
||||
Logger.LogError("Unhandled exception", e.Exception);
|
||||
}
|
||||
|
||||
private Window window;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
<winuiex:WindowEx
|
||||
x:Class="Hosts.MainWindow"
|
||||
<winuiex:WindowEx
|
||||
x:Class="HostsPackageConsumer.MainWindow"
|
||||
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:Hosts"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:views="using:Hosts.Views"
|
||||
xmlns:winuiex="using:WinUIEx"
|
||||
@@ -15,7 +14,7 @@
|
||||
<Window.SystemBackdrop>
|
||||
<MicaBackdrop />
|
||||
</Window.SystemBackdrop>
|
||||
<Grid>
|
||||
<Grid x:Name="MainGrid" Loaded="Grid_Loaded">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
@@ -35,14 +34,12 @@
|
||||
Width="16"
|
||||
Height="16"
|
||||
VerticalAlignment="Center"
|
||||
Source="../Assets/Hosts/Hosts.ico" />
|
||||
Source="../Assets/HostsPackageConsumer/Hosts.ico" />
|
||||
<TextBlock
|
||||
x:Name="AppTitleTextBlock"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource CaptionTextBlockStyle}" />
|
||||
</Grid>
|
||||
|
||||
<views:MainPage Grid.Row="1" />
|
||||
</Grid>
|
||||
</winuiex:WindowEx>
|
||||
@@ -1,34 +1,49 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// 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 Hosts.Helpers;
|
||||
using Hosts.ViewModels;
|
||||
using Hosts.Views;
|
||||
using HostsPackageConsumer.Helpers;
|
||||
using ManagedCommon;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.Windows.ApplicationModel.Resources;
|
||||
using WinUIEx;
|
||||
|
||||
namespace Hosts
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||
namespace HostsPackageConsumer
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty window that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class MainWindow : WindowEx
|
||||
{
|
||||
private HostsMainPage MainPage { get; }
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
ExtendsContentIntoTitleBar = true;
|
||||
SetTitleBar(titleBar);
|
||||
AppWindow.SetIcon("Assets/Hosts/Hosts.ico");
|
||||
AppWindow.SetIcon("Assets/HostsPackageConsumer/Hosts.ico");
|
||||
|
||||
var loader = ResourceLoaderInstance.ResourceLoader;
|
||||
var title = App.GetService<IElevationHelper>().IsElevated ? loader.GetString("WindowAdminTitle") : loader.GetString("WindowTitle");
|
||||
var loader = new ResourceLoader("PowerToys.Hosts.pri", "PowerToys.Hosts/Resources");
|
||||
|
||||
var title = Host.GetService<IElevationHelper>().IsElevated ? loader.GetString("WindowAdminTitle") : loader.GetString("WindowTitle");
|
||||
Title = title;
|
||||
AppTitleTextBlock.Text = title;
|
||||
|
||||
var handle = this.GetWindowHandle();
|
||||
WindowHelpers.BringToForeground(handle);
|
||||
|
||||
WindowHelpers.BringToForeground(handle);
|
||||
Activated += MainWindow_Activated;
|
||||
|
||||
MainPage = Host.GetService<HostsMainPage>();
|
||||
}
|
||||
|
||||
private void MainWindow_Activated(object sender, WindowActivatedEventArgs args)
|
||||
@@ -42,5 +57,11 @@ namespace Hosts
|
||||
AppTitleTextBlock.Foreground = (SolidColorBrush)App.Current.Resources["WindowCaptionForeground"];
|
||||
}
|
||||
}
|
||||
|
||||
private void Grid_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MainGrid.Children.Add(MainPage);
|
||||
Grid.SetRow(MainPage, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
43
src/modules/Hosts/HostsPackageConsumer/LoggerWrapper.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
// 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 Hosts.Helpers;
|
||||
using ManagedCommon;
|
||||
|
||||
namespace HostsPackageConsumer
|
||||
{
|
||||
internal sealed class LoggerWrapper : ILogger
|
||||
{
|
||||
public void LogDebug(string message)
|
||||
{
|
||||
Logger.LogDebug(message);
|
||||
}
|
||||
|
||||
public void LogError(string message)
|
||||
{
|
||||
Logger.LogError(message);
|
||||
}
|
||||
|
||||
public void LogError(string message, Exception ex)
|
||||
{
|
||||
Logger.LogError(message, ex);
|
||||
}
|
||||
|
||||
public void LogInfo(string message)
|
||||
{
|
||||
Logger.LogInfo(message);
|
||||
}
|
||||
|
||||
public void LogTrace()
|
||||
{
|
||||
Logger.LogTrace();
|
||||
}
|
||||
|
||||
public void LogWarning(string message)
|
||||
{
|
||||
Logger.LogWarning(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ using ManagedCommon;
|
||||
using Microsoft.UI.Dispatching;
|
||||
using Microsoft.Windows.AppLifecycle;
|
||||
|
||||
namespace Hosts
|
||||
namespace HostsPackageConsumer
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
@@ -16,7 +16,6 @@ namespace Hosts
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Logger.InitializeLogger("\\Hosts\\Logs");
|
||||
|
||||
WinRT.ComWrappersSupport.InitializeComWrappers();
|
||||
|
||||
if (PowerToys.GPOWrapper.GPOWrapper.GetConfiguredHostsFileEditorEnabledValue() == PowerToys.GPOWrapper.GpoRuleConfigured.Disabled)
|
||||
@@ -25,7 +24,7 @@ namespace Hosts
|
||||
return;
|
||||
}
|
||||
|
||||
var instanceKey = AppInstance.FindOrRegisterForKey("PowerToys_Hosts_Instance");
|
||||
var instanceKey = AppInstance.FindOrRegisterForKey("PowerToys_HostsPackageConsumer_Instance");
|
||||
|
||||
if (instanceKey.IsCurrent)
|
||||
{
|
||||
@@ -5,12 +5,13 @@
|
||||
using System;
|
||||
using System.IO.Abstractions;
|
||||
using System.Threading;
|
||||
using Hosts.Helpers;
|
||||
using Hosts.Settings;
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Settings.UI.Library.Enumerations;
|
||||
|
||||
namespace Hosts.Settings
|
||||
namespace HostsPackageConsumer.Settings
|
||||
{
|
||||
public class UserSettings : IUserSettings
|
||||
{
|
||||
@@ -38,8 +39,10 @@ namespace Hosts.Settings
|
||||
}
|
||||
}
|
||||
|
||||
// Moved from Settings.UI.Library
|
||||
public HostsAdditionalLinesPosition AdditionalLinesPosition { get; private set; }
|
||||
|
||||
// Moved from Settings.UI.Library
|
||||
public HostsEncoding Encoding { get; set; }
|
||||
|
||||
public UserSettings()
|
||||
@@ -72,6 +75,7 @@ namespace Hosts.Settings
|
||||
|
||||
if (!_settingsUtils.SettingsExists(HostsModuleName))
|
||||
{
|
||||
// Logger needs to be abstracted
|
||||
Logger.LogInfo("Hosts settings.json was missing, creating a new one");
|
||||
var defaultSettings = new HostsSettings();
|
||||
defaultSettings.Save(_settingsUtils);
|
||||
@@ -81,8 +85,8 @@ namespace Hosts.Settings
|
||||
if (settings != null)
|
||||
{
|
||||
ShowStartupWarning = settings.Properties.ShowStartupWarning;
|
||||
AdditionalLinesPosition = settings.Properties.AdditionalLinesPosition;
|
||||
Encoding = settings.Properties.Encoding;
|
||||
AdditionalLinesPosition = (HostsAdditionalLinesPosition)settings.Properties.AdditionalLinesPosition;
|
||||
Encoding = (HostsEncoding)settings.Properties.Encoding;
|
||||
LoopbackDuplicates = settings.Properties.LoopbackDuplicates;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Diagnostics.Tracing;
|
||||
using Microsoft.PowerToys.Telemetry;
|
||||
using Microsoft.PowerToys.Telemetry.Events;
|
||||
|
||||
namespace Hosts.Telemetry
|
||||
namespace HostsPackageConsumer.Telemetry
|
||||
{
|
||||
[EventData]
|
||||
public class HostsFileEditorOpenedEvent : EventBase, IEvent
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="Hosts.app"/>
|
||||
<assembly manifestVersion="1.0"
|
||||
xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="HostsPackageConsumer.app"/>
|
||||
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
@@ -18,4 +19,4 @@
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
</assembly>
|
||||
@@ -26,7 +26,6 @@ using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
// 2023- Included in PowerToys.
|
||||
// </history>
|
||||
using Microsoft.Win32;
|
||||
using Settings.UI.Library.Attributes;
|
||||
|
||||
[module: SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Scope = "member", Target = "MouseWithoutBorders.Properties.Setting.Values.#LoadIntSetting(System.String,System.Int32)", Justification = "Dotnet port with style preservation")]
|
||||
[module: SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Scope = "member", Target = "MouseWithoutBorders.Properties.Setting.Values.#SaveSetting(System.String,System.Object)", Justification = "Dotnet port with style preservation")]
|
||||
@@ -767,7 +766,6 @@ namespace MouseWithoutBorders.Class
|
||||
}
|
||||
}
|
||||
|
||||
[CmdConfigureIgnore]
|
||||
internal bool DrawMouseEx
|
||||
{
|
||||
get
|
||||
|
||||
@@ -47,17 +47,51 @@ internal sealed class ImageMethods
|
||||
return destination;
|
||||
}
|
||||
|
||||
internal static ImageSource GetWindowBoundsImage(OCROverlay passedWindow)
|
||||
internal static ImageSource GetWindowBoundsImage(Window passedWindow)
|
||||
{
|
||||
Rectangle screenRectangle = passedWindow.GetScreenRectangle();
|
||||
using Bitmap bmp = new(screenRectangle.Width, screenRectangle.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
DpiScale dpi = VisualTreeHelper.GetDpi(passedWindow);
|
||||
int windowWidth = (int)(passedWindow.ActualWidth * dpi.DpiScaleX);
|
||||
int windowHeight = (int)(passedWindow.ActualHeight * dpi.DpiScaleY);
|
||||
|
||||
System.Windows.Point absPosPoint = passedWindow.GetAbsolutePosition();
|
||||
int thisCorrectedLeft = (int)absPosPoint.X;
|
||||
int thisCorrectedTop = (int)absPosPoint.Y;
|
||||
|
||||
using Bitmap bmp = new(windowWidth, windowHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
using Graphics g = Graphics.FromImage(bmp);
|
||||
|
||||
g.CopyFromScreen(screenRectangle.Left, screenRectangle.Top, 0, 0, bmp.Size, CopyPixelOperation.SourceCopy);
|
||||
g.CopyFromScreen(thisCorrectedLeft, thisCorrectedTop, 0, 0, bmp.Size, CopyPixelOperation.SourceCopy);
|
||||
return BitmapToImageSource(bmp);
|
||||
}
|
||||
|
||||
internal static Bitmap GetRegionAsBitmap(OCROverlay passedWindow, Rectangle selectedRegion)
|
||||
internal static Bitmap GetWindowBoundsBitmap(Window passedWindow)
|
||||
{
|
||||
DpiScale dpi = VisualTreeHelper.GetDpi(passedWindow);
|
||||
int windowWidth = (int)(passedWindow.ActualWidth * dpi.DpiScaleX);
|
||||
int windowHeight = (int)(passedWindow.ActualHeight * dpi.DpiScaleY);
|
||||
|
||||
System.Windows.Point absPosPoint = passedWindow.GetAbsolutePosition();
|
||||
int thisCorrectedLeft = (int)absPosPoint.X;
|
||||
int thisCorrectedTop = (int)absPosPoint.Y;
|
||||
|
||||
Bitmap bmp = new(
|
||||
windowWidth,
|
||||
windowHeight,
|
||||
System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
using Graphics g = Graphics.FromImage(bmp);
|
||||
|
||||
g.CopyFromScreen(
|
||||
thisCorrectedLeft,
|
||||
thisCorrectedTop,
|
||||
0,
|
||||
0,
|
||||
bmp.Size,
|
||||
CopyPixelOperation.SourceCopy);
|
||||
|
||||
return bmp;
|
||||
}
|
||||
|
||||
internal static Bitmap GetRegionAsBitmap(Window passedWindow, Rectangle selectedRegion)
|
||||
{
|
||||
Bitmap bmp = new(
|
||||
selectedRegion.Width,
|
||||
@@ -65,11 +99,15 @@ internal sealed class ImageMethods
|
||||
System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
|
||||
using Graphics g = Graphics.FromImage(bmp);
|
||||
Rectangle screenRectangle = passedWindow.GetScreenRectangle();
|
||||
|
||||
System.Windows.Point absPosPoint = passedWindow.GetAbsolutePosition();
|
||||
|
||||
int thisCorrectedLeft = (int)absPosPoint.X + selectedRegion.Left;
|
||||
int thisCorrectedTop = (int)absPosPoint.Y + selectedRegion.Top;
|
||||
|
||||
g.CopyFromScreen(
|
||||
screenRectangle.Left + selectedRegion.Left,
|
||||
screenRectangle.Top + selectedRegion.Top,
|
||||
thisCorrectedLeft,
|
||||
thisCorrectedTop,
|
||||
0,
|
||||
0,
|
||||
bmp.Size,
|
||||
@@ -79,7 +117,7 @@ internal sealed class ImageMethods
|
||||
return bmp;
|
||||
}
|
||||
|
||||
internal static async Task<string> GetRegionsText(OCROverlay? passedWindow, Rectangle selectedRegion, Language? preferredLanguage)
|
||||
internal static async Task<string> GetRegionsText(Window? passedWindow, Rectangle selectedRegion, Language? preferredLanguage)
|
||||
{
|
||||
if (passedWindow is null)
|
||||
{
|
||||
@@ -92,15 +130,17 @@ internal sealed class ImageMethods
|
||||
return resultText != null ? resultText.Trim() : string.Empty;
|
||||
}
|
||||
|
||||
internal static async Task<string> GetClickedWord(OCROverlay passedWindow, System.Windows.Point clickedPoint, Language? preferredLanguage)
|
||||
internal static async Task<string> GetClickedWord(Window passedWindow, System.Windows.Point clickedPoint, Language? preferredLanguage)
|
||||
{
|
||||
Rectangle screenRectangle = passedWindow.GetScreenRectangle();
|
||||
Bitmap bmp = new((int)screenRectangle.Width, (int)passedWindow.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
DpiScale dpi = VisualTreeHelper.GetDpi(passedWindow);
|
||||
Bitmap bmp = new((int)(passedWindow.ActualWidth * dpi.DpiScaleX), (int)(passedWindow.ActualHeight * dpi.DpiScaleY), System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
Graphics g = Graphics.FromImage(bmp);
|
||||
|
||||
System.Windows.Point absPosPoint = passedWindow.GetAbsolutePosition();
|
||||
int thisCorrectedLeft = (int)absPosPoint.X;
|
||||
int thisCorrectedTop = (int)absPosPoint.Y;
|
||||
|
||||
g.CopyFromScreen((int)absPosPoint.X, (int)absPosPoint.Y, 0, 0, bmp.Size, CopyPixelOperation.SourceCopy);
|
||||
g.CopyFromScreen(thisCorrectedLeft, thisCorrectedTop, 0, 0, bmp.Size, CopyPixelOperation.SourceCopy);
|
||||
|
||||
System.Windows.Point adjustedPoint = new(clickedPoint.X, clickedPoint.Y);
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace PowerOCR.Helpers
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<string> GetRegionsTextAsTableAsync(OCROverlay passedWindow, Rectangle regionScaled, Language? language)
|
||||
public static async Task<string> GetRegionsTextAsTableAsync(Window passedWindow, Rectangle regionScaled, Language? language)
|
||||
{
|
||||
if (language is null)
|
||||
{
|
||||
|
||||
@@ -37,28 +37,4 @@ public static class WPFExtensionMethods
|
||||
|
||||
return new Point(r.X, r.Y);
|
||||
}
|
||||
|
||||
public static DpiScale GetDpi(this System.Windows.Forms.Screen screen)
|
||||
{
|
||||
var point = new System.Drawing.Point(screen.Bounds.Left + 1, screen.Bounds.Top + 1);
|
||||
var mon = MonitorFromPoint(point, 2/*MONITOR_DEFAULTTONEAREST*/);
|
||||
GetDpiForMonitor(mon, DpiType.Effective, out uint dpiX, out uint dpiY);
|
||||
return new DpiScale(dpiX / 96.0, dpiY / 96.0);
|
||||
}
|
||||
|
||||
// https://msdn.microsoft.com/library/windows/desktop/dd145062(v=vs.85).aspx
|
||||
[DllImport("User32.dll")]
|
||||
private static extern IntPtr MonitorFromPoint([In] System.Drawing.Point pt, [In] uint dwFlags);
|
||||
|
||||
// https://msdn.microsoft.com/library/windows/desktop/dn280510(v=vs.85).aspx
|
||||
[DllImport("Shcore.dll")]
|
||||
private static extern IntPtr GetDpiForMonitor([In] IntPtr hmonitor, [In] DpiType dpiType, [Out] out uint dpiX, [Out] out uint dpiY);
|
||||
|
||||
// https://msdn.microsoft.com/library/windows/desktop/dn280511(v=vs.85).aspx
|
||||
public enum DpiType
|
||||
{
|
||||
Effective = 0,
|
||||
Angular = 1,
|
||||
Raw = 2,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,8 @@ public static class WindowUtilities
|
||||
Logger.LogInfo($"Adding Overlays for each screen");
|
||||
foreach (Screen screen in Screen.AllScreens)
|
||||
{
|
||||
DpiScale dpiScale = screen.GetDpi();
|
||||
Logger.LogInfo($"screen {screen}, dpiScale {dpiScale.DpiScaleX}, {dpiScale.DpiScaleY}");
|
||||
OCROverlay overlay = new(screen.Bounds, dpiScale);
|
||||
Logger.LogInfo($"screen {screen}");
|
||||
OCROverlay overlay = new(screen.Bounds);
|
||||
|
||||
overlay.Show();
|
||||
ActivateWindow(overlay);
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
xmlns:p="clr-namespace:PowerOCR.Properties"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="TextExtractor"
|
||||
Width="200"
|
||||
Height="200"
|
||||
ui:Design.Background="Transparent"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent"
|
||||
|
||||
@@ -5,12 +5,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using Common.UI;
|
||||
using ManagedCommon;
|
||||
@@ -44,21 +42,11 @@ public partial class OCROverlay : Window
|
||||
private bool isComboBoxReady;
|
||||
private const double ActiveOpacity = 0.4;
|
||||
private readonly UserSettings userSettings = new(new ThrottledActionInvoker());
|
||||
private System.Drawing.Rectangle screenRectangle;
|
||||
private DpiScale dpiScale;
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
private static extern bool MoveWindow(IntPtr hWnd, int x, int y, int nWidth, int nHeight, bool bRepaint);
|
||||
|
||||
public OCROverlay(System.Drawing.Rectangle screenRectangleParam, DpiScale dpiScaleParam)
|
||||
public OCROverlay(System.Drawing.Rectangle screenRectangle)
|
||||
{
|
||||
screenRectangle = screenRectangleParam;
|
||||
dpiScale = dpiScaleParam;
|
||||
|
||||
Left = screenRectangle.Left;
|
||||
Top = screenRectangle.Top;
|
||||
Width = screenRectangle.Width / dpiScale.DpiScaleX;
|
||||
Height = screenRectangle.Height / dpiScale.DpiScaleY;
|
||||
Left = screenRectangle.Left >= 0 ? screenRectangle.Left : screenRectangle.Left + (screenRectangle.Width / 2);
|
||||
Top = screenRectangle.Top >= 0 ? screenRectangle.Top : screenRectangle.Top + (screenRectangle.Height / 2);
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
@@ -118,6 +106,7 @@ public partial class OCROverlay : Window
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
WindowState = WindowState.Maximized;
|
||||
FullWindow.Rect = new Rect(0, 0, Width, Height);
|
||||
KeyDown += MainWindow_KeyDown;
|
||||
KeyUp += MainWindow_KeyUp;
|
||||
@@ -130,12 +119,6 @@ public partial class OCROverlay : Window
|
||||
#if DEBUG
|
||||
Topmost = false;
|
||||
#endif
|
||||
IntPtr hwnd = new WindowInteropHelper(this).Handle;
|
||||
|
||||
// The first move puts it on the correct monitor, which triggers WM_DPICHANGED
|
||||
// The +1/-1 coerces WPF to update Window.Top/Left/Width/Height in the second move
|
||||
MoveWindow(hwnd, (int)(screenRectangle.Left + 1), (int)screenRectangle.Top, (int)(screenRectangle.Width - 1), (int)screenRectangle.Height, false);
|
||||
MoveWindow(hwnd, (int)screenRectangle.Left, (int)screenRectangle.Top, (int)screenRectangle.Width, (int)screenRectangle.Height, true);
|
||||
}
|
||||
|
||||
private void Window_Unloaded(object sender, RoutedEventArgs e)
|
||||
@@ -493,9 +476,4 @@ public partial class OCROverlay : Window
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public System.Drawing.Rectangle GetScreenRectangle()
|
||||
{
|
||||
return screenRectangle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,12 +47,6 @@
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
|
||||
PerMonitor
|
||||
</dpiAwareness>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 178 KiB After Width: | Height: | Size: 178 KiB |
|
Before Width: | Height: | Size: 179 KiB After Width: | Height: | Size: 179 KiB |
@@ -1,4 +1,4 @@
|
||||
<Window
|
||||
<ui:FluentWindow
|
||||
x:Class="ColorPicker.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
@@ -6,19 +6,21 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:e="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Width="120"
|
||||
Height="64"
|
||||
MinWidth="0"
|
||||
MinHeight="0"
|
||||
AllowsTransparency="True"
|
||||
AutomationProperties.Name="Color Picker"
|
||||
Background="Transparent"
|
||||
ExtendsContentIntoTitleBar="True"
|
||||
Opacity="0.1"
|
||||
ResizeMode="NoResize"
|
||||
ShowInTaskbar="False"
|
||||
SizeToContent="WidthAndHeight"
|
||||
SourceInitialized="MainWindowSourceInitialized"
|
||||
Topmost="True"
|
||||
WindowCornerPreference="Default"
|
||||
WindowStyle="None"
|
||||
mc:Ignorable="d">
|
||||
<e:Interaction.Behaviors>
|
||||
@@ -26,4 +28,4 @@
|
||||
<behaviors:AppearAnimationBehavior />
|
||||
</e:Interaction.Behaviors>
|
||||
<ContentControl x:Name="MainView" Content="{Binding MainViewModel}" />
|
||||
</Window>
|
||||
</ui:FluentWindow>
|
||||
|
||||