mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-18 21:48:12 +08:00
Merge remote-tracking branch 'origin/main' into dev/snickler/net8-upgrade
This commit is contained in:
commit
09f15f3c4a
@ -7,6 +7,12 @@
|
|||||||
"commands": [
|
"commands": [
|
||||||
"dotnet-consolidate"
|
"dotnet-consolidate"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"xamlstyler.console": {
|
||||||
|
"version": "3.2206.4",
|
||||||
|
"commands": [
|
||||||
|
"xstyler"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
3
.github/actions/spell-check/allow/allow.txt
vendored
3
.github/actions/spell-check/allow/allow.txt
vendored
@ -1,8 +1,11 @@
|
|||||||
|
cloudai
|
||||||
bkmeneguello
|
bkmeneguello
|
||||||
FWest
|
FWest
|
||||||
|
gdnbaselines
|
||||||
github
|
github
|
||||||
https
|
https
|
||||||
obairka
|
obairka
|
||||||
|
sdl
|
||||||
ssh
|
ssh
|
||||||
ubuntu
|
ubuntu
|
||||||
unuing
|
unuing
|
||||||
|
15
.github/actions/spell-check/expect.txt
vendored
15
.github/actions/spell-check/expect.txt
vendored
@ -1079,7 +1079,7 @@ mic
|
|||||||
microsoft
|
microsoft
|
||||||
MIDDLEDOWN
|
MIDDLEDOWN
|
||||||
MIDDLEUP
|
MIDDLEUP
|
||||||
Midl
|
midl
|
||||||
mii
|
mii
|
||||||
MIIM
|
MIIM
|
||||||
millis
|
millis
|
||||||
@ -1369,7 +1369,6 @@ pef
|
|||||||
PElems
|
PElems
|
||||||
Pels
|
Pels
|
||||||
PERCEIVEDFLAG
|
PERCEIVEDFLAG
|
||||||
Percision
|
|
||||||
perfmon
|
perfmon
|
||||||
pesi
|
pesi
|
||||||
petabyte
|
petabyte
|
||||||
@ -1430,6 +1429,7 @@ ppsi
|
|||||||
ppsid
|
ppsid
|
||||||
ppsrm
|
ppsrm
|
||||||
ppsrree
|
ppsrree
|
||||||
|
ppstm
|
||||||
ppsz
|
ppsz
|
||||||
pptal
|
pptal
|
||||||
ppv
|
ppv
|
||||||
@ -1472,6 +1472,8 @@ psfi
|
|||||||
Psr
|
Psr
|
||||||
psrm
|
psrm
|
||||||
psrree
|
psrree
|
||||||
|
pstatstg
|
||||||
|
pstm
|
||||||
pstr
|
pstr
|
||||||
pstream
|
pstream
|
||||||
pstrm
|
pstrm
|
||||||
@ -1677,7 +1679,6 @@ Sekan
|
|||||||
SENDCHANGE
|
SENDCHANGE
|
||||||
sendinput
|
sendinput
|
||||||
sendvirtualinput
|
sendvirtualinput
|
||||||
Seperate
|
|
||||||
Seraphima
|
Seraphima
|
||||||
serverside
|
serverside
|
||||||
SETCONTEXT
|
SETCONTEXT
|
||||||
@ -1782,7 +1783,6 @@ spam
|
|||||||
spdisp
|
spdisp
|
||||||
spdlog
|
spdlog
|
||||||
spdo
|
spdo
|
||||||
spec'ing
|
|
||||||
spesi
|
spesi
|
||||||
splitwstring
|
splitwstring
|
||||||
spsi
|
spsi
|
||||||
@ -1826,6 +1826,7 @@ STDMETHODCALLTYPE
|
|||||||
STDMETHODIMP
|
STDMETHODIMP
|
||||||
stefan
|
stefan
|
||||||
Stereolithography
|
Stereolithography
|
||||||
|
STGC
|
||||||
STGM
|
STGM
|
||||||
STGMEDIUM
|
STGMEDIUM
|
||||||
sticpl
|
sticpl
|
||||||
@ -1836,7 +1837,6 @@ stringtable
|
|||||||
stringval
|
stringval
|
||||||
Strm
|
Strm
|
||||||
Strmiids
|
Strmiids
|
||||||
Stroe
|
|
||||||
Strret
|
Strret
|
||||||
strsafe
|
strsafe
|
||||||
strutil
|
strutil
|
||||||
@ -2083,6 +2083,7 @@ vscdb
|
|||||||
vsconfig
|
vsconfig
|
||||||
VSCROLL
|
VSCROLL
|
||||||
vsetq
|
vsetq
|
||||||
|
VSM
|
||||||
vsonline
|
vsonline
|
||||||
vstemplate
|
vstemplate
|
||||||
VSTHRD
|
VSTHRD
|
||||||
@ -2191,6 +2192,7 @@ wnd
|
|||||||
WNDCLASS
|
WNDCLASS
|
||||||
WNDCLASSEX
|
WNDCLASSEX
|
||||||
WNDCLASSEXW
|
WNDCLASSEXW
|
||||||
|
WNDCLASSW
|
||||||
WNDPROC
|
WNDPROC
|
||||||
wordpad
|
wordpad
|
||||||
workaround
|
workaround
|
||||||
@ -2229,6 +2231,8 @@ Wubi
|
|||||||
WVC
|
WVC
|
||||||
Wwan
|
Wwan
|
||||||
Wwanpp
|
Wwanpp
|
||||||
|
xamlstyler
|
||||||
|
Xavalon
|
||||||
XAxis
|
XAxis
|
||||||
xbf
|
xbf
|
||||||
Xbox
|
Xbox
|
||||||
@ -2249,6 +2253,7 @@ XPels
|
|||||||
XPixel
|
XPixel
|
||||||
XResource
|
XResource
|
||||||
xsi
|
xsi
|
||||||
|
xstyler
|
||||||
XStr
|
XStr
|
||||||
XUP
|
XUP
|
||||||
XVIRTUALSCREEN
|
XVIRTUALSCREEN
|
||||||
|
128
.pipelines/applyXamlStyling.ps1
Normal file
128
.pipelines/applyXamlStyling.ps1
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Modify XAML files to adhere to XAML Styler settings.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
The Apply XAML Stying Script can be used to check or modify XAML files with the repo's XAML Styler settings.
|
||||||
|
Learn more about XAML Styler at https://github.com/Xavalon/XamlStyler
|
||||||
|
|
||||||
|
By default, uses git status to check all new or modified files.
|
||||||
|
|
||||||
|
Use "PS> Help .\applyXamlStyling.ps1 -Full" for more details on parameters.
|
||||||
|
|
||||||
|
.PARAMETER LastCommit
|
||||||
|
Runs against last commit vs. current changes
|
||||||
|
|
||||||
|
.PARAMETER Unstaged
|
||||||
|
Runs against unstaged changed files
|
||||||
|
|
||||||
|
.PARAMETER Staged
|
||||||
|
Runs against staged files vs. current changes
|
||||||
|
|
||||||
|
.PARAMETER Main
|
||||||
|
Runs against main vs. current branch
|
||||||
|
|
||||||
|
.PARAMETER Passive
|
||||||
|
Runs a passive check against all files in the repo for the CI
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
PS> .\applyXamlStyling.ps1 -Main
|
||||||
|
#>
|
||||||
|
param(
|
||||||
|
[switch]$LastCommit = $false,
|
||||||
|
[switch]$Unstaged = $false,
|
||||||
|
[switch]$Staged = $false,
|
||||||
|
[switch]$Main = $false,
|
||||||
|
[switch]$Passive = $false
|
||||||
|
)
|
||||||
|
|
||||||
|
Write-Output "Use 'Help .\applyXamlStyling.ps1' for more info or '-Main' to run against all files."
|
||||||
|
Write-Output ""
|
||||||
|
Write-Output "Restoring dotnet tools..."
|
||||||
|
dotnet tool restore
|
||||||
|
|
||||||
|
if (-not $Passive)
|
||||||
|
{
|
||||||
|
# Look for unstaged changed files by default
|
||||||
|
$gitDiffCommand = "git status -s --porcelain"
|
||||||
|
|
||||||
|
if ($Main)
|
||||||
|
{
|
||||||
|
Write-Output 'Checking Current Branch against `main` Files Only'
|
||||||
|
$branch = git status | Select-String -Pattern "On branch (?<branch>.*)$"
|
||||||
|
if ($null -eq $branch.Matches)
|
||||||
|
{
|
||||||
|
$branch = git status | Select-String -Pattern "HEAD detached at (?<branch>.*)$"
|
||||||
|
if ($null -eq $branch.Matches)
|
||||||
|
{
|
||||||
|
Write-Error 'Don''t know how to fetch branch from `git status`:'
|
||||||
|
git status | Write-Error
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$branch = $branch.Matches.groups[1].Value
|
||||||
|
$gitDiffCommand = "git diff origin/main $branch --name-only --diff-filter=ACM"
|
||||||
|
}
|
||||||
|
elseif ($Unstaged)
|
||||||
|
{
|
||||||
|
# Look for unstaged files
|
||||||
|
Write-Output "Checking Unstaged Files"
|
||||||
|
$gitDiffCommand = "git diff --name-only --diff-filter=ACM"
|
||||||
|
}
|
||||||
|
elseif ($Staged)
|
||||||
|
{
|
||||||
|
# Look for staged files
|
||||||
|
Write-Output "Checking Staged Files Only"
|
||||||
|
$gitDiffCommand = "git diff --cached --name-only --diff-filter=ACM"
|
||||||
|
}
|
||||||
|
elseif ($LastCommit)
|
||||||
|
{
|
||||||
|
# Look at last commit files
|
||||||
|
Write-Output "Checking the Last Commit's Files Only"
|
||||||
|
$gitDiffCommand = "git diff HEAD^ HEAD --name-only --diff-filter=ACM"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-Output "Checking Git Status Files Only"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Output "Running Git Diff: $gitDiffCommand"
|
||||||
|
$files = Invoke-Expression $gitDiffCommand | Select-String -Pattern "\.xaml$"
|
||||||
|
|
||||||
|
if (-not $Passive -and -not $Main -and -not $Unstaged -and -not $Staged -and -not $LastCommit)
|
||||||
|
{
|
||||||
|
# Remove 'status' column of 3 characters at beginning of lines
|
||||||
|
$files = $files | ForEach-Object { $_.ToString().Substring(3) }
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($files.count -gt 0)
|
||||||
|
{
|
||||||
|
dotnet tool run xstyler -c "$PSScriptRoot\..\Settings.XamlStyler" -f $files
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-Output "No XAML Files found to style..."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-Output "Checking all files (passively)"
|
||||||
|
$files = Get-ChildItem -Path "$PSScriptRoot\..\src\*.xaml" -Recurse | Select-Object -ExpandProperty FullName | Where-Object { $_ -notmatch "(\\obj\\)|(\\bin\\)|(\\x64\\)|(\\launcher\\PowerLauncher\\)|(\\launcher\\Wox.Plugin\\)|(\\colorPicker\\ColorPickerUI\\)|(\\editor\\FancyZonesEditor\\)|(\\settings-ui\\Settings.UI\\)" }
|
||||||
|
|
||||||
|
if ($files.count -gt 0)
|
||||||
|
{
|
||||||
|
dotnet tool run xstyler -p -c "$PSScriptRoot\..\Settings.XamlStyler" -f $files
|
||||||
|
|
||||||
|
if ($lastExitCode -eq 1)
|
||||||
|
{
|
||||||
|
Write-Error 'XAML Styling is incorrect, please run `.\.pipelines\applyXamlStyling.ps1 -Main` locally.'
|
||||||
|
}
|
||||||
|
|
||||||
|
# Return XAML Styler Status
|
||||||
|
exit $lastExitCode
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
}
|
@ -8,7 +8,14 @@ steps:
|
|||||||
clean: true
|
clean: true
|
||||||
|
|
||||||
- task: PowerShell@2
|
- task: PowerShell@2
|
||||||
displayName: Verifying Nuget package versions for PowerToys.sln
|
displayName: Verify XAML formatting
|
||||||
|
inputs:
|
||||||
|
filePath: '$(build.sourcesdirectory)\.pipelines\applyXamlStyling.ps1'
|
||||||
|
arguments: -Passive
|
||||||
|
pwsh: true
|
||||||
|
|
||||||
|
- task: PowerShell@2
|
||||||
|
displayName: Verify Nuget package versions for PowerToys.sln
|
||||||
inputs:
|
inputs:
|
||||||
filePath: '$(build.sourcesdirectory)\.pipelines\verifyNugetPackages.ps1'
|
filePath: '$(build.sourcesdirectory)\.pipelines\verifyNugetPackages.ps1'
|
||||||
arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln'
|
arguments: -solution '$(build.sourcesdirectory)\PowerToys.sln'
|
||||||
@ -241,7 +248,7 @@ steps:
|
|||||||
dotnet list $(build.sourcesdirectory)\src\common\Common.UI\Common.UI.csproj package
|
dotnet list $(build.sourcesdirectory)\src\common\Common.UI\Common.UI.csproj package
|
||||||
|
|
||||||
- task: PowerShell@2
|
- task: PowerShell@2
|
||||||
displayName: Verifying Notice.md and Nuget packages match
|
displayName: Verify Notice.md and Nuget packages match
|
||||||
inputs:
|
inputs:
|
||||||
filePath: '$(build.sourcesdirectory)\.pipelines\verifyNoticeMdAgainstNugetPackages.ps1'
|
filePath: '$(build.sourcesdirectory)\.pipelines\verifyNoticeMdAgainstNugetPackages.ps1'
|
||||||
arguments: -path '$(build.sourcesdirectory)\'
|
arguments: -path '$(build.sourcesdirectory)\'
|
||||||
|
@ -24,7 +24,7 @@ steps:
|
|||||||
clean: true
|
clean: true
|
||||||
maximumCpuCount: true
|
maximumCpuCount: true
|
||||||
|
|
||||||
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
|
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
|
||||||
displayName: Sign PowerToysSetupCustomActions DLL
|
displayName: Sign PowerToysSetupCustomActions DLL
|
||||||
inputs:
|
inputs:
|
||||||
ConnectedServiceName: "Terminal/Console/WinAppDriver Team Code Signing Connection"
|
ConnectedServiceName: "Terminal/Console/WinAppDriver Team Code Signing Connection"
|
||||||
@ -74,7 +74,7 @@ steps:
|
|||||||
scriptName: .pipelines/versionAndSignCheck.ps1
|
scriptName: .pipelines/versionAndSignCheck.ps1
|
||||||
arguments: -targetDir '$(build.sourcesdirectory)\extractedMsi\Binary'
|
arguments: -targetDir '$(build.sourcesdirectory)\extractedMsi\Binary'
|
||||||
|
|
||||||
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
|
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
|
||||||
displayName: Sign MSI
|
displayName: Sign MSI
|
||||||
inputs:
|
inputs:
|
||||||
ConnectedServiceName: "Terminal/Console/WinAppDriver Team Code Signing Connection"
|
ConnectedServiceName: "Terminal/Console/WinAppDriver Team Code Signing Connection"
|
||||||
@ -101,7 +101,7 @@ steps:
|
|||||||
inputs:
|
inputs:
|
||||||
script: '"C:\Program Files (x86)\WiX Toolset v3.14\bin\insignia.exe" -ib installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-${{ parameters.versionNumber }}-$(BuildPlatform).exe -o installer\engine.exe'
|
script: '"C:\Program Files (x86)\WiX Toolset v3.14\bin\insignia.exe" -ib installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-${{ parameters.versionNumber }}-$(BuildPlatform).exe -o installer\engine.exe'
|
||||||
|
|
||||||
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
|
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
|
||||||
displayName: "ESRP CodeSigning (Engine)"
|
displayName: "ESRP CodeSigning (Engine)"
|
||||||
inputs:
|
inputs:
|
||||||
ConnectedServiceName: "Terminal/Console/WinAppDriver Team Code Signing Connection"
|
ConnectedServiceName: "Terminal/Console/WinAppDriver Team Code Signing Connection"
|
||||||
@ -137,7 +137,7 @@ steps:
|
|||||||
inputs:
|
inputs:
|
||||||
script: '"C:\Program Files (x86)\WiX Toolset v3.14\bin\insignia.exe" -ab installer\engine.exe installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-${{ parameters.versionNumber }}-$(BuildPlatform).exe -o installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-${{ parameters.versionNumber }}-$(BuildPlatform).exe'
|
script: '"C:\Program Files (x86)\WiX Toolset v3.14\bin\insignia.exe" -ab installer\engine.exe installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-${{ parameters.versionNumber }}-$(BuildPlatform).exe -o installer\PowerToysSetup\$(BuildPlatform)\$(BuildConfiguration)\${{parameters.buildSubDir}}\${{parameters.installerPrefix}}-${{ parameters.versionNumber }}-$(BuildPlatform).exe'
|
||||||
|
|
||||||
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
|
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
|
||||||
displayName: Sign Bootstrapper
|
displayName: Sign Bootstrapper
|
||||||
inputs:
|
inputs:
|
||||||
ConnectedServiceName: "Terminal/Console/WinAppDriver Team Code Signing Connection"
|
ConnectedServiceName: "Terminal/Console/WinAppDriver Team Code Signing Connection"
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
# This build should never run as CI or against a pull request.
|
# This build should never run as CI or against a pull request.
|
||||||
|
name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr)
|
||||||
trigger: none
|
trigger: none
|
||||||
pr: none
|
pr: none
|
||||||
|
|
||||||
pool:
|
resources:
|
||||||
name: SHINE-INT-L
|
repositories:
|
||||||
demands: ImageOverride -equals SHINE-VS17-Preview
|
- repository: 1ESPipelineTemplates
|
||||||
|
type: git
|
||||||
|
name: 1ESPipelineTemplates/1ESPipelineTemplates
|
||||||
|
ref: refs/tags/release
|
||||||
|
|
||||||
parameters:
|
parameters:
|
||||||
- name: buildConfigurations
|
- name: buildConfigurations
|
||||||
@ -20,19 +24,25 @@ parameters:
|
|||||||
type: string
|
type: string
|
||||||
default: '0.0.1'
|
default: '0.0.1'
|
||||||
|
|
||||||
variables:
|
extends:
|
||||||
IsPipeline: 1 # The installer uses this to detect whether it should pick up localizations
|
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
|
||||||
SkipCppCodeAnalysis: 1 # Skip the code analysis to speed up release CI. It runs on PR CI, anyway
|
parameters:
|
||||||
IsExperimentationLive: 1 # The build and installer use this to turn on experimentation
|
customBuildTags:
|
||||||
|
- 1ES.PT.ViaStartRight
|
||||||
|
pool:
|
||||||
|
name: SHINE-INT-S
|
||||||
|
image: SHINE-VS17-Latest
|
||||||
|
os: windows
|
||||||
|
|
||||||
name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr)
|
stages:
|
||||||
resources:
|
- stage: build
|
||||||
repositories:
|
displayName: Build (Complete)
|
||||||
- repository: self
|
pool:
|
||||||
type: git
|
name: SHINE-INT-L
|
||||||
ref: main
|
image: SHINE-VS17-Latest
|
||||||
jobs:
|
os: windows
|
||||||
- job: Build
|
jobs:
|
||||||
|
- job: Build
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
${{ each config in parameters.buildConfigurations }}:
|
${{ each config in parameters.buildConfigurations }}:
|
||||||
@ -40,30 +50,42 @@ jobs:
|
|||||||
${{ config }}_${{ platform }}:
|
${{ config }}_${{ platform }}:
|
||||||
BuildConfiguration: ${{ config }}
|
BuildConfiguration: ${{ config }}
|
||||||
BuildPlatform: ${{ platform }}
|
BuildPlatform: ${{ platform }}
|
||||||
NUGET_RESTORE_MSBUILD_ARGS: /p:Platform=${{ platform }} # Required for nuget to work due to self contained
|
templateContext:
|
||||||
NODE_OPTIONS: --max_old_space_size=16384
|
outputs:
|
||||||
|
- output: pipelineArtifact
|
||||||
|
artifactName: setup-$(BuildPlatform)
|
||||||
|
targetPath: $(Build.ArtifactStagingDirectory)
|
||||||
|
sdl:
|
||||||
|
baseline:
|
||||||
|
baselineFile: $(Build.SourcesDirectory)\.pipelines\sdl.gdnbaselines
|
||||||
displayName: Build
|
displayName: Build
|
||||||
timeoutInMinutes: 120 # Some of the loc stuff adds quite a bit of time.
|
timeoutInMinutes: 240 # Some of the 1ES Pipeline stuff and Loc take a very long time
|
||||||
cancelTimeoutInMinutes: 1
|
cancelTimeoutInMinutes: 1
|
||||||
|
variables:
|
||||||
|
NUGET_RESTORE_MSBUILD_ARGS: /p:Platform=$(BuildPlatform) # Required for nuget to work due to self contained
|
||||||
|
NODE_OPTIONS: --max_old_space_size=16384
|
||||||
|
IsPipeline: 1 # The installer uses this to detect whether it should pick up localizations
|
||||||
|
SkipCppCodeAnalysis: 1 # Skip the code analysis to speed up release CI. It runs on PR CI, anyway
|
||||||
|
IsExperimentationLive: 1 # The build and installer use this to turn on experimentation
|
||||||
steps:
|
steps:
|
||||||
- checkout: self
|
- checkout: self
|
||||||
clean: true
|
clean: true
|
||||||
submodules: true
|
submodules: true
|
||||||
persistCredentials: True
|
persistCredentials: True
|
||||||
|
|
||||||
# Sets versions for all PowerToy created DLLs
|
# Sets versions for all PowerToy created DLLs
|
||||||
- task: PowerShell@1
|
- task: PowerShell@1
|
||||||
displayName: Set Versions.Prop
|
displayName: Set Versions.Prop
|
||||||
inputs:
|
inputs:
|
||||||
scriptName: .pipelines/versionSetting.ps1
|
scriptName: .pipelines/versionSetting.ps1
|
||||||
arguments: -versionNumber '${{ parameters.versionNumber }}' -DevEnvironment ''
|
arguments: -versionNumber '${{ parameters.versionNumber }}' -DevEnvironment ''
|
||||||
|
|
||||||
# Guardian tool needs 'Microsoft.NETCore.App', version '2.1.0' (x64)
|
# ESRP needs 'Microsoft.NETCore.App', version '6.0.0' (x64)
|
||||||
- task: UseDotNet@2
|
- task: UseDotNet@2
|
||||||
displayName: 'Use .NET Core 2.1 SDK'
|
displayName: 'Use .NET 6 SDK'
|
||||||
inputs:
|
inputs:
|
||||||
packageType: sdk
|
packageType: sdk
|
||||||
version: '2.1.x'
|
version: '6.x'
|
||||||
|
|
||||||
- task: UseDotNet@2
|
- task: UseDotNet@2
|
||||||
displayName: 'Use .NET 8 SDK'
|
displayName: 'Use .NET 8 SDK'
|
||||||
@ -77,12 +99,12 @@ jobs:
|
|||||||
- task: NuGetToolInstaller@1
|
- task: NuGetToolInstaller@1
|
||||||
displayName: Use NuGet Installer latest
|
displayName: Use NuGet Installer latest
|
||||||
|
|
||||||
# this will restore the following nugets:
|
# this will restore the following nugets:
|
||||||
# - main solution
|
# - main solution
|
||||||
# - Bug report tool
|
# - Bug report tool
|
||||||
# - Webcam report tool
|
# - Webcam report tool
|
||||||
# - Installer
|
# - Installer
|
||||||
# - Bootstrapper Installer
|
# - Bootstrapper Installer
|
||||||
- task: PowerShell@2
|
- task: PowerShell@2
|
||||||
displayName: Download and install WiX 3.14 development build
|
displayName: Download and install WiX 3.14 development build
|
||||||
inputs:
|
inputs:
|
||||||
@ -123,7 +145,7 @@ jobs:
|
|||||||
move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TraceLoggingDefines.h" "src\common\Telemetry\TraceLoggingDefines.h" || exit /b 1
|
move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TraceLoggingDefines.h" "src\common\Telemetry\TraceLoggingDefines.h" || exit /b 1
|
||||||
move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TelemetryBase.cs" "src\common\Telemetry\TelemetryBase.cs" || exit /b 1
|
move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TelemetryBase.cs" "src\common\Telemetry\TelemetryBase.cs" || exit /b 1
|
||||||
|
|
||||||
## ALL BUT INSTALLER BUILDING
|
## ALL BUT INSTALLER BUILDING
|
||||||
- task: VSBuild@1
|
- task: VSBuild@1
|
||||||
displayName: Build PowerToys main project
|
displayName: Build PowerToys main project
|
||||||
inputs:
|
inputs:
|
||||||
@ -302,11 +324,11 @@ jobs:
|
|||||||
arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps'
|
arguments: -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)\WinUI3Apps'
|
||||||
pwsh: true
|
pwsh: true
|
||||||
|
|
||||||
#### MAIN SIGNING AREA
|
#### MAIN SIGNING AREA
|
||||||
# reference https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/ESRPSigning.json&version=GBarm64-netcore&_a=contents for winappdriver
|
# reference https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/ESRPSigning.json&version=GBarm64-netcore&_a=contents for winappdriver
|
||||||
# https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/CIPolicy.xml&version=GBarm64-netcore&_a=contents
|
# https://dev.azure.com/microsoft/Dart/_git/AppDriver?path=/CIPolicy.xml&version=GBarm64-netcore&_a=contents
|
||||||
|
|
||||||
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
|
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
|
||||||
displayName: Sign Core PT
|
displayName: Sign Core PT
|
||||||
inputs:
|
inputs:
|
||||||
ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection'
|
ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection'
|
||||||
@ -315,7 +337,7 @@ jobs:
|
|||||||
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_core.json'
|
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_core.json'
|
||||||
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
|
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
|
||||||
|
|
||||||
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
|
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@3
|
||||||
displayName: Sign x86 directshow VCM
|
displayName: Sign x86 directshow VCM
|
||||||
inputs:
|
inputs:
|
||||||
ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection'
|
ConnectedServiceName: 'Terminal/Console/WinAppDriver Team Code Signing Connection'
|
||||||
@ -323,16 +345,13 @@ jobs:
|
|||||||
signType: batchSigning
|
signType: batchSigning
|
||||||
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_vcm.json'
|
batchSignPolicyFile: '$(build.sourcesdirectory)\.pipelines\ESRPSigning_vcm.json'
|
||||||
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
|
ciPolicyFile: '$(build.sourcesdirectory)\.pipelines\CIPolicy.xml'
|
||||||
#### END SIGNING
|
#### END SIGNING
|
||||||
## END MAIN
|
## END MAIN
|
||||||
|
|
||||||
- task: PublishBuildArtifacts@1
|
- pwsh: |-
|
||||||
displayName: 'Publish Artifact: binlog'
|
Move-Item msbuild.binlog "$(Build.ArtifactStagingDirectory)/"
|
||||||
condition: failed()
|
displayName: Stage binlog into artifact directory
|
||||||
continueOnError: True
|
condition: always()
|
||||||
inputs:
|
|
||||||
PathtoPublish: $(Build.SourcesDirectory)\msbuild.binlog
|
|
||||||
ArtifactName: binlog-$(BuildPlatform)
|
|
||||||
|
|
||||||
- task: ComponentGovernanceComponentDetection@0
|
- task: ComponentGovernanceComponentDetection@0
|
||||||
displayName: Component Detection
|
displayName: Component Detection
|
||||||
@ -363,20 +382,7 @@ jobs:
|
|||||||
IndexSources: false
|
IndexSources: false
|
||||||
SymbolServerType: TeamServices
|
SymbolServerType: TeamServices
|
||||||
|
|
||||||
- task: PublishBuildArtifacts@1
|
- template: .pipelines/installer-steps.yml@self
|
||||||
displayName: 'Publish Artifact: Symbols'
|
|
||||||
inputs:
|
|
||||||
PathtoPublish: $(System.ArtifactsDirectory)/Symbols-$(BuildPlatform)/
|
|
||||||
ArtifactName: Symbols-${{ parameters.versionNumber }}-$(BuildPlatform)
|
|
||||||
|
|
||||||
- task: DeleteFiles@1
|
|
||||||
displayName: 'Remove symbols from ArtifactStagingDirectory'
|
|
||||||
inputs:
|
|
||||||
Contents: '*'
|
|
||||||
SourceFolder: $(Build.ArtifactStagingDirectory)/Symbols-$(BuildPlatform)/
|
|
||||||
RemoveSourceFolder: True
|
|
||||||
|
|
||||||
- template: installer-steps.yml
|
|
||||||
parameters:
|
parameters:
|
||||||
versionNumber: ${{ parameters.versionNumber }}
|
versionNumber: ${{ parameters.versionNumber }}
|
||||||
perUserArg: "false"
|
perUserArg: "false"
|
||||||
@ -390,7 +396,7 @@ jobs:
|
|||||||
script: git clean -xfd -e *exe -- .\installer\
|
script: git clean -xfd -e *exe -- .\installer\
|
||||||
pwsh: true
|
pwsh: true
|
||||||
|
|
||||||
- template: installer-steps.yml
|
- template: .pipelines/installer-steps.yml@self
|
||||||
parameters:
|
parameters:
|
||||||
versionNumber: ${{ parameters.versionNumber }}
|
versionNumber: ${{ parameters.versionNumber }}
|
||||||
perUserArg: "true"
|
perUserArg: "true"
|
||||||
@ -432,18 +438,10 @@ jobs:
|
|||||||
$machineHash | out-file -filepath $combinedMachinePath
|
$machineHash | out-file -filepath $combinedMachinePath
|
||||||
pwsh: true
|
pwsh: true
|
||||||
|
|
||||||
- task: PublishBuildArtifacts@1
|
# Publishing the GPO files
|
||||||
displayName: "Publish Artifact: PowerToySetup"
|
- pwsh: |-
|
||||||
inputs:
|
New-Item "$(Build.ArtifactStagingDirectory)/gpo" -Type Directory
|
||||||
PathtoPublish: $(System.ArtifactsDirectory)
|
Copy-Item src\gpo\assets\* "$(Build.ArtifactStagingDirectory)/gpo" -Recurse
|
||||||
ArtifactName: setup-$(BuildPlatform)
|
displayName: Stage the GPO files
|
||||||
|
|
||||||
# Publishing the GPO files with a version number
|
|
||||||
- task: PublishBuildArtifacts@1
|
|
||||||
displayName: 'Publish Artifact: GPO Files'
|
|
||||||
inputs:
|
|
||||||
PathtoPublish: src\gpo\assets
|
|
||||||
ArtifactName: GroupPolicyObjectsFiles-${{ parameters.versionNumber }}
|
|
||||||
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
7457
.pipelines/sdl.gdnbaselines
Normal file
7457
.pipelines/sdl.gdnbaselines
Normal file
File diff suppressed because it is too large
Load Diff
@ -42,6 +42,9 @@
|
|||||||
<PreferredToolArchitecture Condition="'$(PROCESSOR_ARCHITECTURE)' == 'ARM64' or '$(PROCESSOR_ARCHITEW6432)' == 'ARM64'">arm64</PreferredToolArchitecture>
|
<PreferredToolArchitecture Condition="'$(PROCESSOR_ARCHITECTURE)' == 'ARM64' or '$(PROCESSOR_ARCHITEW6432)' == 'ARM64'">arm64</PreferredToolArchitecture>
|
||||||
<VcpkgEnabled>false</VcpkgEnabled>
|
<VcpkgEnabled>false</VcpkgEnabled>
|
||||||
<ExternalIncludePath>$(MSBuildThisFileFullPath)\..\deps\;$(MSBuildThisFileFullPath)\..\packages\;$(ExternalIncludePath)</ExternalIncludePath>
|
<ExternalIncludePath>$(MSBuildThisFileFullPath)\..\deps\;$(MSBuildThisFileFullPath)\..\packages\;$(ExternalIncludePath)</ExternalIncludePath>
|
||||||
|
<!-- Enable control flow guard for C++ projects that don't consume any C++ files -->
|
||||||
|
<!-- This covers the case where a .dll exports a .lib, but doesn't have any ClCompile entries. -->
|
||||||
|
<LinkControlFlowGuard>Guard</LinkControlFlowGuard>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
@ -56,6 +59,9 @@
|
|||||||
<BuildStlModules>false</BuildStlModules>
|
<BuildStlModules>false</BuildStlModules>
|
||||||
<AdditionalOptions>/await %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/await %(AdditionalOptions)</AdditionalOptions>
|
||||||
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<!-- CLR + CFG are not compatible >:{ -->
|
||||||
|
<ControlFlowGuard Condition="'$(CLRSupport)' == ''">Guard</ControlFlowGuard>
|
||||||
|
<DebugInformationFormat Condition="'%(ControlFlowGuard)' == 'Guard'">ProgramDatabase</DebugInformationFormat>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
16
README.md
16
README.md
@ -41,17 +41,17 @@ Go to the [Microsoft PowerToys GitHub releases page][github-release-link] and cl
|
|||||||
<!-- items that need to be updated release to release -->
|
<!-- items that need to be updated release to release -->
|
||||||
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F48
|
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F48
|
||||||
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F47
|
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F47
|
||||||
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.0/PowerToysUserSetup-0.74.0-x64.exe
|
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.1/PowerToysUserSetup-0.74.1-x64.exe
|
||||||
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.0/PowerToysUserSetup-0.74.0-arm64.exe
|
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.1/PowerToysUserSetup-0.74.1-arm64.exe
|
||||||
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.0/PowerToysSetup-0.74.0-x64.exe
|
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.1/PowerToysSetup-0.74.1-x64.exe
|
||||||
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.0/PowerToysSetup-0.74.0-arm64.exe
|
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.74.1/PowerToysSetup-0.74.1-arm64.exe
|
||||||
|
|
||||||
| Description | Filename | sha256 hash |
|
| Description | Filename | sha256 hash |
|
||||||
|----------------|----------|-------------|
|
|----------------|----------|-------------|
|
||||||
| Per user - x64 | [PowerToysUserSetup-0.74.0-x64.exe][ptUserX64] | 1C4ECE9F11488BAFFAE6B76D2B0504FA18BFFEA11EBC38BCC87F5D86AEA87C7C |
|
| Per user - x64 | [PowerToysUserSetup-0.74.1-x64.exe][ptUserX64] | 748BF7BA33913237D36D6F48E3839D0C8035967305137A17DEFF39D775735C81 |
|
||||||
| Per user - ARM64 | [PowerToysUserSetup-0.74.0-arm64.exe][ptUserArm64] | 4F3842FAB0839A361A15A06B7720BA8A0FE7F9AF98EA94245C08DEF37678CA4A |
|
| Per user - ARM64 | [PowerToysUserSetup-0.74.1-arm64.exe][ptUserArm64] | F5DAA89A9CF3A2805E121085AFD056A890F241A170FAB5007AA58E2755C88C54 |
|
||||||
| Machine wide - x64 | [PowerToysSetup-0.74.0-x64.exe][ptMachineX64] | 648992E8CEA08F3C63C7CCBD554ADDF500ECBC4560187310BC12E6CB9C2F38E3 |
|
| Machine wide - x64 | [PowerToysSetup-0.74.1-x64.exe][ptMachineX64] | 298C6F4E4391BDC06E128BED86A303C3300A68EAF754B4630AF7542C78C0944A |
|
||||||
| Machine wide - ARM64 | [PowerToysSetup-0.74.0-arm64.exe][ptMachineArm64] | 2B6D92F1A0EA688C7EE882050AC9B030C8B3A18765163FB6D67E5E694A4D4FE3 |
|
| Machine wide - ARM64 | [PowerToysSetup-0.74.1-arm64.exe][ptMachineArm64] | A65F3C300A48F9F81312B7FC7B306382CB87F591612D0CEC7E5C0E47E868904B |
|
||||||
|
|
||||||
This is our preferred method.
|
This is our preferred method.
|
||||||
|
|
||||||
|
42
Settings.XamlStyler
Normal file
42
Settings.XamlStyler
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"AttributesTolerance": 2,
|
||||||
|
"KeepFirstAttributeOnSameLine": false,
|
||||||
|
"MaxAttributeCharactersPerLine": 0,
|
||||||
|
"MaxAttributesPerLine": 1,
|
||||||
|
"NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter",
|
||||||
|
"SeparateByGroups": false,
|
||||||
|
"AttributeIndentation": 0,
|
||||||
|
"AttributeIndentationStyle": 1,
|
||||||
|
"RemoveDesignTimeReferences": false,
|
||||||
|
"IgnoreDesignTimeReferencePrefix": false,
|
||||||
|
"EnableAttributeReordering": true,
|
||||||
|
"AttributeOrderingRuleGroups": [
|
||||||
|
"x:Class",
|
||||||
|
"xmlns, xmlns:x",
|
||||||
|
"xmlns:*",
|
||||||
|
"x:Key, Key, x:Name, Name, x:Uid, Uid, Title",
|
||||||
|
"Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom",
|
||||||
|
"Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight",
|
||||||
|
"Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex",
|
||||||
|
"*:*, *",
|
||||||
|
"PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint",
|
||||||
|
"mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText",
|
||||||
|
"Storyboard.*, From, To, Duration"
|
||||||
|
],
|
||||||
|
"FirstLineAttributes": "",
|
||||||
|
"OrderAttributesByName": true,
|
||||||
|
"PutEndingBracketOnNewLine": false,
|
||||||
|
"RemoveEndingTagOfEmptyElement": true,
|
||||||
|
"SpaceBeforeClosingSlash": true,
|
||||||
|
"RootElementLineBreakRule": 0,
|
||||||
|
"ReorderVSM": 2,
|
||||||
|
"ReorderGridChildren": false,
|
||||||
|
"ReorderCanvasChildren": false,
|
||||||
|
"ReorderSetters": 0,
|
||||||
|
"FormatMarkupExtension": true,
|
||||||
|
"NoNewLineMarkupExtensions": "x:Bind, Binding",
|
||||||
|
"ThicknessSeparator": 2,
|
||||||
|
"ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin",
|
||||||
|
"FormatOnSave": true,
|
||||||
|
"CommentPadding": 2,
|
||||||
|
}
|
@ -15,7 +15,7 @@ Available commands:
|
|||||||
* Hibernate
|
* Hibernate
|
||||||
* Open / Empty Recycle Bin
|
* Open / Empty Recycle Bin
|
||||||
* UEFI Firmware Settings (Only available on systems, that boot in UEFI mode.)
|
* UEFI Firmware Settings (Only available on systems, that boot in UEFI mode.)
|
||||||
* IP / MAC / Address => Show informations about network connections.
|
* IP / MAC / Address => Show information about network connections.
|
||||||
|
|
||||||
## Optional plugin settings
|
## Optional plugin settings
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ Available commands:
|
|||||||
|
|
||||||
### [`NetworkConnectionProperties.cs`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/NetworkConnectionProperties.cs)
|
### [`NetworkConnectionProperties.cs`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/NetworkConnectionProperties.cs)
|
||||||
- The [`NetworkConnectionProperties`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/NetworkConnectionProperties.cs) class contains methods to get the properties of a network interface/connection.
|
- The [`NetworkConnectionProperties`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/NetworkConnectionProperties.cs) class contains methods to get the properties of a network interface/connection.
|
||||||
- An instance of this class collects/provides all required informations about one connection/adapter.
|
- An instance of this class collects/provides all required information about one connection/adapter.
|
||||||
|
|
||||||
### [`SystemPluginContext.cs`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/SystemPluginContext.cs)
|
### [`SystemPluginContext.cs`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/SystemPluginContext.cs)
|
||||||
- An instance of the class [`SystemPluginContext`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/SystemPluginContext.cs) contains/defines the context data of a system plugin result. We select the context menu based on the defined properties.
|
- An instance of the class [`SystemPluginContext`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/SystemPluginContext.cs) contains/defines the context data of a system plugin result. We select the context menu based on the defined properties.
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
## Formatting
|
## Formatting
|
||||||
|
|
||||||
|
- We use [XamlStyler](https://github.com/Xavalon/XamlStyler/) to format XAML files. You can use the [Visual Studio Extension](https://marketplace.visualstudio.com/items?itemName=TeamXavalon.XAMLStyler2022) or apply formatting executing `.\.pipelines\applyXamlStyling.ps1 -Main`.
|
||||||
- We use [`.clang-format`](https://github.com/microsoft/PowerToys/blob/main/src/.clang-format) style file to enable automatic code formatting. You can [easily format source files from Visual Studio](https://devblogs.microsoft.com/cppblog/clangformat-support-in-visual-studio-2017-15-7-preview-1/). For example, `CTRL+K CTRL+D` formats the current document.
|
- We use [`.clang-format`](https://github.com/microsoft/PowerToys/blob/main/src/.clang-format) style file to enable automatic code formatting. You can [easily format source files from Visual Studio](https://devblogs.microsoft.com/cppblog/clangformat-support-in-visual-studio-2017-15-7-preview-1/). For example, `CTRL+K CTRL+D` formats the current document.
|
||||||
- If you prefer another text editor or have ClangFormat disabled in Visual Studio, you could invoke [`format_sources`](https://github.com/microsoft/PowerToys/blob/main/src/codeAnalysis/format_sources.ps1) powershell script from command line. It gets a list of all currently modified files from `git` and invokes clang-format on them.
|
- If you prefer another text editor or have ClangFormat disabled in Visual Studio, you could invoke [`format_sources`](https://github.com/microsoft/PowerToys/blob/main/src/codeAnalysis/format_sources.ps1) powershell script from command line. It gets a list of all currently modified files from `git` and invokes clang-format on them.
|
||||||
Please note that you should also have `clang-format.exe` in `%PATH%` for it to work. The script can infer the path of `clang-format.exe` version which is shipped with Visual Studio at `%VCINSTALLDIR%\Tools\Llvm\bin\`, if you launch it from the *Native Tools Command Prompt for VS*.
|
Please note that you should also have `clang-format.exe` in `%PATH%` for it to work. The script can infer the path of `clang-format.exe` version which is shipped with Visual Studio at `%VCINSTALLDIR%\Tools\Llvm\bin\`, if you launch it from the *Native Tools Command Prompt for VS*.
|
||||||
|
@ -22,7 +22,19 @@ You will find the policies under "Administrative Templates/Microsoft PowerToys"
|
|||||||
|
|
||||||
## Policies
|
## Policies
|
||||||
|
|
||||||
### Configure enabled state
|
### Configure global utility enabled state
|
||||||
|
|
||||||
|
This policy configures the enabled state for all PowerToys utilities.
|
||||||
|
|
||||||
|
If you enable this setting, all utilities will be always enabled and the user won't be able to disable it.
|
||||||
|
|
||||||
|
If you disable this setting, all utilities will be always disabled and the user won't be able to enable it.
|
||||||
|
|
||||||
|
If you don't configure this setting, users are able to disable or enable the utilities.
|
||||||
|
|
||||||
|
The individual enabled state policies for the utilities will override this policy.
|
||||||
|
|
||||||
|
### Configure enabled state for individual utilities
|
||||||
|
|
||||||
For each utility shipped with PowerToys, there's a "Configure enabled state" policy, which forces and Enabled state for the utility.
|
For each utility shipped with PowerToys, there's a "Configure enabled state" policy, which forces and Enabled state for the utility.
|
||||||
|
|
||||||
@ -32,6 +44,8 @@ If you disable this setting, the utility will be always disabled and the user wo
|
|||||||
|
|
||||||
If you don't configure this setting, users are able to disable or enable the utility.
|
If you don't configure this setting, users are able to disable or enable the utility.
|
||||||
|
|
||||||
|
This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it.
|
||||||
|
|
||||||
### Allow experimentation
|
### Allow experimentation
|
||||||
|
|
||||||
This policy configures whether PowerToys experimentation is allowed. With experimentation allowed the user sees the new features being experimented if it gets selected as part of the test group. (Experimentation will only happen on Windows Insider builds.)
|
This policy configures whether PowerToys experimentation is allowed. With experimentation allowed the user sees the new features being experimented if it gets selected as part of the test group. (Experimentation will only happen on Windows Insider builds.)
|
||||||
|
@ -111,6 +111,11 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="GPOWrapper.rc" />
|
<ResourceCompile Include="GPOWrapper.rc" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\common\version\version.vcxproj">
|
||||||
|
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||||
|
@ -43,6 +43,11 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\common\version\version.vcxproj">
|
||||||
|
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
<Import Project="..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||||
|
@ -48,9 +48,6 @@
|
|||||||
<ProjectReference Include="..\SettingsAPI\SettingsAPI.vcxproj">
|
<ProjectReference Include="..\SettingsAPI\SettingsAPI.vcxproj">
|
||||||
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\version\version.vcxproj">
|
|
||||||
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="UnitTests-CommonLib.rc" />
|
<ResourceCompile Include="UnitTests-CommonLib.rc" />
|
||||||
|
@ -238,6 +238,7 @@ void LayoutMap::LayoutMapImpl::UpdateLayout()
|
|||||||
keyboardLayoutMap[VK_NONCONVERT] = L"IME Non-Convert";
|
keyboardLayoutMap[VK_NONCONVERT] = L"IME Non-Convert";
|
||||||
keyboardLayoutMap[VK_ACCEPT] = L"IME Kana";
|
keyboardLayoutMap[VK_ACCEPT] = L"IME Kana";
|
||||||
keyboardLayoutMap[VK_MODECHANGE] = L"IME Mode Change";
|
keyboardLayoutMap[VK_MODECHANGE] = L"IME Mode Change";
|
||||||
|
keyboardLayoutMap[VK_DECIMAL] = L". (Numpad)";
|
||||||
keyboardLayoutMap[CommonSharedConstants::VK_DISABLED] = L"Disable";
|
keyboardLayoutMap[CommonSharedConstants::VK_DISABLED] = L"Disable";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,6 +74,9 @@
|
|||||||
<ProjectReference Include="..\..\logging\logging.vcxproj">
|
<ProjectReference Include="..\..\logging\logging.vcxproj">
|
||||||
<Project>{7e1e3f13-2bd6-3f75-a6a7-873a2b55c60f}</Project>
|
<Project>{7e1e3f13-2bd6-3f75-a6a7-873a2b55c60f}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\version\version.vcxproj">
|
||||||
|
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
|
@ -67,6 +67,9 @@
|
|||||||
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.221104.6\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\common\version\version.vcxproj">
|
||||||
|
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\BackgroundActivator\BackgroundActivator.vcxproj">
|
<ProjectReference Include="..\BackgroundActivator\BackgroundActivator.vcxproj">
|
||||||
<Project>{031AC72E-FA28-4AB7-B690-6F7B9C28AA73}</Project>
|
<Project>{031AC72E-FA28-4AB7-B690-6F7B9C28AA73}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
@ -51,9 +51,6 @@
|
|||||||
<ProjectReference Include="..\SettingsAPI\SettingsAPI.vcxproj">
|
<ProjectReference Include="..\SettingsAPI\SettingsAPI.vcxproj">
|
||||||
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\version\version.vcxproj">
|
|
||||||
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
|
@ -19,6 +19,7 @@ namespace powertoys_gpo {
|
|||||||
const HKEY POLICIES_SCOPE_USER = HKEY_CURRENT_USER;
|
const HKEY POLICIES_SCOPE_USER = HKEY_CURRENT_USER;
|
||||||
|
|
||||||
// The registry value names for PowerToys utilities enabled and disabled policies.
|
// The registry value names for PowerToys utilities enabled and disabled policies.
|
||||||
|
const std::wstring POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES = L"ConfigureGlobalUtilityEnabledState";
|
||||||
const std::wstring POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP = L"ConfigureEnabledUtilityAlwaysOnTop";
|
const std::wstring POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP = L"ConfigureEnabledUtilityAlwaysOnTop";
|
||||||
const std::wstring POLICY_CONFIGURE_ENABLED_AWAKE = L"ConfigureEnabledUtilityAwake";
|
const std::wstring POLICY_CONFIGURE_ENABLED_AWAKE = L"ConfigureEnabledUtilityAwake";
|
||||||
const std::wstring POLICY_CONFIGURE_ENABLED_COLOR_PICKER = L"ConfigureEnabledUtilityColorPicker";
|
const std::wstring POLICY_CONFIGURE_ENABLED_COLOR_PICKER = L"ConfigureEnabledUtilityColorPicker";
|
||||||
@ -116,168 +117,183 @@ namespace powertoys_gpo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredAlwaysOnTopEnabledValue() {
|
inline gpo_rule_configured_t getUtilityEnabledValue(const std::wstring& utility_name)
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP);
|
{
|
||||||
|
auto individual_value = getConfiguredValue(utility_name);
|
||||||
|
|
||||||
|
if (individual_value == gpo_rule_configured_disabled || individual_value == gpo_rule_configured_enabled)
|
||||||
|
{
|
||||||
|
return individual_value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GLOBAL_ALL_UTILITIES);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline gpo_rule_configured_t getConfiguredAlwaysOnTopEnabledValue()
|
||||||
|
{
|
||||||
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_ALWAYS_ON_TOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredAwakeEnabledValue()
|
inline gpo_rule_configured_t getConfiguredAwakeEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_AWAKE);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_AWAKE);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredColorPickerEnabledValue()
|
inline gpo_rule_configured_t getConfiguredColorPickerEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_COLOR_PICKER);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_COLOR_PICKER);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredCropAndLockEnabledValue()
|
inline gpo_rule_configured_t getConfiguredCropAndLockEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_CROP_AND_LOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredFancyZonesEnabledValue()
|
inline gpo_rule_configured_t getConfiguredFancyZonesEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_FANCYZONES);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FANCYZONES);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredFileLocksmithEnabledValue()
|
inline gpo_rule_configured_t getConfiguredFileLocksmithEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FILE_LOCKSMITH);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredSvgPreviewEnabledValue()
|
inline gpo_rule_configured_t getConfiguredSvgPreviewEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_SVG_PREVIEW);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_PREVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredMarkdownPreviewEnabledValue()
|
inline gpo_rule_configured_t getConfiguredMarkdownPreviewEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MARKDOWN_PREVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredMonacoPreviewEnabledValue()
|
inline gpo_rule_configured_t getConfiguredMonacoPreviewEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MONACO_PREVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredPdfPreviewEnabledValue()
|
inline gpo_rule_configured_t getConfiguredPdfPreviewEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_PDF_PREVIEW);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_PREVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredGcodePreviewEnabledValue()
|
inline gpo_rule_configured_t getConfiguredGcodePreviewEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_PREVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredSvgThumbnailsEnabledValue()
|
inline gpo_rule_configured_t getConfiguredSvgThumbnailsEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SVG_THUMBNAILS);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredPdfThumbnailsEnabledValue()
|
inline gpo_rule_configured_t getConfiguredPdfThumbnailsEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PDF_THUMBNAILS);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredGcodeThumbnailsEnabledValue()
|
inline gpo_rule_configured_t getConfiguredGcodeThumbnailsEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_GCODE_THUMBNAILS);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredStlThumbnailsEnabledValue()
|
inline gpo_rule_configured_t getConfiguredStlThumbnailsEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_STL_THUMBNAILS);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredHostsFileEditorEnabledValue()
|
inline gpo_rule_configured_t getConfiguredHostsFileEditorEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_HOSTS_FILE_EDITOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredImageResizerEnabledValue()
|
inline gpo_rule_configured_t getConfiguredImageResizerEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_IMAGE_RESIZER);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredKeyboardManagerEnabledValue()
|
inline gpo_rule_configured_t getConfiguredKeyboardManagerEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_KEYBOARD_MANAGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredFindMyMouseEnabledValue()
|
inline gpo_rule_configured_t getConfiguredFindMyMouseEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_FIND_MY_MOUSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredMouseHighlighterEnabledValue()
|
inline gpo_rule_configured_t getConfiguredMouseHighlighterEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_HIGHLIGHTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredMouseJumpEnabledValue()
|
inline gpo_rule_configured_t getConfiguredMouseJumpEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_MOUSE_JUMP);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_JUMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredMousePointerCrosshairsEnabledValue()
|
inline gpo_rule_configured_t getConfiguredMousePointerCrosshairsEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_POINTER_CROSSHAIRS);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredPowerRenameEnabledValue()
|
inline gpo_rule_configured_t getConfiguredPowerRenameEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_POWER_RENAME);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_RENAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredPowerLauncherEnabledValue()
|
inline gpo_rule_configured_t getConfiguredPowerLauncherEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_POWER_LAUNCHER);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredQuickAccentEnabledValue()
|
inline gpo_rule_configured_t getConfiguredQuickAccentEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_QUICK_ACCENT);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_QUICK_ACCENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredScreenRulerEnabledValue()
|
inline gpo_rule_configured_t getConfiguredScreenRulerEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_SCREEN_RULER);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SCREEN_RULER);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredShortcutGuideEnabledValue()
|
inline gpo_rule_configured_t getConfiguredShortcutGuideEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_SHORTCUT_GUIDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredTextExtractorEnabledValue()
|
inline gpo_rule_configured_t getConfiguredTextExtractorEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_TEXT_EXTRACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredPastePlainEnabledValue()
|
inline gpo_rule_configured_t getConfiguredPastePlainEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_PASTE_PLAIN);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PASTE_PLAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredVideoConferenceMuteEnabledValue()
|
inline gpo_rule_configured_t getConfiguredVideoConferenceMuteEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_VIDEO_CONFERENCE_MUTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredMouseWithoutBordersEnabledValue()
|
inline gpo_rule_configured_t getConfiguredMouseWithoutBordersEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_MOUSE_WITHOUT_BORDERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredPeekEnabledValue()
|
inline gpo_rule_configured_t getConfiguredPeekEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_PEEK);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_PEEK);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getConfiguredRegistryPreviewEnabledValue()
|
inline gpo_rule_configured_t getConfiguredRegistryPreviewEnabledValue()
|
||||||
{
|
{
|
||||||
return getConfiguredValue(POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW);
|
return getUtilityEnabledValue(POLICY_CONFIGURE_ENABLED_REGISTRY_PREVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline gpo_rule_configured_t getDisablePerUserInstallationValue()
|
inline gpo_rule_configured_t getDisablePerUserInstallationValue()
|
||||||
|
@ -10,6 +10,25 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<WriteLinesToFile File="Generated Files\version_gen.h" Lines="@(HeaderLines)" Overwrite="true" Encoding="Unicode" WriteOnlyWhenDifferent="true" />
|
<WriteLinesToFile File="Generated Files\version_gen.h" Lines="@(HeaderLines)" Overwrite="true" Encoding="Unicode" WriteOnlyWhenDifferent="true" />
|
||||||
</Target>
|
</Target>
|
||||||
|
<!-- Needed for .\src\modules\videoconference\VideoConferenceProxyFilter\build_vcm_x86.cmd -->
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<VCProjectVersion>16.0</VCProjectVersion>
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
<ProjectGuid>{CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}</ProjectGuid>
|
<ProjectGuid>{CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}</ProjectGuid>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Copyright (c) Microsoft Corporation.
|
<!-- Copyright (c) Microsoft Corporation.
|
||||||
Licensed under the MIT License. -->
|
Licensed under the MIT License. -->
|
||||||
<policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.3" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
|
<policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.4" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
|
||||||
<policyNamespaces>
|
<policyNamespaces>
|
||||||
<target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" />
|
<target prefix="powertoys" namespace="Microsoft.Policies.PowerToys" />
|
||||||
</policyNamespaces>
|
</policyNamespaces>
|
||||||
<resources minRequiredRevision="1.3"/><!-- Last changed with PowerToys v0.73.0 -->
|
<resources minRequiredRevision="1.4"/><!-- Last changed with PowerToys v0.75.0 -->
|
||||||
<supportedOn>
|
<supportedOn>
|
||||||
<definitions>
|
<definitions>
|
||||||
<definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/>
|
<definition name="SUPPORTED_POWERTOYS_0_64_0" displayName="$(string.SUPPORTED_POWERTOYS_0_64_0)"/>
|
||||||
@ -13,6 +13,7 @@
|
|||||||
<definition name="SUPPORTED_POWERTOYS_0_69_0" displayName="$(string.SUPPORTED_POWERTOYS_0_69_0)"/>
|
<definition name="SUPPORTED_POWERTOYS_0_69_0" displayName="$(string.SUPPORTED_POWERTOYS_0_69_0)"/>
|
||||||
<definition name="SUPPORTED_POWERTOYS_0_70_0" displayName="$(string.SUPPORTED_POWERTOYS_0_70_0)"/>
|
<definition name="SUPPORTED_POWERTOYS_0_70_0" displayName="$(string.SUPPORTED_POWERTOYS_0_70_0)"/>
|
||||||
<definition name="SUPPORTED_POWERTOYS_0_73_0" displayName="$(string.SUPPORTED_POWERTOYS_0_73_0)"/>
|
<definition name="SUPPORTED_POWERTOYS_0_73_0" displayName="$(string.SUPPORTED_POWERTOYS_0_73_0)"/>
|
||||||
|
<definition name="SUPPORTED_POWERTOYS_0_75_0" displayName="$(string.SUPPORTED_POWERTOYS_0_75_0)"/>
|
||||||
</definitions>
|
</definitions>
|
||||||
</supportedOn>
|
</supportedOn>
|
||||||
<categories>
|
<categories>
|
||||||
@ -22,6 +23,18 @@
|
|||||||
</category>
|
</category>
|
||||||
</categories>
|
</categories>
|
||||||
<policies>
|
<policies>
|
||||||
|
|
||||||
|
<policy name="ConfigureGlobalUtilityEnabledState" class="Both" displayName="$(string.ConfigureGlobalUtilityEnabledState)" explainText="$(string.ConfigureGlobalUtilityEnabledStateDescription)" key="Software\Policies\PowerToys" valueName="ConfigureGlobalUtilityEnabledState">
|
||||||
|
<parentCategory ref="PowerToys" />
|
||||||
|
<supportedOn ref="SUPPORTED_POWERTOYS_0_75_0" />
|
||||||
|
<enabledValue>
|
||||||
|
<decimal value="1" />
|
||||||
|
</enabledValue>
|
||||||
|
<disabledValue>
|
||||||
|
<decimal value="0" />
|
||||||
|
</disabledValue>
|
||||||
|
</policy>
|
||||||
|
|
||||||
<policy name="ConfigureEnabledUtilityAlwaysOnTop" class="Both" displayName="$(string.ConfigureEnabledUtilityAlwaysOnTop)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAlwaysOnTop">
|
<policy name="ConfigureEnabledUtilityAlwaysOnTop" class="Both" displayName="$(string.ConfigureEnabledUtilityAlwaysOnTop)" explainText="$(string.ConfigureEnabledUtilityDescription)" key="Software\Policies\PowerToys" valueName="ConfigureEnabledUtilityAlwaysOnTop">
|
||||||
<parentCategory ref="PowerToys" />
|
<parentCategory ref="PowerToys" />
|
||||||
<supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" />
|
<supportedOn ref="SUPPORTED_POWERTOYS_0_64_0" />
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Copyright (c) Microsoft Corporation.
|
<!-- Copyright (c) Microsoft Corporation.
|
||||||
Licensed under the MIT License. -->
|
Licensed under the MIT License. -->
|
||||||
<policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.3" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
|
<policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.4" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
|
||||||
<displayName>PowerToys</displayName>
|
<displayName>PowerToys</displayName>
|
||||||
<description>PowerToys</description>
|
<description>PowerToys</description>
|
||||||
<resources>
|
<resources>
|
||||||
@ -14,6 +14,18 @@
|
|||||||
<string id="SUPPORTED_POWERTOYS_0_69_0">PowerToys version 0.69.0 or later</string>
|
<string id="SUPPORTED_POWERTOYS_0_69_0">PowerToys version 0.69.0 or later</string>
|
||||||
<string id="SUPPORTED_POWERTOYS_0_70_0">PowerToys version 0.70.0 or later</string>
|
<string id="SUPPORTED_POWERTOYS_0_70_0">PowerToys version 0.70.0 or later</string>
|
||||||
<string id="SUPPORTED_POWERTOYS_0_73_0">PowerToys version 0.73.0 or later</string>
|
<string id="SUPPORTED_POWERTOYS_0_73_0">PowerToys version 0.73.0 or later</string>
|
||||||
|
<string id="SUPPORTED_POWERTOYS_0_75_0">PowerToys version 0.75.0 or later</string>
|
||||||
|
|
||||||
|
<string id="ConfigureGlobalUtilityEnabledStateDescription">This policy configures the enabled state for all PowerToys utilities.
|
||||||
|
|
||||||
|
If you enable this setting, all utilities will be always enabled and the user won't be able to disable it.
|
||||||
|
|
||||||
|
If you disable this setting, all utilities will be always disabled and the user won't be able to enable it.
|
||||||
|
|
||||||
|
If you don't configure this setting, users are able to disable or enable the utilities.
|
||||||
|
|
||||||
|
The individual enabled state policies for the utilities will override this policy.
|
||||||
|
</string>
|
||||||
|
|
||||||
<string id="ConfigureEnabledUtilityDescription">This policy configures the enabled state for a PowerToys utility.
|
<string id="ConfigureEnabledUtilityDescription">This policy configures the enabled state for a PowerToys utility.
|
||||||
|
|
||||||
@ -22,6 +34,8 @@ If you enable this setting, the utility will be always enabled and the user won'
|
|||||||
If you disable this setting, the utility will be always disabled and the user won't be able to enable it.
|
If you disable this setting, the utility will be always disabled and the user won't be able to enable it.
|
||||||
|
|
||||||
If you don't configure this setting, users are able to disable or enable the utility.
|
If you don't configure this setting, users are able to disable or enable the utility.
|
||||||
|
|
||||||
|
This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it.
|
||||||
</string>
|
</string>
|
||||||
<string id="ConfigureEnabledUtilityDescriptionPDFPreviewHandler">(Note: There have been reports of incompatibility between the PDF Preview Handler and Outlook)
|
<string id="ConfigureEnabledUtilityDescriptionPDFPreviewHandler">(Note: There have been reports of incompatibility between the PDF Preview Handler and Outlook)
|
||||||
|
|
||||||
@ -32,6 +46,8 @@ If you enable this setting, the utility will be always enabled and the user won'
|
|||||||
If you disable this setting, the utility will be always disabled and the user won't be able to enable it.
|
If you disable this setting, the utility will be always disabled and the user won't be able to enable it.
|
||||||
|
|
||||||
If you don't configure this setting, users are able to disable or enable the utility.
|
If you don't configure this setting, users are able to disable or enable the utility.
|
||||||
|
|
||||||
|
This policy has a higher priority than the policy "Configure global utility enabled state" and overrides it.
|
||||||
</string>
|
</string>
|
||||||
<string id="DisablePerUserInstallationDescription">This policy configures whether per-user PowerToys installation is allowed or not.
|
<string id="DisablePerUserInstallationDescription">This policy configures whether per-user PowerToys installation is allowed or not.
|
||||||
|
|
||||||
@ -65,6 +81,7 @@ If this setting is not configured or enabled, the user can control experimentati
|
|||||||
|
|
||||||
If this setting is disabled, experimentation is not allowed.
|
If this setting is disabled, experimentation is not allowed.
|
||||||
</string>
|
</string>
|
||||||
|
<string id="ConfigureGlobalUtilityEnabledState">Configure global utility enabled state</string>
|
||||||
<string id="ConfigureEnabledUtilityAlwaysOnTop">Always On Top: Configure enabled state</string>
|
<string id="ConfigureEnabledUtilityAlwaysOnTop">Always On Top: Configure enabled state</string>
|
||||||
<string id="ConfigureEnabledUtilityAwake">Awake: Configure enabled state</string>
|
<string id="ConfigureEnabledUtilityAwake">Awake: Configure enabled state</string>
|
||||||
<string id="ConfigureEnabledUtilityColorPicker">Color Picker: Configure enabled state</string>
|
<string id="ConfigureEnabledUtilityColorPicker">Color Picker: Configure enabled state</string>
|
||||||
|
@ -260,9 +260,6 @@
|
|||||||
<ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj">
|
<ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj">
|
||||||
<Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
|
<Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\..\common\version\version.vcxproj">
|
|
||||||
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<Import Project="..\..\..\..\deps\spdlog.props" />
|
<Import Project="..\..\..\..\deps\spdlog.props" />
|
||||||
|
@ -20,22 +20,23 @@
|
|||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid x:Name="AppTitleBar"
|
<Grid
|
||||||
|
x:Name="AppTitleBar"
|
||||||
Height="32"
|
Height="32"
|
||||||
ColumnSpacing="16">
|
ColumnSpacing="16">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition x:Name="LeftPaddingColumn" Width="0"/>
|
<ColumnDefinition x:Name="LeftPaddingColumn" Width="0" />
|
||||||
<ColumnDefinition x:Name="IconColumn" Width="Auto"/>
|
<ColumnDefinition x:Name="IconColumn" Width="Auto" />
|
||||||
<ColumnDefinition x:Name="TitleColumn" Width="Auto"/>
|
<ColumnDefinition x:Name="TitleColumn" Width="Auto" />
|
||||||
<ColumnDefinition x:Name="RightDragColumn" Width="*"/>
|
<ColumnDefinition x:Name="RightDragColumn" Width="*" />
|
||||||
<ColumnDefinition x:Name="RightPaddingColumn" Width="0"/>
|
<ColumnDefinition x:Name="RightPaddingColumn" Width="0" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Image
|
<Image
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Source="../Assets/FileLocksmith/Icon.ico"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Width="16"
|
Width="16"
|
||||||
Height="16"/>
|
Height="16"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Source="../Assets/FileLocksmith/Icon.ico" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
x:Name="AppTitleTextBlock"
|
x:Name="AppTitleTextBlock"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<winuiex:WindowEx
|
<winuiex:WindowEx
|
||||||
x:Class="Hosts.MainWindow"
|
x:Class="Hosts.MainWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
@ -20,24 +20,27 @@
|
|||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid x:Name="titleBar" Height="32" ColumnSpacing="16">
|
<Grid
|
||||||
|
x:Name="titleBar"
|
||||||
|
Height="32"
|
||||||
|
ColumnSpacing="16">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition x:Name="LeftPaddingColumn" Width="0"/>
|
<ColumnDefinition x:Name="LeftPaddingColumn" Width="0" />
|
||||||
<ColumnDefinition x:Name="IconColumn" Width="Auto"/>
|
<ColumnDefinition x:Name="IconColumn" Width="Auto" />
|
||||||
<ColumnDefinition x:Name="TitleColumn" Width="Auto"/>
|
<ColumnDefinition x:Name="TitleColumn" Width="Auto" />
|
||||||
<ColumnDefinition x:Name="RightPaddingColumn" Width="0"/>
|
<ColumnDefinition x:Name="RightPaddingColumn" Width="0" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Image
|
<Image
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Source="../Assets/Hosts/Hosts.ico"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Width="16"
|
Width="16"
|
||||||
Height="16"/>
|
Height="16"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Source="../Assets/Hosts/Hosts.ico" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
x:Name="AppTitleTextBlock"
|
x:Name="AppTitleTextBlock"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Style="{StaticResource CaptionTextBlockStyle}"
|
VerticalAlignment="Center"
|
||||||
VerticalAlignment="Center" />
|
Style="{StaticResource CaptionTextBlockStyle}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<views:MainPage Grid.Row="1" />
|
<views:MainPage Grid.Row="1" />
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<Page
|
<Page
|
||||||
x:Class="Hosts.Views.MainPage"
|
x:Class="Hosts.Views.MainPage"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
@ -169,8 +169,8 @@
|
|||||||
GotFocus="Entries_GotFocus"
|
GotFocus="Entries_GotFocus"
|
||||||
IsItemClickEnabled="True"
|
IsItemClickEnabled="True"
|
||||||
ItemClick="Entries_ItemClick"
|
ItemClick="Entries_ItemClick"
|
||||||
RightTapped="Entries_RightTapped"
|
|
||||||
ItemsSource="{x:Bind ViewModel.Entries, Mode=TwoWay}"
|
ItemsSource="{x:Bind ViewModel.Entries, Mode=TwoWay}"
|
||||||
|
RightTapped="Entries_RightTapped"
|
||||||
SelectedItem="{x:Bind ViewModel.Selected, Mode=TwoWay}">
|
SelectedItem="{x:Bind ViewModel.Selected, Mode=TwoWay}">
|
||||||
<ListView.ContextFlyout>
|
<ListView.ContextFlyout>
|
||||||
<MenuFlyout>
|
<MenuFlyout>
|
||||||
@ -180,8 +180,8 @@
|
|||||||
Icon="Edit">
|
Icon="Edit">
|
||||||
<MenuFlyoutItem.KeyboardAccelerators>
|
<MenuFlyoutItem.KeyboardAccelerators>
|
||||||
<KeyboardAccelerator
|
<KeyboardAccelerator
|
||||||
Modifiers="Control"
|
|
||||||
Key="E"
|
Key="E"
|
||||||
|
Modifiers="Control"
|
||||||
ScopeOwner="{x:Bind Entries}" />
|
ScopeOwner="{x:Bind Entries}" />
|
||||||
</MenuFlyoutItem.KeyboardAccelerators>
|
</MenuFlyoutItem.KeyboardAccelerators>
|
||||||
</MenuFlyoutItem>
|
</MenuFlyoutItem>
|
||||||
@ -191,8 +191,8 @@
|
|||||||
Icon="TwoBars">
|
Icon="TwoBars">
|
||||||
<MenuFlyoutItem.KeyboardAccelerators>
|
<MenuFlyoutItem.KeyboardAccelerators>
|
||||||
<KeyboardAccelerator
|
<KeyboardAccelerator
|
||||||
Modifiers="Control"
|
|
||||||
Key="P"
|
Key="P"
|
||||||
|
Modifiers="Control"
|
||||||
ScopeOwner="{x:Bind Entries}" />
|
ScopeOwner="{x:Bind Entries}" />
|
||||||
</MenuFlyoutItem.KeyboardAccelerators>
|
</MenuFlyoutItem.KeyboardAccelerators>
|
||||||
</MenuFlyoutItem>
|
</MenuFlyoutItem>
|
||||||
@ -218,9 +218,7 @@
|
|||||||
Click="Delete_Click"
|
Click="Delete_Click"
|
||||||
Icon="Delete">
|
Icon="Delete">
|
||||||
<MenuFlyoutItem.KeyboardAccelerators>
|
<MenuFlyoutItem.KeyboardAccelerators>
|
||||||
<KeyboardAccelerator
|
<KeyboardAccelerator Key="Delete" ScopeOwner="{x:Bind Entries}" />
|
||||||
Key="Delete"
|
|
||||||
ScopeOwner="{x:Bind Entries}" />
|
|
||||||
</MenuFlyoutItem.KeyboardAccelerators>
|
</MenuFlyoutItem.KeyboardAccelerators>
|
||||||
</MenuFlyoutItem>
|
</MenuFlyoutItem>
|
||||||
</MenuFlyout>
|
</MenuFlyout>
|
||||||
@ -232,11 +230,16 @@
|
|||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
ColumnSpacing="8">
|
ColumnSpacing="8">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="256"/> <!-- Address -->
|
<ColumnDefinition Width="256" />
|
||||||
<ColumnDefinition Width="*"/> <!-- Comment -->
|
<!-- Address -->
|
||||||
<ColumnDefinition Width="Auto"/> <!-- Status -->
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="Auto"/> <!-- Duplicate -->
|
<!-- Comment -->
|
||||||
<ColumnDefinition Width="Auto"/> <!-- ToggleSwitch -->
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<!-- Status -->
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<!-- Duplicate -->
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<!-- ToggleSwitch -->
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
@ -371,9 +374,9 @@
|
|||||||
<InfoBar
|
<InfoBar
|
||||||
x:Uid="FileSaveError"
|
x:Uid="FileSaveError"
|
||||||
Margin="0,8,0,0"
|
Margin="0,8,0,0"
|
||||||
Severity="Error"
|
|
||||||
Message="{x:Bind ViewModel.ErrorMessage, Mode=TwoWay}"
|
|
||||||
IsOpen="{x:Bind ViewModel.Error, Mode=TwoWay}"
|
IsOpen="{x:Bind ViewModel.Error, Mode=TwoWay}"
|
||||||
|
Message="{x:Bind ViewModel.ErrorMessage, Mode=TwoWay}"
|
||||||
|
Severity="Error"
|
||||||
Visibility="{x:Bind ViewModel.Error, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}}" />
|
Visibility="{x:Bind ViewModel.Error, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||||
<InfoBar
|
<InfoBar
|
||||||
x:Uid="FileChanged"
|
x:Uid="FileChanged"
|
||||||
@ -397,8 +400,8 @@
|
|||||||
<ContentDialog
|
<ContentDialog
|
||||||
x:Name="EntryDialog"
|
x:Name="EntryDialog"
|
||||||
x:Uid="EntryDialog"
|
x:Uid="EntryDialog"
|
||||||
Loaded="ContentDialog_Loaded_ApplyMargin"
|
|
||||||
IsPrimaryButtonEnabled="{Binding Valid, Mode=OneWay}"
|
IsPrimaryButtonEnabled="{Binding Valid, Mode=OneWay}"
|
||||||
|
Loaded="ContentDialog_Loaded_ApplyMargin"
|
||||||
PrimaryButtonStyle="{StaticResource AccentButtonStyle}">
|
PrimaryButtonStyle="{StaticResource AccentButtonStyle}">
|
||||||
<ContentDialog.DataContext>
|
<ContentDialog.DataContext>
|
||||||
<models:Entry />
|
<models:Entry />
|
||||||
|
@ -239,7 +239,7 @@
|
|||||||
<comment>"Hosts" refers to the system hosts file, do not loc</comment>
|
<comment>"Hosts" refers to the system hosts file, do not loc</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="Hosts.[using:Microsoft.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
<data name="Hosts.[using:Microsoft.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||||
<value>Seperate multiple hosts by space (e.g. server server.local). Maximum 9 hosts per entry.</value>
|
<value>Separate multiple hosts by space (e.g. server server.local). Maximum 9 hosts per entry.</value>
|
||||||
<comment>Do not localize "server" and "server.local"</comment>
|
<comment>Do not localize "server" and "server.local"</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="HostsFilter.Header" xml:space="preserve">
|
<data name="HostsFilter.Header" xml:space="preserve">
|
||||||
|
@ -73,7 +73,7 @@ namespace
|
|||||||
result.hwnd = active_window;
|
result.hwnd = active_window;
|
||||||
// In reality, Windows Snap works if even one of those styles is set
|
// In reality, Windows Snap works if even one of those styles is set
|
||||||
// for a window, it is just limited. If there is no WS_MAXIMIZEBOX using
|
// for a window, it is just limited. If there is no WS_MAXIMIZEBOX using
|
||||||
// WinKey + Up just won't maximize the window. Similary, without
|
// WinKey + Up just won't maximize the window. Similarly, without
|
||||||
// WS_MINIMIZEBOX the window will not get minimized. A "Save As..." dialog
|
// WS_MINIMIZEBOX the window will not get minimized. A "Save As..." dialog
|
||||||
// is a example of such window - it can be snapped to both sides and to
|
// is a example of such window - it can be snapped to both sides and to
|
||||||
// all screen corners, but will not get maximized nor minimized.
|
// all screen corners, but will not get maximized nor minimized.
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <FancyZonesLib/VirtualDesktop.h>
|
#include <FancyZonesLib/VirtualDesktop.h>
|
||||||
#include <FancyZonesLib/WindowKeyboardSnap.h>
|
#include <FancyZonesLib/WindowKeyboardSnap.h>
|
||||||
#include <FancyZonesLib/WindowMouseSnap.h>
|
#include <FancyZonesLib/WindowMouseSnap.h>
|
||||||
|
#include <FancyZonesLib/WindowUtils.h>
|
||||||
#include <FancyZonesLib/WorkArea.h>
|
#include <FancyZonesLib/WorkArea.h>
|
||||||
#include <FancyZonesLib/WorkAreaConfiguration.h>
|
#include <FancyZonesLib/WorkAreaConfiguration.h>
|
||||||
|
|
||||||
@ -394,6 +395,15 @@ void FancyZones::WindowCreated(HWND window) noexcept
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hotfix
|
||||||
|
// Avoid automatically moving popup windows, as they can be just popup menus.
|
||||||
|
bool isPopup = FancyZonesWindowUtils::IsPopupWindow(window);
|
||||||
|
bool hasThickFrame = FancyZonesWindowUtils::HasThickFrame(window);
|
||||||
|
if (isPopup && !hasThickFrame)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Avoid already stamped (zoned) windows
|
// Avoid already stamped (zoned) windows
|
||||||
const bool isZoned = !FancyZonesWindowProperties::RetrieveZoneIndexProperty(window).empty();
|
const bool isZoned = !FancyZonesWindowProperties::RetrieveZoneIndexProperty(window).empty();
|
||||||
if (isZoned)
|
if (isZoned)
|
||||||
|
@ -192,6 +192,12 @@ bool FancyZonesWindowUtils::IsPopupWindow(HWND window) noexcept
|
|||||||
return ((style & WS_POPUP) == WS_POPUP);
|
return ((style & WS_POPUP) == WS_POPUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FancyZonesWindowUtils::HasThickFrame(HWND window) noexcept
|
||||||
|
{
|
||||||
|
auto style = GetWindowLong(window, GWL_STYLE);
|
||||||
|
return ((style & WS_THICKFRAME) == WS_THICKFRAME);
|
||||||
|
}
|
||||||
|
|
||||||
bool FancyZonesWindowUtils::HasThickFrameAndMinimizeMaximizeButtons(HWND window) noexcept
|
bool FancyZonesWindowUtils::HasThickFrameAndMinimizeMaximizeButtons(HWND window) noexcept
|
||||||
{
|
{
|
||||||
auto style = GetWindowLong(window, GWL_STYLE);
|
auto style = GetWindowLong(window, GWL_STYLE);
|
||||||
|
@ -20,6 +20,7 @@ namespace FancyZonesWindowUtils
|
|||||||
bool HasVisibleOwner(HWND window) noexcept;
|
bool HasVisibleOwner(HWND window) noexcept;
|
||||||
bool IsStandardWindow(HWND window);
|
bool IsStandardWindow(HWND window);
|
||||||
bool IsPopupWindow(HWND window) noexcept;
|
bool IsPopupWindow(HWND window) noexcept;
|
||||||
|
bool HasThickFrame(HWND window) noexcept;
|
||||||
bool HasThickFrameAndMinimizeMaximizeButtons(HWND window) noexcept;
|
bool HasThickFrameAndMinimizeMaximizeButtons(HWND window) noexcept;
|
||||||
bool IsProcessOfWindowElevated(HWND window); // If HWND is already dead, we assume it wasn't elevated
|
bool IsProcessOfWindowElevated(HWND window); // If HWND is already dead, we assume it wasn't elevated
|
||||||
|
|
||||||
|
@ -13,10 +13,10 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1101:PrefixLocalCallsWithThis", Justification = "We follow the C# Core Coding Style which avoids using `this` unless absolutely necessary.")]
|
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1101:PrefixLocalCallsWithThis", Justification = "We follow the C# Core Coding Style which avoids using `this` unless absolutely necessary.")]
|
||||||
|
|
||||||
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1200:UsingDirectivesMustBePlacedWithinNamespace", Justification = "We follow the C# Core Coding Style which puts using statements outside the namespace.")]
|
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1200:UsingDirectivesMustBePlacedWithinNamespace", Justification = "We follow the C# Core Coding Style which puts using statements outside the namespace.")]
|
||||||
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1201:ElementsMustAppearInTheCorrectOrder", Justification = "It is not a priority and have hight impact in code changes.")]
|
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1201:ElementsMustAppearInTheCorrectOrder", Justification = "It is not a priority and has a high impact in code changes.")]
|
||||||
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1202:ElementsMustBeOrderedByAccess", Justification = "It is not a priority and have hight impact in code changes.")]
|
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1202:ElementsMustBeOrderedByAccess", Justification = "It is not a priority and has a high impact in code changes.")]
|
||||||
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1203:ConstantsMustAppearBeforeFields", Justification = "It is not a priority and have hight impact in code changes.")]
|
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1203:ConstantsMustAppearBeforeFields", Justification = "It is not a priority and has a high impact in code changes.")]
|
||||||
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1204:StaticElementsMustAppearBeforeInstanceElements", Justification = "It is not a priority and have hight impact in code changes.")]
|
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1204:StaticElementsMustAppearBeforeInstanceElements", Justification = "It is not a priority and has a high impact in code changes.")]
|
||||||
|
|
||||||
[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1309:FieldNamesMustNotBeginWithUnderscore", Justification = "We follow the C# Core Coding Style which uses underscores as prefixes rather than using `this.`.")]
|
[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1309:FieldNamesMustNotBeginWithUnderscore", Justification = "We follow the C# Core Coding Style which uses underscores as prefixes rather than using `this.`.")]
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
<Application x:Class="ImageResizer.App"
|
<Application
|
||||||
|
x:Class="ImageResizer.App"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:m="clr-namespace:ImageResizer.Models"
|
xmlns:m="clr-namespace:ImageResizer.Models"
|
||||||
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
|
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
|
||||||
xmlns:v="clr-namespace:ImageResizer.Views"
|
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml">
|
xmlns:v="clr-namespace:ImageResizer.Views">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
@ -12,27 +13,29 @@
|
|||||||
<ui:ControlsDictionary />
|
<ui:ControlsDictionary />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
<ObjectDataProvider x:Key="ResizeFitValues"
|
<ObjectDataProvider
|
||||||
|
x:Key="ResizeFitValues"
|
||||||
MethodName="GetValues"
|
MethodName="GetValues"
|
||||||
ObjectType="sys:Enum">
|
ObjectType="sys:Enum">
|
||||||
<ObjectDataProvider.MethodParameters>
|
<ObjectDataProvider.MethodParameters>
|
||||||
<x:Type Type="{x:Type m:ResizeFit}"/>
|
<x:Type Type="{x:Type m:ResizeFit}" />
|
||||||
</ObjectDataProvider.MethodParameters>
|
</ObjectDataProvider.MethodParameters>
|
||||||
</ObjectDataProvider>
|
</ObjectDataProvider>
|
||||||
|
|
||||||
<ObjectDataProvider x:Key="ResizeUnitValues"
|
<ObjectDataProvider
|
||||||
|
x:Key="ResizeUnitValues"
|
||||||
MethodName="GetValues"
|
MethodName="GetValues"
|
||||||
ObjectType="sys:Enum">
|
ObjectType="sys:Enum">
|
||||||
<ObjectDataProvider.MethodParameters>
|
<ObjectDataProvider.MethodParameters>
|
||||||
<x:Type Type="{x:Type m:ResizeUnit}"/>
|
<x:Type Type="{x:Type m:ResizeUnit}" />
|
||||||
</ObjectDataProvider.MethodParameters>
|
</ObjectDataProvider.MethodParameters>
|
||||||
</ObjectDataProvider>
|
</ObjectDataProvider>
|
||||||
|
|
||||||
<v:SizeTypeToVisibilityConverter x:Key="SizeTypeToVisibilityConverter"/>
|
<v:SizeTypeToVisibilityConverter x:Key="SizeTypeToVisibilityConverter" />
|
||||||
<v:EnumValueConverter x:Key="EnumValueConverter"/>
|
<v:EnumValueConverter x:Key="EnumValueConverter" />
|
||||||
<v:AutoDoubleConverter x:Key="AutoDoubleConverter"/>
|
<v:AutoDoubleConverter x:Key="AutoDoubleConverter" />
|
||||||
<v:BoolValueConverter x:Key="BoolValueConverter"/>
|
<v:BoolValueConverter x:Key="BoolValueConverter" />
|
||||||
<v:VisibilityBoolConverter x:Key="VisibilityBoolConverter"/>
|
<v:VisibilityBoolConverter x:Key="VisibilityBoolConverter" />
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
|
@ -183,7 +183,7 @@ namespace ImageResizer.Extensions
|
|||||||
/// Prints all metadata to debug console
|
/// Prints all metadata to debug console
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Intented for debug only!!!
|
/// Intended for debug only!!!
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public static void PrintsAllMetadataToDebugOutput(this BitmapMetadata metadata)
|
public static void PrintsAllMetadataToDebugOutput(this BitmapMetadata metadata)
|
||||||
{
|
{
|
||||||
@ -205,7 +205,7 @@ namespace ImageResizer.Extensions
|
|||||||
/// Iterates recursively through all metadata
|
/// Iterates recursively through all metadata
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Intented for debug only!!!
|
/// Intended for debug only!!!
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public static List<(string MetadataPath, object Value)> GetListOfMetadataForDebug(this BitmapMetadata metadata)
|
public static List<(string MetadataPath, object Value)> GetListOfMetadataForDebug(this BitmapMetadata metadata)
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,10 @@
|
|||||||
SelectedIndex="{Binding Settings.SelectedSizeIndex}">
|
SelectedIndex="{Binding Settings.SelectedSizeIndex}">
|
||||||
<ComboBox.Resources>
|
<ComboBox.Resources>
|
||||||
<DataTemplate DataType="{x:Type m:ResizeSize}">
|
<DataTemplate DataType="{x:Type m:ResizeSize}">
|
||||||
<Grid Margin="2,0,0,0" VerticalAlignment="Center" AutomationProperties.Name="{Binding Name}">
|
<Grid
|
||||||
|
Margin="2,0,0,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
AutomationProperties.Name="{Binding Name}">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
@ -67,9 +70,7 @@
|
|||||||
|
|
||||||
<DataTemplate DataType="{x:Type m:CustomSize}">
|
<DataTemplate DataType="{x:Type m:CustomSize}">
|
||||||
<Grid VerticalAlignment="Center" AutomationProperties.Name="{Binding Name}">
|
<Grid VerticalAlignment="Center" AutomationProperties.Name="{Binding Name}">
|
||||||
<TextBlock
|
<TextBlock FontWeight="SemiBold" Text="{Binding Name}" />
|
||||||
FontWeight="SemiBold"
|
|
||||||
Text="{Binding Name}" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.Resources>
|
</ComboBox.Resources>
|
||||||
|
@ -43,7 +43,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
// For debugging you can set the second parameter to true to see more informations.
|
// For debugging you can set the second parameter to true to see more information.
|
||||||
ToolTipData = GetToolTip(x.Result, false),
|
ToolTipData = GetToolTip(x.Result, false),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ namespace Microsoft.Plugin.WindowWalker.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Folder windows doesn't run in separate processes. (Klick to open Explorer properties.).
|
/// Looks up a localized string similar to Folder windows doesn't run in separate processes. (Click to open Explorer properties.).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string wox_plugin_windowwalker_ExplorerInfoSubTitle {
|
public static string wox_plugin_windowwalker_ExplorerInfoSubTitle {
|
||||||
get {
|
get {
|
||||||
|
@ -22,7 +22,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
|||||||
/// Return a list with all context menu entries for the given <see cref="Result"/>
|
/// Return a list with all context menu entries for the given <see cref="Result"/>
|
||||||
/// <para>Symbols taken from <see href="https://learn.microsoft.com/windows/uwp/design/style/segoe-ui-symbol-font"/></para>
|
/// <para>Symbols taken from <see href="https://learn.microsoft.com/windows/uwp/design/style/segoe-ui-symbol-font"/></para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="result">The result for the context menu entires</param>
|
/// <param name="result">The result for the context menu entries</param>
|
||||||
/// <param name="assemblyName">The name of the this assembly</param>
|
/// <param name="assemblyName">The name of the this assembly</param>
|
||||||
/// <returns>A list with context menu entries</returns>
|
/// <returns>A list with context menu entries</returns>
|
||||||
internal static List<ContextMenuResult> GetContextMenu(Result result, string assemblyName)
|
internal static List<ContextMenuResult> GetContextMenu(Result result, string assemblyName)
|
||||||
|
@ -15,7 +15,7 @@ using Microsoft.PowerToys.Run.Plugin.System.Properties;
|
|||||||
namespace Microsoft.PowerToys.Run.Plugin.System.Components
|
namespace Microsoft.PowerToys.Run.Plugin.System.Components
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This class represents the informations for a network connection/interface
|
/// This class represents the information for a network connection/interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class NetworkConnectionProperties
|
internal sealed class NetworkConnectionProperties
|
||||||
{
|
{
|
||||||
|
@ -124,7 +124,7 @@ namespace Microsoft.PowerToys.Run.Plugin.System
|
|||||||
// {
|
// {
|
||||||
// results.Add(new Result()
|
// results.Add(new Result()
|
||||||
// {
|
// {
|
||||||
// Title = "Getting network informations. Please wait ...",
|
// Title = "Getting network information. Please wait ...",
|
||||||
// IcoPath = $"Images\\networkAdapter.{IconTheme}.png",
|
// IcoPath = $"Images\\networkAdapter.{IconTheme}.png",
|
||||||
// Score = StringMatcher.FuzzySearch("address", "ip address").Score,
|
// Score = StringMatcher.FuzzySearch("address", "ip address").Score,
|
||||||
// });
|
// });
|
||||||
|
@ -59,7 +59,7 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.Components
|
|||||||
|
|
||||||
if (isKeywordSearch || !TimeDateSettings.Instance.OnlyDateTimeNowGlobal)
|
if (isKeywordSearch || !TimeDateSettings.Instance.OnlyDateTimeNowGlobal)
|
||||||
{
|
{
|
||||||
// We use long instead of int for unix time stamp because int ist to small after 03:14:07 UTC 2038-01-19
|
// We use long instead of int for unix time stamp because int is too small after 03:14:07 UTC 2038-01-19
|
||||||
long unixTimestamp = (long)dateTimeNowUtc.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
long unixTimestamp = (long)dateTimeNowUtc.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||||
int weekOfYear = calendar.GetWeekOfYear(dateTimeNow, DateTimeFormatInfo.CurrentInfo.CalendarWeekRule, DateTimeFormatInfo.CurrentInfo.FirstDayOfWeek);
|
int weekOfYear = calendar.GetWeekOfYear(dateTimeNow, DateTimeFormatInfo.CurrentInfo.CalendarWeekRule, DateTimeFormatInfo.CurrentInfo.FirstDayOfWeek);
|
||||||
string era = DateTimeFormatInfo.CurrentInfo.GetEraName(calendar.GetEra(dateTimeNow));
|
string era = DateTimeFormatInfo.CurrentInfo.GetEraName(calendar.GetEra(dateTimeNow));
|
||||||
|
@ -99,7 +99,7 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.Components
|
|||||||
else if (Regex.IsMatch(input, @"^u\d+") && input.Length <= 12 && long.TryParse(input.TrimStart('u'), out long secondsInt))
|
else if (Regex.IsMatch(input, @"^u\d+") && input.Length <= 12 && long.TryParse(input.TrimStart('u'), out long secondsInt))
|
||||||
{
|
{
|
||||||
// unix time stamp
|
// unix time stamp
|
||||||
// we use long instead of int because int ist to small after 03:14:07 UTC 2038-01-19
|
// we use long instead of int because int is too small after 03:14:07 UTC 2038-01-19
|
||||||
timestamp = new DateTime(1970, 1, 1).AddSeconds(secondsInt).ToLocalTime();
|
timestamp = new DateTime(1970, 1, 1).AddSeconds(secondsInt).ToLocalTime();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
|
|||||||
/// Return a list with all context menu entries for the given <see cref="Result"/>
|
/// Return a list with all context menu entries for the given <see cref="Result"/>
|
||||||
/// <para>Symbols taken from <see href="https://learn.microsoft.com/windows/uwp/design/style/segoe-ui-symbol-font"/></para>
|
/// <para>Symbols taken from <see href="https://learn.microsoft.com/windows/uwp/design/style/segoe-ui-symbol-font"/></para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="result">The result for the context menu entires</param>
|
/// <param name="result">The result for the context menu entries</param>
|
||||||
/// <param name="assemblyName">The name of the this assembly</param>
|
/// <param name="assemblyName">The name of the this assembly</param>
|
||||||
/// <returns>A list with context menu entries</returns>
|
/// <returns>A list with context menu entries</returns>
|
||||||
internal static List<ContextMenuResult> GetContextMenu(in Result result, in string assemblyName)
|
internal static List<ContextMenuResult> GetContextMenu(in Result result, in string assemblyName)
|
||||||
|
@ -67,7 +67,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a tool-tip to the given <see cref="Result"/>, based o the given <see cref="IWindowsSetting"/>.
|
/// Add a tool-tip to the given <see cref="Result"/>, based o the given <see cref="IWindowsSetting"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="entry">The <see cref="WindowsSetting"/> that contain informations for the tool-tip.</param>
|
/// <param name="entry">The <see cref="WindowsSetting"/> that contains information for the tool-tip.</param>
|
||||||
/// <param name="result">The <see cref="Result"/> that need a tool-tip.</param>
|
/// <param name="result">The <see cref="Result"/> that need a tool-tip.</param>
|
||||||
private static void AddOptionalToolTip(WindowsSetting entry, Result result)
|
private static void AddOptionalToolTip(WindowsSetting entry, Result result)
|
||||||
{
|
{
|
||||||
|
@ -214,7 +214,7 @@ namespace PowerLauncher.Helper
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the variables for the specified target. Errors that occurs will be catched and logged.
|
/// Returns the variables for the specified target. Errors that occurs will be caught and logged.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="target">The target variable source of the type <see cref="EnvironmentVariableTarget"/> </param>
|
/// <param name="target">The target variable source of the type <see cref="EnvironmentVariableTarget"/> </param>
|
||||||
/// <returns>A dictionary with the variable or an empty dictionary on errors.</returns>
|
/// <returns>A dictionary with the variable or an empty dictionary on errors.</returns>
|
||||||
|
@ -39,7 +39,7 @@ namespace PowerLauncher.Plugin
|
|||||||
|
|
||||||
private static void ParsePluginConfigs(IEnumerable<string> directories)
|
private static void ParsePluginConfigs(IEnumerable<string> directories)
|
||||||
{
|
{
|
||||||
// todo use linq when diable plugin is implemented since parallel.foreach + list is not thread saft
|
// todo use linq when disable plugin is implemented since parallel.foreach + list is not thread saft
|
||||||
foreach (var directory in directories)
|
foreach (var directory in directories)
|
||||||
{
|
{
|
||||||
if (File.Exists(Path.Combine(directory, "NeedDelete.txt")))
|
if (File.Exists(Path.Combine(directory, "NeedDelete.txt")))
|
||||||
|
@ -1059,7 +1059,6 @@ namespace PowerLauncher.ViewModel
|
|||||||
{
|
{
|
||||||
if (contextMenuItems.AcceleratorKey == acceleratorKey && contextMenuItems.AcceleratorModifiers == acceleratorModifiers)
|
if (contextMenuItems.AcceleratorKey == acceleratorKey && contextMenuItems.AcceleratorModifiers == acceleratorModifiers)
|
||||||
{
|
{
|
||||||
MainWindowVisibility = Visibility.Collapsed;
|
|
||||||
contextMenuItems.Command.Execute(null);
|
contextMenuItems.Command.Execute(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace Wox.Plugin.Common.VirtualDesktop.Helper
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper class to work with Virtual Desktops.
|
/// Helper class to work with Virtual Desktops.
|
||||||
/// This helper uses only public available and documented COM-Interfaces or informations from registry.
|
/// This helper uses only public available and documented COM-Interfaces or information from registry.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// To use this helper you have to create an instance of it and access the method via the helper instance.
|
/// To use this helper you have to create an instance of it and access the method via the helper instance.
|
||||||
|
@ -1077,7 +1077,7 @@ namespace Wox.Plugin.Common.Win32
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The window itself contains child windows that should take part in dialog box, navigation. If this
|
/// The window itself contains child windows that should take part in dialog box, navigation. If this
|
||||||
/// style is specified, the dialog manager recurses into children of this window when performing
|
/// style is specified, the dialog manager recurses into children of this window when performing
|
||||||
/// navigation operations such as handling tha TAB key, an arrow key, or a keyboard mnemonic.
|
/// navigation operations such as handling the TAB key, an arrow key, or a keyboard mnemonic.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
WS_EX_CONTROLPARENT = 0x10000,
|
WS_EX_CONTROLPARENT = 0x10000,
|
||||||
|
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
namespace Peek.Common.Helpers
|
namespace Peek.Common.Helpers
|
||||||
{
|
{
|
||||||
public static class MathHelper
|
public static class MathHelper
|
||||||
@ -10,5 +13,10 @@ namespace Peek.Common.Helpers
|
|||||||
{
|
{
|
||||||
return a < 0 ? ((a % b) + b) % b : a % b;
|
return a < 0 ? ((a % b) + b) % b : a % b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int NumberOfDigits(int num)
|
||||||
|
{
|
||||||
|
return Math.Abs(num).ToString(CultureInfo.InvariantCulture).Length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ namespace Peek.Common.Helpers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The file/folder path</param>
|
/// <param name="path">The file/folder path</param>
|
||||||
/// <param name="flags">The property store flags</param>
|
/// <param name="flags">The property store flags</param>
|
||||||
/// <returns>an IPropertyStroe interface</returns>
|
/// <returns>an IPropertyStore interface</returns>
|
||||||
private static DisposablePropertyStore GetPropertyStoreFromPath(string path, GETPROPERTYSTOREFLAGS flags = GETPROPERTYSTOREFLAGS.GPS_EXTRINSICPROPERTIES | GETPROPERTYSTOREFLAGS.GPS_BESTEFFORT)
|
private static DisposablePropertyStore GetPropertyStoreFromPath(string path, GETPROPERTYSTOREFLAGS flags = GETPROPERTYSTOREFLAGS.GPS_EXTRINSICPROPERTIES | GETPROPERTYSTOREFLAGS.GPS_BESTEFFORT)
|
||||||
{
|
{
|
||||||
IShellItem2? shellItem2 = null;
|
IShellItem2? shellItem2 = null;
|
||||||
|
@ -10,34 +10,40 @@ namespace Peek.Common.Helpers
|
|||||||
{
|
{
|
||||||
public static class ReadableStringHelper
|
public static class ReadableStringHelper
|
||||||
{
|
{
|
||||||
private const int DecimalPercision = 10;
|
private const int MaxDigitsToDisplay = 3;
|
||||||
|
private const int PowerFactor = 1024;
|
||||||
|
|
||||||
public static string BytesToReadableString(ulong bytes)
|
public static string BytesToReadableString(ulong bytes)
|
||||||
{
|
{
|
||||||
var resourceLoader = ResourceLoaderInstance.ResourceLoader;
|
string totalBytesDisplays = (bytes == 1) ?
|
||||||
List<string> format = new List<string>
|
ResourceLoaderInstance.ResourceLoader.GetString("ReadableString_ByteString") :
|
||||||
{
|
ResourceLoaderInstance.ResourceLoader.GetString("ReadableString_BytesString");
|
||||||
(bytes == 1) ?
|
|
||||||
resourceLoader.GetString("ReadableString_ByteAbbreviationFormat") : // "byte"
|
|
||||||
resourceLoader.GetString("ReadableString_BytesAbbreviationFormat"), // "bytes"
|
|
||||||
resourceLoader.GetString("ReadableString_KiloByteAbbreviationFormat"), // "KB"
|
|
||||||
resourceLoader.GetString("ReadableString_MegaByteAbbreviationFormat"), // "MB"
|
|
||||||
resourceLoader.GetString("ReadableString_GigaByteAbbreviationFormat"), // "GB"
|
|
||||||
resourceLoader.GetString("ReadableString_TeraByteAbbreviationFormat"), // "TB"
|
|
||||||
resourceLoader.GetString("ReadableString_PetaByteAbbreviationFormat"), // "PB"
|
|
||||||
resourceLoader.GetString("ReadableString_ExaByteAbbreviationFormat"), // "EB"
|
|
||||||
};
|
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
double number = 0.0;
|
double number = 0.0;
|
||||||
|
|
||||||
if (bytes > 0)
|
if (bytes > 0)
|
||||||
{
|
{
|
||||||
index = (int)Math.Floor(Math.Log(bytes) / Math.Log(1024));
|
index = (int)Math.Floor(Math.Log(bytes) / Math.Log(PowerFactor));
|
||||||
number = Math.Round((bytes / Math.Pow(1024, index)) * DecimalPercision) / DecimalPercision;
|
number = bytes / Math.Pow(PowerFactor, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
return string.Format(CultureInfo.InvariantCulture, format[index], number);
|
if (index > 0 && number >= Math.Pow(10, MaxDigitsToDisplay))
|
||||||
|
{
|
||||||
|
index++;
|
||||||
|
number = bytes / Math.Pow(PowerFactor, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
int precision = GetPrecision(index, number);
|
||||||
|
int decimalPrecision = (int)Math.Pow(10, precision);
|
||||||
|
|
||||||
|
number = Math.Truncate(number * decimalPrecision) / decimalPrecision;
|
||||||
|
|
||||||
|
string formatSpecifier = GetFormatSpecifierString(index, number, bytes, precision);
|
||||||
|
|
||||||
|
return bytes == 0
|
||||||
|
? string.Format(CultureInfo.CurrentCulture, formatSpecifier, number)
|
||||||
|
: string.Format(CultureInfo.CurrentCulture, formatSpecifier + totalBytesDisplays, number, bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string FormatResourceString(string resourceId, object? args)
|
public static string FormatResourceString(string resourceId, object? args)
|
||||||
@ -55,5 +61,32 @@ namespace Peek.Common.Helpers
|
|||||||
|
|
||||||
return formattedString;
|
return formattedString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int GetPrecision(int index, double number)
|
||||||
|
{
|
||||||
|
int numberOfDigits = MathHelper.NumberOfDigits((int)number);
|
||||||
|
return index == 0 ?
|
||||||
|
0 :
|
||||||
|
MaxDigitsToDisplay - numberOfDigits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetFormatSpecifierString(int index, double number, ulong bytes, int precision)
|
||||||
|
{
|
||||||
|
var resourceLoader = ResourceLoaderInstance.ResourceLoader;
|
||||||
|
List<string> format = new List<string>
|
||||||
|
{
|
||||||
|
(bytes == 1) ?
|
||||||
|
resourceLoader.GetString("ReadableString_ByteAbbreviationFormat") : // "byte"
|
||||||
|
resourceLoader.GetString("ReadableString_BytesAbbreviationFormat"), // "bytes"
|
||||||
|
resourceLoader.GetString("ReadableString_KiloByteAbbreviationFormat"), // "KB"
|
||||||
|
resourceLoader.GetString("ReadableString_MegaByteAbbreviationFormat"), // "MB"
|
||||||
|
resourceLoader.GetString("ReadableString_GigaByteAbbreviationFormat"), // "GB"
|
||||||
|
resourceLoader.GetString("ReadableString_TeraByteAbbreviationFormat"), // "TB"
|
||||||
|
resourceLoader.GetString("ReadableString_PetaByteAbbreviationFormat"), // "PB"
|
||||||
|
resourceLoader.GetString("ReadableString_ExaByteAbbreviationFormat"), // "EB"
|
||||||
|
};
|
||||||
|
|
||||||
|
return "{0:F" + precision + "} " + format[index];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,3 +3,8 @@ _SHCONTF
|
|||||||
SIGDN
|
SIGDN
|
||||||
SHGDNF
|
SHGDNF
|
||||||
SIATTRIBFLAGS
|
SIATTRIBFLAGS
|
||||||
|
IInitializeWithFile
|
||||||
|
IInitializeWithItem
|
||||||
|
IInitializeWithStream
|
||||||
|
IPreviewHandler
|
||||||
|
IPreviewHandlerVisuals
|
@ -1,46 +1,39 @@
|
|||||||
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
|
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
|
||||||
<!-- Licensed under the MIT License. See LICENSE in the project root for license information. -->
|
<!-- Licensed under the MIT License. See LICENSE in the project root for license information. -->
|
||||||
|
|
||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Peek.FilePreviewer.Controls.ArchiveControl"
|
x:Class="Peek.FilePreviewer.Controls.ArchiveControl"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="using:Peek.FilePreviewer.Controls"
|
xmlns:converters="using:Peek.Common.Converters"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="using:Peek.FilePreviewer.Controls"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:models="using:Peek.FilePreviewer.Previewers.Archives.Models"
|
xmlns:models="using:Peek.FilePreviewer.Previewers.Archives.Models"
|
||||||
xmlns:converters="using:Peek.Common.Converters"
|
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<DataTemplate
|
<DataTemplate x:Key="DirectoryTemplate" x:DataType="models:ArchiveItem">
|
||||||
x:Key="DirectoryTemplate"
|
|
||||||
x:DataType="models:ArchiveItem">
|
|
||||||
<TreeViewItem
|
<TreeViewItem
|
||||||
AutomationProperties.Name="{x:Bind Name}"
|
AutomationProperties.Name="{x:Bind Name}"
|
||||||
ItemsSource="{x:Bind Children}"
|
IsExpanded="{x:Bind IsExpanded}"
|
||||||
IsExpanded="{x:Bind IsExpanded}">
|
ItemsSource="{x:Bind Children}">
|
||||||
<Grid ColumnSpacing="10">
|
<Grid ColumnSpacing="10">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="auto" />
|
<ColumnDefinition Width="auto" />
|
||||||
<ColumnDefinition Width="auto" />
|
<ColumnDefinition Width="auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Image
|
<Image
|
||||||
|
Grid.Column="0"
|
||||||
Width="16"
|
Width="16"
|
||||||
Height="16"
|
Height="16"
|
||||||
Grid.Column="0"
|
|
||||||
Source="{x:Bind Icon}" />
|
Source="{x:Bind Icon}" />
|
||||||
<TextBlock
|
<TextBlock Grid.Column="1" Text="{x:Bind Name}" />
|
||||||
Grid.Column="1"
|
|
||||||
Text="{x:Bind Name}" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</TreeViewItem>
|
</TreeViewItem>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
||||||
<DataTemplate
|
<DataTemplate x:Key="FileTemplate" x:DataType="models:ArchiveItem">
|
||||||
x:Key="FileTemplate"
|
<TreeViewItem AutomationProperties.Name="{x:Bind Name}">
|
||||||
x:DataType="models:ArchiveItem">
|
|
||||||
<TreeViewItem
|
|
||||||
AutomationProperties.Name="{x:Bind Name}">
|
|
||||||
<Grid ColumnSpacing="10">
|
<Grid ColumnSpacing="10">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="auto" />
|
<ColumnDefinition Width="auto" />
|
||||||
@ -48,13 +41,11 @@
|
|||||||
<ColumnDefinition Width="auto" />
|
<ColumnDefinition Width="auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Image
|
<Image
|
||||||
|
Grid.Column="0"
|
||||||
Width="16"
|
Width="16"
|
||||||
Height="16"
|
Height="16"
|
||||||
Grid.Column="0"
|
|
||||||
Source="{x:Bind Icon}" />
|
Source="{x:Bind Icon}" />
|
||||||
<TextBlock
|
<TextBlock Grid.Column="1" Text="{x:Bind Name}" />
|
||||||
Grid.Column="1"
|
|
||||||
Text="{x:Bind Name}" />
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||||
@ -75,29 +66,25 @@
|
|||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="auto" />
|
<RowDefinition Height="auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<ScrollViewer
|
<ScrollViewer Grid.Row="0" HorizontalScrollBarVisibility="Auto">
|
||||||
Grid.Row="0"
|
|
||||||
HorizontalScrollBarVisibility="Auto">
|
|
||||||
<TreeView
|
<TreeView
|
||||||
x:Name="ArchivePreview"
|
x:Name="ArchivePreview"
|
||||||
ItemsSource="{x:Bind Source, Mode=OneWay}"
|
CanDragItems="False"
|
||||||
ItemTemplateSelector="{StaticResource ArchiveItemTemplateSelector}"
|
|
||||||
SelectionMode="None"
|
|
||||||
CanReorderItems="False"
|
CanReorderItems="False"
|
||||||
CanDragItems="False" />
|
ItemTemplateSelector="{StaticResource ArchiveItemTemplateSelector}"
|
||||||
|
ItemsSource="{x:Bind Source, Mode=OneWay}"
|
||||||
|
SelectionMode="None" />
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
<Border
|
<Border
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
MinWidth="300"
|
MinWidth="300"
|
||||||
|
Margin="16"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
|
||||||
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
|
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
CornerRadius="8"
|
CornerRadius="8">
|
||||||
Margin="16"
|
<Grid Padding="16" ColumnSpacing="16">
|
||||||
HorizontalAlignment="Center">
|
|
||||||
<Grid
|
|
||||||
ColumnSpacing="16"
|
|
||||||
Padding="16">
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="auto" />
|
<ColumnDefinition Width="auto" />
|
||||||
@ -107,29 +94,29 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Text="{x:Bind DirectoryCount, Mode=OneWay}"
|
|
||||||
IsTextSelectionEnabled="True"
|
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
IsTextSelectionEnabled="True"
|
||||||
|
Text="{x:Bind DirectoryCount, Mode=OneWay}"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
<Border
|
<Border
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
BorderBrush="{ThemeResource TextFillColorPrimaryBrush}"
|
BorderBrush="{ThemeResource TextFillColorPrimaryBrush}"
|
||||||
BorderThickness="0 0 1 0" />
|
BorderThickness="0,0,1,0" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Text="{x:Bind FileCount, Mode=OneWay}"
|
|
||||||
IsTextSelectionEnabled="True"
|
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
IsTextSelectionEnabled="True"
|
||||||
|
Text="{x:Bind FileCount, Mode=OneWay}"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
<Border
|
<Border
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
BorderBrush="{ThemeResource TextFillColorPrimaryBrush}"
|
BorderBrush="{ThemeResource TextFillColorPrimaryBrush}"
|
||||||
BorderThickness="0 0 1 0" />
|
BorderThickness="0,0,1,0" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="4"
|
Grid.Column="4"
|
||||||
Text="{x:Bind Size, Mode=OneWay}"
|
|
||||||
IsTextSelectionEnabled="True"
|
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
IsTextSelectionEnabled="True"
|
||||||
|
Text="{x:Bind Size, Mode=OneWay}"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
|
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
|
||||||
<!-- Licensed under the MIT License. See LICENSE in the project root for license information. -->
|
<!-- Licensed under the MIT License. See LICENSE in the project root for license information. -->
|
||||||
|
|
||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Peek.FilePreviewer.Controls.BrowserControl"
|
x:Class="Peek.FilePreviewer.Controls.BrowserControl"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="using:Peek.FilePreviewer.Controls"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
|
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="using:Peek.FilePreviewer.Controls"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<controls:WebView2
|
<controls:WebView2
|
||||||
x:Name="PreviewBrowser"
|
x:Name="PreviewBrowser"
|
||||||
Loaded="PreviewWV2_Loaded"
|
Loaded="PreviewWV2_Loaded"
|
||||||
NavigationStarting="PreviewBrowser_NavigationStarting"
|
NavigationCompleted="PreviewWV2_NavigationCompleted"
|
||||||
NavigationCompleted="PreviewWV2_NavigationCompleted" />
|
NavigationStarting="PreviewBrowser_NavigationStarting" />
|
||||||
<ContentDialog
|
<ContentDialog
|
||||||
x:Name="OpenUriDialog"
|
x:Name="OpenUriDialog"
|
||||||
x:Uid="OpenUriDialog"
|
x:Uid="OpenUriDialog"
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
<!-- Copyright (c) Microsoft Corporation. All rights reserved. -->
|
||||||
|
<!-- Licensed under the MIT License. See LICENSE in the project root for license information. -->
|
||||||
|
|
||||||
|
<UserControl
|
||||||
|
x:Class="Peek.FilePreviewer.Controls.ShellPreviewHandlerControl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="using:Peek.FilePreviewer.Controls"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Loaded="UserControl_Loaded"
|
||||||
|
EffectiveViewportChanged="UserControl_EffectiveViewportChanged"
|
||||||
|
IsEnabled="False" IsTabStop="True" GotFocus="UserControl_GotFocus"
|
||||||
|
ActualThemeChanged="{x:Bind UpdatePreviewerTheme}">
|
||||||
|
|
||||||
|
</UserControl>
|
@ -0,0 +1,209 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation
|
||||||
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using Microsoft.UI;
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Windows.Win32;
|
||||||
|
using Windows.Win32.Foundation;
|
||||||
|
using Windows.Win32.Graphics.Gdi;
|
||||||
|
using Windows.Win32.UI.Shell;
|
||||||
|
using Windows.Win32.UI.WindowsAndMessaging;
|
||||||
|
|
||||||
|
namespace Peek.FilePreviewer.Controls
|
||||||
|
{
|
||||||
|
[INotifyPropertyChanged]
|
||||||
|
public unsafe sealed partial class ShellPreviewHandlerControl : UserControl
|
||||||
|
{
|
||||||
|
// Mica fallback colors
|
||||||
|
private static readonly COLORREF LightThemeBgColor = new(0x00f3f3f3);
|
||||||
|
private static readonly COLORREF DarkThemeBgColor = new(0x00202020);
|
||||||
|
|
||||||
|
private static readonly HBRUSH LightThemeBgBrush = PInvoke.CreateSolidBrush(LightThemeBgColor);
|
||||||
|
private static readonly HBRUSH DarkThemeBgBrush = PInvoke.CreateSolidBrush(DarkThemeBgColor);
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private IPreviewHandler? source;
|
||||||
|
|
||||||
|
private HWND containerHwnd;
|
||||||
|
private WNDPROC containerWndProc;
|
||||||
|
private HBRUSH containerBgBrush;
|
||||||
|
private RECT controlRect;
|
||||||
|
|
||||||
|
public event EventHandler? HandlerLoaded;
|
||||||
|
|
||||||
|
public event EventHandler? HandlerError;
|
||||||
|
|
||||||
|
public static readonly DependencyProperty HandlerVisibilityProperty = DependencyProperty.Register(
|
||||||
|
nameof(HandlerVisibility),
|
||||||
|
typeof(Visibility),
|
||||||
|
typeof(ShellPreviewHandlerControl),
|
||||||
|
new PropertyMetadata(Visibility.Collapsed, new PropertyChangedCallback((d, e) => ((ShellPreviewHandlerControl)d).OnHandlerVisibilityChanged())));
|
||||||
|
|
||||||
|
// Must have its own visibility property so resize events can still fire
|
||||||
|
public Visibility HandlerVisibility
|
||||||
|
{
|
||||||
|
get { return (Visibility)GetValue(HandlerVisibilityProperty); }
|
||||||
|
set { SetValue(HandlerVisibilityProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShellPreviewHandlerControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
containerWndProc = ContainerWndProc;
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnSourceChanged(IPreviewHandler? value)
|
||||||
|
{
|
||||||
|
if (Source != null)
|
||||||
|
{
|
||||||
|
UpdatePreviewerTheme();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Attach the preview handler to the container window
|
||||||
|
Source.SetWindow(containerHwnd, (RECT*)Unsafe.AsPointer(ref controlRect));
|
||||||
|
Source.DoPreview();
|
||||||
|
|
||||||
|
HandlerLoaded?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
HandlerError?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnHandlerVisibilityChanged()
|
||||||
|
{
|
||||||
|
if (HandlerVisibility == Visibility.Visible)
|
||||||
|
{
|
||||||
|
PInvoke.ShowWindow(containerHwnd, SHOW_WINDOW_CMD.SW_SHOW);
|
||||||
|
IsEnabled = true;
|
||||||
|
|
||||||
|
// Clears the background from the last previewer
|
||||||
|
// The brush can only be drawn here because flashes will occur during resize
|
||||||
|
PInvoke.SetClassLongPtr(containerHwnd, GET_CLASS_LONG_INDEX.GCLP_HBRBACKGROUND, containerBgBrush);
|
||||||
|
PInvoke.UpdateWindow(containerHwnd);
|
||||||
|
PInvoke.SetClassLongPtr(containerHwnd, GET_CLASS_LONG_INDEX.GCLP_HBRBACKGROUND, IntPtr.Zero);
|
||||||
|
PInvoke.InvalidateRect(containerHwnd, (RECT*)null, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PInvoke.ShowWindow(containerHwnd, SHOW_WINDOW_CMD.SW_HIDE);
|
||||||
|
IsEnabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdatePreviewerTheme()
|
||||||
|
{
|
||||||
|
COLORREF bgColor, fgColor;
|
||||||
|
switch (ActualTheme)
|
||||||
|
{
|
||||||
|
case ElementTheme.Light:
|
||||||
|
bgColor = LightThemeBgColor;
|
||||||
|
fgColor = new COLORREF(0x00000000); // Black
|
||||||
|
|
||||||
|
containerBgBrush = LightThemeBgBrush;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ElementTheme.Dark:
|
||||||
|
default:
|
||||||
|
bgColor = DarkThemeBgColor;
|
||||||
|
fgColor = new COLORREF(0x00FFFFFF); // White
|
||||||
|
|
||||||
|
containerBgBrush = DarkThemeBgBrush;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Source is IPreviewHandlerVisuals visuals)
|
||||||
|
{
|
||||||
|
visuals.SetBackgroundColor(bgColor);
|
||||||
|
visuals.SetTextColor(fgColor);
|
||||||
|
|
||||||
|
// Changing the previewer colors might not always redraw itself
|
||||||
|
PInvoke.InvalidateRect(containerHwnd, (RECT*)null, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private LRESULT ContainerWndProc(HWND hWnd, uint msg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
// Here for future use :)
|
||||||
|
return PInvoke.DefWindowProc(hWnd, msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
fixed (char* pContainerClassName = "PeekShellPreviewHandlerContainer")
|
||||||
|
{
|
||||||
|
PInvoke.RegisterClass(new WNDCLASSW()
|
||||||
|
{
|
||||||
|
lpfnWndProc = containerWndProc,
|
||||||
|
lpszClassName = pContainerClassName,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create the container window to host the preview handler
|
||||||
|
containerHwnd = PInvoke.CreateWindowEx(
|
||||||
|
WINDOW_EX_STYLE.WS_EX_LAYERED,
|
||||||
|
pContainerClassName,
|
||||||
|
null,
|
||||||
|
WINDOW_STYLE.WS_CHILD,
|
||||||
|
0, // X
|
||||||
|
0, // Y
|
||||||
|
0, // Width
|
||||||
|
0, // Height
|
||||||
|
(HWND)Win32Interop.GetWindowFromWindowId(XamlRoot.ContentIslandEnvironment.AppWindowId), // Peek UI window
|
||||||
|
HMENU.Null,
|
||||||
|
HINSTANCE.Null);
|
||||||
|
|
||||||
|
// Allows the preview handlers to display properly
|
||||||
|
PInvoke.SetLayeredWindowAttributes(containerHwnd, default, byte.MaxValue, LAYERED_WINDOW_ATTRIBUTES_FLAGS.LWA_ALPHA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UserControl_EffectiveViewportChanged(FrameworkElement sender, EffectiveViewportChangedEventArgs args)
|
||||||
|
{
|
||||||
|
var dpi = (float)PInvoke.GetDpiForWindow(containerHwnd) / 96;
|
||||||
|
|
||||||
|
// Resize the container window
|
||||||
|
PInvoke.SetWindowPos(
|
||||||
|
containerHwnd,
|
||||||
|
(HWND)0, // HWND_TOP
|
||||||
|
(int)(Math.Abs(args.EffectiveViewport.X) * dpi),
|
||||||
|
(int)(Math.Abs(args.EffectiveViewport.Y) * dpi),
|
||||||
|
(int)(ActualWidth * dpi),
|
||||||
|
(int)(ActualHeight * dpi),
|
||||||
|
SET_WINDOW_POS_FLAGS.SWP_NOACTIVATE);
|
||||||
|
|
||||||
|
// Resize the preview handler window
|
||||||
|
controlRect.right = (int)(ActualWidth * dpi);
|
||||||
|
controlRect.bottom = (int)(ActualHeight * dpi);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Source?.SetRect((RECT*)Unsafe.AsPointer(ref controlRect));
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resizing the previewer might not always redraw itself
|
||||||
|
PInvoke.InvalidateRect(containerHwnd, (RECT*)null, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UserControl_GotFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Source?.SetFocus();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
|
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
|
||||||
<!-- Licensed under the MIT License. -->
|
<!-- Licensed under the MIT License. -->
|
||||||
|
|
||||||
<UserControl
|
<UserControl
|
||||||
@ -34,18 +34,18 @@
|
|||||||
Text="{x:Bind Source.FileName, Mode=OneWay}"
|
Text="{x:Bind Source.FileName, Mode=OneWay}"
|
||||||
TextTrimming="CharacterEllipsis">
|
TextTrimming="CharacterEllipsis">
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
<ToolTip Content="{x:Bind Source.FileName, Mode=OneWay}"/>
|
<ToolTip Content="{x:Bind Source.FileName, Mode=OneWay}" />
|
||||||
</ToolTipService.ToolTip>
|
</ToolTipService.ToolTip>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<TextBlock Text="{x:Bind FormatFileType(Source.FileType), Mode=OneWay}">
|
<TextBlock Text="{x:Bind FormatFileType(Source.FileType), Mode=OneWay}">
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
<ToolTip Content="{x:Bind FormatFileType(Source.FileType), Mode=OneWay}"/>
|
<ToolTip Content="{x:Bind FormatFileType(Source.FileType), Mode=OneWay}" />
|
||||||
</ToolTipService.ToolTip>
|
</ToolTipService.ToolTip>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<TextBlock Text="{x:Bind FormatFileSize(Source.FileSize), Mode=OneWay}"/>
|
<TextBlock Text="{x:Bind FormatFileSize(Source.FileSize), Mode=OneWay}" />
|
||||||
<TextBlock Text="{x:Bind FormatFileDateModified(Source.DateModified), Mode=OneWay}">
|
<TextBlock Text="{x:Bind FormatFileDateModified(Source.DateModified), Mode=OneWay}">
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
<ToolTip Content="{x:Bind FormatFileDateModified(Source.DateModified), Mode=OneWay}"/>
|
<ToolTip Content="{x:Bind FormatFileDateModified(Source.DateModified), Mode=OneWay}" />
|
||||||
</ToolTipService.ToolTip>
|
</ToolTipService.ToolTip>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
@ -18,6 +18,13 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
IsActive="{x:Bind MatchPreviewState(Previewer.State, previewers:PreviewState.Loading), Mode=OneWay}" />
|
IsActive="{x:Bind MatchPreviewState(Previewer.State, previewers:PreviewState.Loading), Mode=OneWay}" />
|
||||||
|
|
||||||
|
<controls:ShellPreviewHandlerControl
|
||||||
|
x:Name="ShellPreviewHandlerPreview"
|
||||||
|
Source="{x:Bind ShellPreviewHandlerPreviewer.Preview, Mode=OneWay}"
|
||||||
|
HandlerVisibility="{x:Bind IsPreviewVisible(ShellPreviewHandlerPreviewer, Previewer.State), Mode=OneWay}"
|
||||||
|
HandlerLoaded="ShellPreviewHandlerPreview_HandlerLoaded"
|
||||||
|
HandlerError="ShellPreviewHandlerPreview_HandlerError" />
|
||||||
|
|
||||||
<Image
|
<Image
|
||||||
x:Name="ImagePreview"
|
x:Name="ImagePreview"
|
||||||
MaxWidth="{x:Bind ImagePreviewer.MaxImageSize.Width, Mode=OneWay}"
|
MaxWidth="{x:Bind ImagePreviewer.MaxImageSize.Width, Mode=OneWay}"
|
||||||
@ -53,11 +60,11 @@
|
|||||||
|
|
||||||
<controls:ArchiveControl
|
<controls:ArchiveControl
|
||||||
x:Name="ArchivePreview"
|
x:Name="ArchivePreview"
|
||||||
LoadingState="{x:Bind ArchivePreviewer.State, Mode=OneWay}"
|
|
||||||
Source="{x:Bind ArchivePreviewer.Tree, Mode=OneWay}"
|
|
||||||
FileCount="{x:Bind ArchivePreviewer.FileCountText, Mode=OneWay}"
|
|
||||||
DirectoryCount="{x:Bind ArchivePreviewer.DirectoryCountText, Mode=OneWay}"
|
DirectoryCount="{x:Bind ArchivePreviewer.DirectoryCountText, Mode=OneWay}"
|
||||||
|
FileCount="{x:Bind ArchivePreviewer.FileCountText, Mode=OneWay}"
|
||||||
|
LoadingState="{x:Bind ArchivePreviewer.State, Mode=OneWay}"
|
||||||
Size="{x:Bind ArchivePreviewer.SizeText, Mode=OneWay}"
|
Size="{x:Bind ArchivePreviewer.SizeText, Mode=OneWay}"
|
||||||
|
Source="{x:Bind ArchivePreviewer.Tree, Mode=OneWay}"
|
||||||
Visibility="{x:Bind IsPreviewVisible(ArchivePreviewer, Previewer.State), Mode=OneWay}" />
|
Visibility="{x:Bind IsPreviewVisible(ArchivePreviewer, Previewer.State), Mode=OneWay}" />
|
||||||
|
|
||||||
<controls:UnsupportedFilePreview
|
<controls:UnsupportedFilePreview
|
||||||
|
@ -49,6 +49,7 @@ namespace Peek.FilePreviewer
|
|||||||
[NotifyPropertyChangedFor(nameof(VideoPreviewer))]
|
[NotifyPropertyChangedFor(nameof(VideoPreviewer))]
|
||||||
[NotifyPropertyChangedFor(nameof(BrowserPreviewer))]
|
[NotifyPropertyChangedFor(nameof(BrowserPreviewer))]
|
||||||
[NotifyPropertyChangedFor(nameof(ArchivePreviewer))]
|
[NotifyPropertyChangedFor(nameof(ArchivePreviewer))]
|
||||||
|
[NotifyPropertyChangedFor(nameof(ShellPreviewHandlerPreviewer))]
|
||||||
[NotifyPropertyChangedFor(nameof(UnsupportedFilePreviewer))]
|
[NotifyPropertyChangedFor(nameof(UnsupportedFilePreviewer))]
|
||||||
|
|
||||||
private IPreviewer? previewer;
|
private IPreviewer? previewer;
|
||||||
@ -96,6 +97,8 @@ namespace Peek.FilePreviewer
|
|||||||
|
|
||||||
public IArchivePreviewer? ArchivePreviewer => Previewer as IArchivePreviewer;
|
public IArchivePreviewer? ArchivePreviewer => Previewer as IArchivePreviewer;
|
||||||
|
|
||||||
|
public IShellPreviewHandlerPreviewer? ShellPreviewHandlerPreviewer => Previewer as IShellPreviewHandlerPreviewer;
|
||||||
|
|
||||||
public IUnsupportedFilePreviewer? UnsupportedFilePreviewer => Previewer as IUnsupportedFilePreviewer;
|
public IUnsupportedFilePreviewer? UnsupportedFilePreviewer => Previewer as IUnsupportedFilePreviewer;
|
||||||
|
|
||||||
public IFileSystemItem Item
|
public IFileSystemItem Item
|
||||||
@ -220,6 +223,9 @@ namespace Peek.FilePreviewer
|
|||||||
ArchivePreview.Source = null;
|
ArchivePreview.Source = null;
|
||||||
BrowserPreview.Source = null;
|
BrowserPreview.Source = null;
|
||||||
|
|
||||||
|
ShellPreviewHandlerPreviewer?.Clear();
|
||||||
|
ShellPreviewHandlerPreview.Source = null;
|
||||||
|
|
||||||
if (Previewer != null)
|
if (Previewer != null)
|
||||||
{
|
{
|
||||||
Previewer.PropertyChanged -= Previewer_PropertyChanged;
|
Previewer.PropertyChanged -= Previewer_PropertyChanged;
|
||||||
@ -268,6 +274,22 @@ namespace Peek.FilePreviewer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ShellPreviewHandlerPreview_HandlerLoaded(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (ShellPreviewHandlerPreviewer != null)
|
||||||
|
{
|
||||||
|
ShellPreviewHandlerPreviewer.State = PreviewState.Loaded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShellPreviewHandlerPreview_HandlerError(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (ShellPreviewHandlerPreviewer != null)
|
||||||
|
{
|
||||||
|
ShellPreviewHandlerPreviewer.State = PreviewState.Error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async void KeyboardAccelerator_CtrlC_Invoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
|
private async void KeyboardAccelerator_CtrlC_Invoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
|
||||||
{
|
{
|
||||||
if (Previewer != null)
|
if (Previewer != null)
|
||||||
|
4
src/modules/peek/Peek.FilePreviewer/NativeMethods.json
Normal file
4
src/modules/peek/Peek.FilePreviewer/NativeMethods.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://aka.ms/CsWin32.schema.json",
|
||||||
|
"public": false
|
||||||
|
}
|
14
src/modules/peek/Peek.FilePreviewer/NativeMethods.txt
Normal file
14
src/modules/peek/Peek.FilePreviewer/NativeMethods.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
IClassFactory
|
||||||
|
CoGetClassObject
|
||||||
|
CreateSolidBrush
|
||||||
|
CreateWindowEx
|
||||||
|
DefWindowProc
|
||||||
|
GetDpiForWindow
|
||||||
|
InvalidateRect
|
||||||
|
RegisterClass
|
||||||
|
SetClassLongPtr
|
||||||
|
SetLayeredWindowAttributes
|
||||||
|
SetWindowPos
|
||||||
|
ShowWindow
|
||||||
|
UpdateWindow
|
||||||
|
SHCreateItemFromParsingName
|
@ -8,6 +8,7 @@
|
|||||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
|
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
|
||||||
<UseWinUI>true</UseWinUI>
|
<UseWinUI>true</UseWinUI>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PRIResource Include="..\Peek.UI\Strings\en-US\Resources.resw" Link="Strings\en-US\Resources.resw">
|
<PRIResource Include="..\Peek.UI\Strings\en-US\Resources.resw" Link="Strings\en-US\Resources.resw">
|
||||||
@ -17,6 +18,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Controls\ArchiveControl.xaml" />
|
<None Remove="Controls\ArchiveControl.xaml" />
|
||||||
<None Remove="Controls\BrowserControl.xaml" />
|
<None Remove="Controls\BrowserControl.xaml" />
|
||||||
|
<None Remove="Controls\ShellPreviewHandlerControl.xaml" />
|
||||||
<None Remove="Controls\UnsupportedFilePreview\FailedFallbackPreviewControl.xaml" />
|
<None Remove="Controls\UnsupportedFilePreview\FailedFallbackPreviewControl.xaml" />
|
||||||
<None Remove="Controls\UnsupportedFilePreview\InformationalPreviewControl.xaml" />
|
<None Remove="Controls\UnsupportedFilePreview\InformationalPreviewControl.xaml" />
|
||||||
<None Remove="FilePreview.xaml" />
|
<None Remove="FilePreview.xaml" />
|
||||||
@ -29,6 +31,10 @@
|
|||||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
|
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
|
||||||
<PackageReference Include="SharpCompress" />
|
<PackageReference Include="SharpCompress" />
|
||||||
<PackageReference Include="System.Drawing.Common" />
|
<PackageReference Include="System.Drawing.Common" />
|
||||||
|
<PackageReference Include="Microsoft.Windows.CsWin32">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -38,6 +44,12 @@
|
|||||||
<ProjectReference Include="..\Peek.Common\Peek.Common.csproj" />
|
<ProjectReference Include="..\Peek.Common\Peek.Common.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Update="Controls\ShellPreviewHandlerControl.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Update="Controls\ArchiveControl.xaml">
|
<Page Update="Controls\ArchiveControl.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
// 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 Windows.Win32.UI.Shell;
|
||||||
|
|
||||||
|
namespace Peek.FilePreviewer.Previewers
|
||||||
|
{
|
||||||
|
public interface IShellPreviewHandlerPreviewer : IPreviewer
|
||||||
|
{
|
||||||
|
public IPreviewHandler? Preview { get; }
|
||||||
|
|
||||||
|
public void Clear();
|
||||||
|
}
|
||||||
|
}
|
@ -29,6 +29,10 @@ namespace Peek.FilePreviewer.Previewers
|
|||||||
{
|
{
|
||||||
return new ArchivePreviewer(file);
|
return new ArchivePreviewer(file);
|
||||||
}
|
}
|
||||||
|
else if (ShellPreviewHandlerPreviewer.IsFileTypeSupported(file.Extension))
|
||||||
|
{
|
||||||
|
return new ShellPreviewHandlerPreviewer(file);
|
||||||
|
}
|
||||||
|
|
||||||
// Other previewer types check their supported file types here
|
// Other previewer types check their supported file types here
|
||||||
return CreateDefaultPreviewer(file);
|
return CreateDefaultPreviewer(file);
|
||||||
|
@ -0,0 +1,104 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation
|
||||||
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using Windows.Win32.Foundation;
|
||||||
|
using Windows.Win32.System.Com;
|
||||||
|
|
||||||
|
namespace Peek.FilePreviewer.Previewers.Helpers
|
||||||
|
{
|
||||||
|
public unsafe class IStreamWrapper : IStream
|
||||||
|
{
|
||||||
|
public Stream Stream { get; }
|
||||||
|
|
||||||
|
public IStreamWrapper(Stream stream) => Stream = stream;
|
||||||
|
|
||||||
|
public HRESULT Read(void* pv, uint cb, [Optional] uint* pcbRead)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int read = Stream.Read(new Span<byte>(pv, (int)cb));
|
||||||
|
if (pcbRead != null)
|
||||||
|
{
|
||||||
|
*pcbRead = (uint)read;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (HRESULT)0;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return (HRESULT)Marshal.GetHRForException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public HRESULT Write(void* pv, uint cb, [Optional] uint* pcbWritten)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Stream.Write(new ReadOnlySpan<byte>(pv, (int)cb));
|
||||||
|
if (pcbWritten != null)
|
||||||
|
{
|
||||||
|
*pcbWritten = cb;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (HRESULT)0;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return (HRESULT)Marshal.GetHRForException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Seek(long dlibMove, STREAM_SEEK dwOrigin, [Optional] ulong* plibNewPosition)
|
||||||
|
{
|
||||||
|
long position = Stream.Seek(dlibMove, (SeekOrigin)dwOrigin);
|
||||||
|
if (plibNewPosition != null)
|
||||||
|
{
|
||||||
|
*plibNewPosition = (ulong)position;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetSize(ulong libNewSize)
|
||||||
|
{
|
||||||
|
Stream.SetLength((long)libNewSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CopyTo(IStream pstm, ulong cb, [Optional] ulong* pcbRead, [Optional] ulong* pcbWritten)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Commit(STGC grfCommitFlags)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Revert()
|
||||||
|
{
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LockRegion(ulong libOffset, ulong cb, uint dwLockType)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UnlockRegion(ulong libOffset, ulong cb, uint dwLockType)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Stat(STATSTG* pstatstg, uint grfStatFlag)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Clone(out IStream ppstm)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,237 @@
|
|||||||
|
// 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.Concurrent;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using Microsoft.UI.Dispatching;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using Peek.Common.Extensions;
|
||||||
|
using Peek.Common.Helpers;
|
||||||
|
using Peek.Common.Models;
|
||||||
|
using Peek.FilePreviewer.Models;
|
||||||
|
using Peek.FilePreviewer.Previewers.Helpers;
|
||||||
|
using Windows.Win32;
|
||||||
|
using Windows.Win32.System.Com;
|
||||||
|
using Windows.Win32.UI.Shell;
|
||||||
|
using Windows.Win32.UI.Shell.PropertiesSystem;
|
||||||
|
using IShellItem = Windows.Win32.UI.Shell.IShellItem;
|
||||||
|
|
||||||
|
namespace Peek.FilePreviewer.Previewers
|
||||||
|
{
|
||||||
|
public partial class ShellPreviewHandlerPreviewer : ObservableObject, IShellPreviewHandlerPreviewer, IDisposable
|
||||||
|
{
|
||||||
|
private static readonly ConcurrentDictionary<Guid, IClassFactory> HandlerFactories = new();
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private IPreviewHandler? preview;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private PreviewState state;
|
||||||
|
|
||||||
|
private Stream? fileStream;
|
||||||
|
|
||||||
|
public ShellPreviewHandlerPreviewer(IFileSystemItem file)
|
||||||
|
{
|
||||||
|
FileItem = file;
|
||||||
|
Dispatcher = DispatcherQueue.GetForCurrentThread();
|
||||||
|
}
|
||||||
|
|
||||||
|
private IFileSystemItem FileItem { get; }
|
||||||
|
|
||||||
|
private DispatcherQueue Dispatcher { get; }
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task CopyAsync()
|
||||||
|
{
|
||||||
|
await Dispatcher.RunOnUiThread(async () =>
|
||||||
|
{
|
||||||
|
var storageItem = await FileItem.GetStorageItemAsync();
|
||||||
|
ClipboardHelper.SaveToClipboard(storageItem);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<PreviewSize> GetPreviewSizeAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
return Task.FromResult(new PreviewSize { MonitorSize = null });
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task LoadPreviewAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
State = PreviewState.Loading;
|
||||||
|
|
||||||
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
// Create the preview handler
|
||||||
|
var previewHandler = await Task.Run(() =>
|
||||||
|
{
|
||||||
|
var previewHandlerGuid = GetPreviewHandlerGuid(FileItem.Extension);
|
||||||
|
if (!string.IsNullOrEmpty(previewHandlerGuid))
|
||||||
|
{
|
||||||
|
var clsid = Guid.Parse(previewHandlerGuid);
|
||||||
|
|
||||||
|
bool retry = false;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
// This runs the preview handler in a separate process (prevhost.exe)
|
||||||
|
// TODO: Figure out how to get it to run in a low integrity level
|
||||||
|
if (!HandlerFactories.TryGetValue(clsid, out var factory))
|
||||||
|
{
|
||||||
|
var hr = PInvoke.CoGetClassObject(clsid, CLSCTX.CLSCTX_LOCAL_SERVER, null, typeof(IClassFactory).GUID, out var pFactory);
|
||||||
|
Marshal.ThrowExceptionForHR(hr);
|
||||||
|
|
||||||
|
// Storing the factory in memory helps makes the handlers load faster
|
||||||
|
// TODO: Maybe free them after some inactivity or when Peek quits?
|
||||||
|
factory = (IClassFactory)Marshal.GetObjectForIUnknown((IntPtr)pFactory);
|
||||||
|
factory.LockServer(true);
|
||||||
|
HandlerFactories.AddOrUpdate(clsid, factory, (_, _) => factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var iid = typeof(IPreviewHandler).GUID;
|
||||||
|
factory.CreateInstance(null, &iid, out var instance);
|
||||||
|
return instance as IPreviewHandler;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
if (!retry)
|
||||||
|
{
|
||||||
|
// Process is probably dead, attempt to get the factory again (once)
|
||||||
|
HandlerFactories.TryRemove(new(clsid, factory));
|
||||||
|
retry = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (retry);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (previewHandler == null)
|
||||||
|
{
|
||||||
|
State = PreviewState.Error;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
// Initialize the preview handler with the selected file
|
||||||
|
bool success = await Task.Run(() =>
|
||||||
|
{
|
||||||
|
const uint STGM_READ = 0x00000000;
|
||||||
|
if (previewHandler is IInitializeWithStream initWithStream)
|
||||||
|
{
|
||||||
|
fileStream = File.OpenRead(FileItem.Path);
|
||||||
|
initWithStream.Initialize(new IStreamWrapper(fileStream), STGM_READ);
|
||||||
|
}
|
||||||
|
else if (previewHandler is IInitializeWithItem initWithItem)
|
||||||
|
{
|
||||||
|
var hr = PInvoke.SHCreateItemFromParsingName(FileItem.Path, null, typeof(IShellItem).GUID, out var item);
|
||||||
|
Marshal.ThrowExceptionForHR(hr);
|
||||||
|
|
||||||
|
initWithItem.Initialize((IShellItem)item, STGM_READ);
|
||||||
|
}
|
||||||
|
else if (previewHandler is IInitializeWithFile initWithFile)
|
||||||
|
{
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
fixed (char* pPath = FileItem.Path)
|
||||||
|
{
|
||||||
|
initWithFile.Initialize(pPath, STGM_READ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Handler is missing the required interfaces
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
State = PreviewState.Error;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
// Preview.SetWindow() needs to be set in the control
|
||||||
|
Preview = previewHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
|
if (Preview != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Preview.Unload();
|
||||||
|
Marshal.FinalReleaseComObject(Preview);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Preview = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileStream != null)
|
||||||
|
{
|
||||||
|
fileStream.Dispose();
|
||||||
|
fileStream = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsFileTypeSupported(string fileExt)
|
||||||
|
{
|
||||||
|
return !string.IsNullOrEmpty(GetPreviewHandlerGuid(fileExt));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string? GetPreviewHandlerGuid(string fileExt)
|
||||||
|
{
|
||||||
|
const string PreviewHandlerKeyPath = "shellex\\{8895b1c6-b41f-4c1c-a562-0d564250836f}";
|
||||||
|
|
||||||
|
// Search by file extension
|
||||||
|
using var classExtensionKey = Registry.ClassesRoot.OpenSubKey(fileExt);
|
||||||
|
using var classExtensionPreviewHandlerKey = classExtensionKey?.OpenSubKey(PreviewHandlerKeyPath);
|
||||||
|
|
||||||
|
if (classExtensionKey != null && classExtensionPreviewHandlerKey == null)
|
||||||
|
{
|
||||||
|
// Search by file class
|
||||||
|
var className = classExtensionKey.GetValue(null) as string;
|
||||||
|
if (!string.IsNullOrEmpty(className))
|
||||||
|
{
|
||||||
|
using var classKey = Registry.ClassesRoot.OpenSubKey(className);
|
||||||
|
using var classPreviewHandlerKey = classKey?.OpenSubKey(PreviewHandlerKeyPath);
|
||||||
|
|
||||||
|
return classPreviewHandlerKey?.GetValue(null) as string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return classExtensionPreviewHandlerKey?.GetValue(null) as string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
|
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
|
||||||
<!-- Licensed under the MIT License. -->
|
<!-- Licensed under the MIT License. -->
|
||||||
|
|
||||||
<Application
|
<Application
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
|
<!-- Copyright (c) Microsoft Corporation and Contributors. -->
|
||||||
<!-- Licensed under the MIT License. -->
|
<!-- Licensed under the MIT License. -->
|
||||||
|
|
||||||
<UserControl
|
<UserControl
|
||||||
@ -7,8 +7,8 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="using:Peek.UI.Views"
|
xmlns:local="using:Peek.UI.Views"
|
||||||
FlowDirection="{x:Bind TitleBarFlowDirection, Mode=OneWay}"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
FlowDirection="{x:Bind TitleBarFlowDirection, Mode=OneWay}"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
|
|
||||||
<Grid x:Name="TitleBarRootContainer" Height="48">
|
<Grid x:Name="TitleBarRootContainer" Height="48">
|
||||||
|
@ -154,31 +154,31 @@
|
|||||||
<comment>Date Modified label for the unsupported files view. {0} is the date.</comment>
|
<comment>Date Modified label for the unsupported files view. {0} is the date.</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="ReadableString_ByteAbbreviationFormat" xml:space="preserve">
|
<data name="ReadableString_ByteAbbreviationFormat" xml:space="preserve">
|
||||||
<value>{0} byte</value>
|
<value>byte</value>
|
||||||
<comment>Abbreviation for the size unit byte.</comment>
|
<comment>Abbreviation for the size unit byte.</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="ReadableString_KiloByteAbbreviationFormat" xml:space="preserve">
|
<data name="ReadableString_KiloByteAbbreviationFormat" xml:space="preserve">
|
||||||
<value>{0} KB</value>
|
<value>KB</value>
|
||||||
<comment>Abbreviation for the size unit kilobyte.</comment>
|
<comment>Abbreviation for the size unit kilobyte.</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="ReadableString_MegaByteAbbreviationFormat" xml:space="preserve">
|
<data name="ReadableString_MegaByteAbbreviationFormat" xml:space="preserve">
|
||||||
<value>{0} MB</value>
|
<value>MB</value>
|
||||||
<comment>Abbreviation for the size unit megabyte.</comment>
|
<comment>Abbreviation for the size unit megabyte.</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="ReadableString_GigaByteAbbreviationFormat" xml:space="preserve">
|
<data name="ReadableString_GigaByteAbbreviationFormat" xml:space="preserve">
|
||||||
<value>{0} GB</value>
|
<value>GB</value>
|
||||||
<comment>Abbreviation for the size unit gigabyte.</comment>
|
<comment>Abbreviation for the size unit gigabyte.</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="ReadableString_TeraByteAbbreviationFormat" xml:space="preserve">
|
<data name="ReadableString_TeraByteAbbreviationFormat" xml:space="preserve">
|
||||||
<value>{0} TB</value>
|
<value>TB</value>
|
||||||
<comment>Abbreviation for the size unit terabyte.</comment>
|
<comment>Abbreviation for the size unit terabyte.</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="ReadableString_PetaByteAbbreviationFormat" xml:space="preserve">
|
<data name="ReadableString_PetaByteAbbreviationFormat" xml:space="preserve">
|
||||||
<value>{0} PB</value>
|
<value>PB</value>
|
||||||
<comment>Abbreviation for the size unit petabyte.</comment>
|
<comment>Abbreviation for the size unit petabyte.</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="ReadableString_ExaByteAbbreviationFormat" xml:space="preserve">
|
<data name="ReadableString_ExaByteAbbreviationFormat" xml:space="preserve">
|
||||||
<value>{0} EB</value>
|
<value>EB</value>
|
||||||
<comment>Abbreviation for the size unit exabyte.</comment>
|
<comment>Abbreviation for the size unit exabyte.</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="PreviewTooltip_FileName" xml:space="preserve">
|
<data name="PreviewTooltip_FileName" xml:space="preserve">
|
||||||
@ -234,7 +234,7 @@
|
|||||||
<comment>{0} is the size of the archive, {1} is the extracted size</comment>
|
<comment>{0} is the size of the archive, {1} is the extracted size</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="ReadableString_BytesAbbreviationFormat" xml:space="preserve">
|
<data name="ReadableString_BytesAbbreviationFormat" xml:space="preserve">
|
||||||
<value>{0} bytes</value>
|
<value>bytes</value>
|
||||||
<comment>Abbreviation for the size bytes</comment>
|
<comment>Abbreviation for the size bytes</comment>
|
||||||
</data>
|
</data>
|
||||||
<data name="OpenUriDialog.CloseButtonText" xml:space="preserve">
|
<data name="OpenUriDialog.CloseButtonText" xml:space="preserve">
|
||||||
@ -253,4 +253,12 @@
|
|||||||
<value>Do you want Peek to open the external application?</value>
|
<value>Do you want Peek to open the external application?</value>
|
||||||
<comment>Title of the dialog showed when an URI is clicked,"Peek" is the name of the utility. </comment>
|
<comment>Title of the dialog showed when an URI is clicked,"Peek" is the name of the utility. </comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ReadableString_BytesString" xml:space="preserve">
|
||||||
|
<value> ({1:N0} bytes)</value>
|
||||||
|
<comment>Displays total number of bytes. Don't localize the "{1:N0}" part.</comment>
|
||||||
|
</data>
|
||||||
|
<data name="ReadableString_ByteString" xml:space="preserve">
|
||||||
|
<value> ({1:N0} byte)</value>
|
||||||
|
<comment>Displays unit byte. Don't localize the "{1:N0}" part.</comment>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
@ -77,7 +77,7 @@ namespace PowerAccent.Core
|
|||||||
Language.SR => GetDefaultLetterKeySR(letter), // Serbian
|
Language.SR => GetDefaultLetterKeySR(letter), // Serbian
|
||||||
Language.SV => GetDefaultLetterKeySV(letter), // Swedish
|
Language.SV => GetDefaultLetterKeySV(letter), // Swedish
|
||||||
Language.TK => GetDefaultLetterKeyTK(letter), // Turkish
|
Language.TK => GetDefaultLetterKeyTK(letter), // Turkish
|
||||||
_ => throw new ArgumentException("The language {0} is not know in this context", lang.ToString()),
|
_ => throw new ArgumentException("The language {0} is not known in this context", lang.ToString()),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,27 +131,27 @@ namespace PowerAccent.Core
|
|||||||
{
|
{
|
||||||
return letter switch
|
return letter switch
|
||||||
{
|
{
|
||||||
LetterKey.VK_A => new[] { "α", "ȧ" },
|
LetterKey.VK_A => new[] { "α", "ά", "ȧ" },
|
||||||
LetterKey.VK_B => new[] { "ḃ", "β" },
|
LetterKey.VK_B => new[] { "ḃ", "β" },
|
||||||
LetterKey.VK_C => new[] { "ċ", "χ", "°C", "©", "ℂ" },
|
LetterKey.VK_C => new[] { "ċ", "χ", "°C", "©", "ℂ" },
|
||||||
LetterKey.VK_D => new[] { "ḍ", "ḋ", "δ" },
|
LetterKey.VK_D => new[] { "ḍ", "ḋ", "δ" },
|
||||||
LetterKey.VK_E => new[] { "ε", "η", "∈" },
|
LetterKey.VK_E => new[] { "ε", "έ", "η", "ή", "∈" },
|
||||||
LetterKey.VK_F => new[] { "ḟ", "°F" },
|
LetterKey.VK_F => new[] { "ḟ", "°F" },
|
||||||
LetterKey.VK_G => new[] { "ģ", "ǧ", "ġ", "ĝ", "ǥ", "γ" },
|
LetterKey.VK_G => new[] { "ģ", "ǧ", "ġ", "ĝ", "ǥ", "γ" },
|
||||||
LetterKey.VK_H => new[] { "ḣ", "ĥ", "ħ" },
|
LetterKey.VK_H => new[] { "ḣ", "ĥ", "ħ" },
|
||||||
LetterKey.VK_I => new[] { "ι" },
|
LetterKey.VK_I => new[] { "ι", "ί" },
|
||||||
LetterKey.VK_J => new[] { "ĵ" },
|
LetterKey.VK_J => new[] { "ĵ" },
|
||||||
LetterKey.VK_K => new[] { "ķ", "ǩ", "κ" },
|
LetterKey.VK_K => new[] { "ķ", "ǩ", "κ" },
|
||||||
LetterKey.VK_L => new[] { "ļ", "₺", "λ" }, // ₺ is in VK_T for other languages, but not VK_L, so we add it here.
|
LetterKey.VK_L => new[] { "ļ", "₺", "λ" }, // ₺ is in VK_T for other languages, but not VK_L, so we add it here.
|
||||||
LetterKey.VK_M => new[] { "ṁ", "μ" },
|
LetterKey.VK_M => new[] { "ṁ", "μ" },
|
||||||
LetterKey.VK_N => new[] { "ņ", "ṅ", "ⁿ", "ν", "ℕ" },
|
LetterKey.VK_N => new[] { "ņ", "ṅ", "ⁿ", "ν", "ℕ" },
|
||||||
LetterKey.VK_O => new[] { "ȯ", "ω", "ο" },
|
LetterKey.VK_O => new[] { "ȯ", "ω", "ώ", "ο", "ό" },
|
||||||
LetterKey.VK_P => new[] { "ṗ", "φ", "ψ", "℗" },
|
LetterKey.VK_P => new[] { "ṗ", "φ", "ψ", "℗" },
|
||||||
LetterKey.VK_Q => new[] { "ℚ" },
|
LetterKey.VK_Q => new[] { "ℚ" },
|
||||||
LetterKey.VK_R => new[] { "ṙ", "ρ", "®", "ℝ" },
|
LetterKey.VK_R => new[] { "ṙ", "ρ", "®", "ℝ" },
|
||||||
LetterKey.VK_S => new[] { "ṡ", "σ", "\u00A7" },
|
LetterKey.VK_S => new[] { "ṡ", "σ", "\u00A7" },
|
||||||
LetterKey.VK_T => new[] { "ţ", "ṫ", "ŧ", "θ", "τ", "™" },
|
LetterKey.VK_T => new[] { "ţ", "ṫ", "ŧ", "θ", "τ", "™" },
|
||||||
LetterKey.VK_U => new[] { "ŭ", "υ" },
|
LetterKey.VK_U => new[] { "ŭ", "υ", "ύ" },
|
||||||
LetterKey.VK_V => new[] { "V̇" },
|
LetterKey.VK_V => new[] { "V̇" },
|
||||||
LetterKey.VK_W => new[] { "ẇ" },
|
LetterKey.VK_W => new[] { "ẇ" },
|
||||||
LetterKey.VK_X => new[] { "ẋ", "ξ", "×" },
|
LetterKey.VK_X => new[] { "ẋ", "ξ", "×" },
|
||||||
@ -260,7 +260,9 @@ namespace PowerAccent.Core
|
|||||||
{
|
{
|
||||||
LetterKey.VK_A => new[] { "á" },
|
LetterKey.VK_A => new[] { "á" },
|
||||||
LetterKey.VK_E => new[] { "é", "€" },
|
LetterKey.VK_E => new[] { "é", "€" },
|
||||||
|
LetterKey.VK_H => new[] { "ḥ" },
|
||||||
LetterKey.VK_I => new[] { "í" },
|
LetterKey.VK_I => new[] { "í" },
|
||||||
|
LetterKey.VK_L => new[] { "ḷ" },
|
||||||
LetterKey.VK_N => new[] { "ñ" },
|
LetterKey.VK_N => new[] { "ñ" },
|
||||||
LetterKey.VK_O => new[] { "ó" },
|
LetterKey.VK_O => new[] { "ó" },
|
||||||
LetterKey.VK_U => new[] { "ú", "ü" },
|
LetterKey.VK_U => new[] { "ú", "ü" },
|
||||||
|
@ -113,9 +113,6 @@
|
|||||||
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
|
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
|
||||||
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\..\common\version\version.vcxproj">
|
|
||||||
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="PowerAccentKeyboardService.rc" />
|
<ResourceCompile Include="PowerAccentKeyboardService.rc" />
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
// IVectorView and IObservableVector define members with the same name, and we must support both interfaces
|
||||||
|
midl_pragma warning(disable : 4066)
|
||||||
|
|
||||||
namespace PowerRenameUI
|
namespace PowerRenameUI
|
||||||
{
|
{
|
||||||
[default_interface] runtimeclass ExplorerItemsSource :
|
[default_interface] runtimeclass ExplorerItemsSource :
|
||||||
|
@ -193,9 +193,6 @@
|
|||||||
<ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj">
|
<ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj">
|
||||||
<Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
|
<Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\..\common\version\version.vcxproj">
|
|
||||||
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\lib\PowerRenameLib.vcxproj">
|
<ProjectReference Include="..\lib\PowerRenameLib.vcxproj">
|
||||||
<Project>{51920f1f-c28c-4adf-8660-4238766796c2}</Project>
|
<Project>{51920f1f-c28c-4adf-8660-4238766796c2}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
x:Name="RootGrid"
|
x:Name="RootGrid"
|
||||||
Background="{ThemeResource AccentButtonBackground}"
|
Background="{ThemeResource AccentButtonBackground}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
|
|
||||||
<Grid.Resources>
|
<Grid.Resources>
|
||||||
<!-- Override the style of the inner buttons so that they don't affect background/foreground/border colors -->
|
<!-- Override the style of the inner buttons so that they don't affect background/foreground/border colors -->
|
||||||
<Style TargetType="Button">
|
<Style TargetType="Button">
|
||||||
@ -52,6 +51,18 @@
|
|||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<Grid x:Name="RootGrid" Background="Transparent">
|
<Grid x:Name="RootGrid" Background="Transparent">
|
||||||
|
<ContentPresenter
|
||||||
|
x:Name="ContentPresenter"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
AnimatedIcon.State="Normal"
|
||||||
|
AutomationProperties.AccessibilityView="Raw"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
Content="{TemplateBinding Content}"
|
||||||
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||||
|
ContentTransitions="{TemplateBinding ContentTransitions}" />
|
||||||
<VisualStateManager.VisualStateGroups>
|
<VisualStateManager.VisualStateGroups>
|
||||||
<VisualStateGroup x:Name="CommonStates">
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
<VisualState x:Name="Normal" />
|
<VisualState x:Name="Normal" />
|
||||||
@ -75,19 +86,6 @@
|
|||||||
</VisualState>
|
</VisualState>
|
||||||
</VisualStateGroup>
|
</VisualStateGroup>
|
||||||
</VisualStateManager.VisualStateGroups>
|
</VisualStateManager.VisualStateGroups>
|
||||||
|
|
||||||
<ContentPresenter
|
|
||||||
x:Name="ContentPresenter"
|
|
||||||
Padding="{TemplateBinding Padding}"
|
|
||||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
||||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
||||||
AnimatedIcon.State="Normal"
|
|
||||||
AutomationProperties.AccessibilityView="Raw"
|
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
|
||||||
Content="{TemplateBinding Content}"
|
|
||||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
||||||
ContentTransitions="{TemplateBinding ContentTransitions}" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
@ -104,6 +102,85 @@
|
|||||||
<ColumnDefinition x:Name="SecondaryButtonColumn" Width="{ThemeResource SplitButtonSecondaryButtonSize}" />
|
<ColumnDefinition x:Name="SecondaryButtonColumn" Width="{ThemeResource SplitButtonSecondaryButtonSize}" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Grid
|
||||||
|
x:Name="PrimaryBackgroundGrid"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
Background="{TemplateBinding Background}" />
|
||||||
|
|
||||||
|
<Grid
|
||||||
|
x:Name="DividerBackgroundGrid"
|
||||||
|
Grid.Column="1"
|
||||||
|
Width="1"
|
||||||
|
Background="{ThemeResource AccentButtonBorderBrush}" />
|
||||||
|
|
||||||
|
<Grid
|
||||||
|
x:Name="SecondaryBackgroundGrid"
|
||||||
|
Grid.Column="2"
|
||||||
|
Background="{TemplateBinding Background}" />
|
||||||
|
|
||||||
|
<Grid
|
||||||
|
x:Name="Border"
|
||||||
|
Grid.ColumnSpan="3"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="{TemplateBinding CornerRadius}" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="PrimaryButton"
|
||||||
|
Grid.Column="0"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
AutomationProperties.AccessibilityView="Raw"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="Transparent"
|
||||||
|
BorderThickness="0"
|
||||||
|
Command="{TemplateBinding Command}"
|
||||||
|
CommandParameter="{TemplateBinding CommandParameter}"
|
||||||
|
Content="{TemplateBinding Content}"
|
||||||
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||||
|
ContentTransitions="{TemplateBinding ContentTransitions}"
|
||||||
|
FontFamily="{TemplateBinding FontFamily}"
|
||||||
|
FontSize="{TemplateBinding FontSize}"
|
||||||
|
FontWeight="{TemplateBinding FontWeight}"
|
||||||
|
Foreground="{TemplateBinding Foreground}"
|
||||||
|
IsTabStop="False" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="SecondaryButton"
|
||||||
|
Grid.Column="2"
|
||||||
|
Padding="0,0,12,0"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
HorizontalContentAlignment="Stretch"
|
||||||
|
VerticalContentAlignment="Stretch"
|
||||||
|
AutomationProperties.AccessibilityView="Raw"
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BorderBrush="Transparent"
|
||||||
|
BorderThickness="0"
|
||||||
|
Foreground="{ThemeResource AccentButtonForeground}"
|
||||||
|
IsTabStop="False">
|
||||||
|
<Button.Content>
|
||||||
|
<AnimatedIcon
|
||||||
|
Width="12"
|
||||||
|
Height="12"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
AutomationProperties.AccessibilityView="Raw">
|
||||||
|
<animatedVisuals:AnimatedChevronDownSmallVisualSource />
|
||||||
|
<AnimatedIcon.FallbackIconSource>
|
||||||
|
<FontIconSource
|
||||||
|
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||||
|
FontSize="8"
|
||||||
|
Glyph=""
|
||||||
|
IsTextScaleFactorEnabled="False" />
|
||||||
|
</AnimatedIcon.FallbackIconSource>
|
||||||
|
</AnimatedIcon>
|
||||||
|
</Button.Content>
|
||||||
|
</Button>
|
||||||
|
|
||||||
<VisualStateManager.VisualStateGroups>
|
<VisualStateManager.VisualStateGroups>
|
||||||
<VisualStateGroup x:Name="CommonStates">
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
<VisualState x:Name="Normal" />
|
<VisualState x:Name="Normal" />
|
||||||
@ -251,85 +328,6 @@
|
|||||||
</VisualState>
|
</VisualState>
|
||||||
</VisualStateGroup>
|
</VisualStateGroup>
|
||||||
</VisualStateManager.VisualStateGroups>
|
</VisualStateManager.VisualStateGroups>
|
||||||
|
|
||||||
<Grid
|
|
||||||
x:Name="PrimaryBackgroundGrid"
|
|
||||||
Grid.ColumnSpan="2"
|
|
||||||
Background="{TemplateBinding Background}" />
|
|
||||||
|
|
||||||
<Grid
|
|
||||||
x:Name="DividerBackgroundGrid"
|
|
||||||
Grid.Column="1"
|
|
||||||
Width="1"
|
|
||||||
Background="{ThemeResource AccentButtonBorderBrush}" />
|
|
||||||
|
|
||||||
<Grid
|
|
||||||
x:Name="SecondaryBackgroundGrid"
|
|
||||||
Grid.Column="2"
|
|
||||||
Background="{TemplateBinding Background}" />
|
|
||||||
|
|
||||||
<Grid
|
|
||||||
x:Name="Border"
|
|
||||||
Grid.ColumnSpan="3"
|
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
|
||||||
CornerRadius="{TemplateBinding CornerRadius}" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
x:Name="PrimaryButton"
|
|
||||||
Grid.Column="0"
|
|
||||||
Padding="{TemplateBinding Padding}"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
||||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
||||||
AutomationProperties.AccessibilityView="Raw"
|
|
||||||
Background="{TemplateBinding Background}"
|
|
||||||
BorderBrush="Transparent"
|
|
||||||
BorderThickness="0"
|
|
||||||
Command="{TemplateBinding Command}"
|
|
||||||
CommandParameter="{TemplateBinding CommandParameter}"
|
|
||||||
Content="{TemplateBinding Content}"
|
|
||||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
|
||||||
ContentTransitions="{TemplateBinding ContentTransitions}"
|
|
||||||
FontFamily="{TemplateBinding FontFamily}"
|
|
||||||
FontSize="{TemplateBinding FontSize}"
|
|
||||||
FontWeight="{TemplateBinding FontWeight}"
|
|
||||||
Foreground="{TemplateBinding Foreground}"
|
|
||||||
IsTabStop="False" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
x:Name="SecondaryButton"
|
|
||||||
Grid.Column="2"
|
|
||||||
Padding="0,0,12,0"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
HorizontalContentAlignment="Stretch"
|
|
||||||
VerticalContentAlignment="Stretch"
|
|
||||||
AutomationProperties.AccessibilityView="Raw"
|
|
||||||
Background="{TemplateBinding Background}"
|
|
||||||
BorderBrush="Transparent"
|
|
||||||
BorderThickness="0"
|
|
||||||
Foreground="{ThemeResource AccentButtonForeground}"
|
|
||||||
IsTabStop="False">
|
|
||||||
<Button.Content>
|
|
||||||
<AnimatedIcon
|
|
||||||
Width="12"
|
|
||||||
Height="12"
|
|
||||||
HorizontalAlignment="Right"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
AutomationProperties.AccessibilityView="Raw">
|
|
||||||
<animatedVisuals:AnimatedChevronDownSmallVisualSource />
|
|
||||||
<AnimatedIcon.FallbackIconSource>
|
|
||||||
<FontIconSource
|
|
||||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
|
||||||
FontSize="8"
|
|
||||||
Glyph=""
|
|
||||||
IsTextScaleFactorEnabled="False" />
|
|
||||||
</AnimatedIcon.FallbackIconSource>
|
|
||||||
</AnimatedIcon>
|
|
||||||
</Button.Content>
|
|
||||||
</Button>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
@ -371,6 +369,16 @@
|
|||||||
BorderBrush="{ThemeResource TextControlButtonBorderBrush}"
|
BorderBrush="{ThemeResource TextControlButtonBorderBrush}"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
CornerRadius="{ThemeResource ControlCornerRadius}">
|
CornerRadius="{ThemeResource ControlCornerRadius}">
|
||||||
|
<TextBlock
|
||||||
|
x:Name="GlyphElement"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
AutomationProperties.AccessibilityView="Raw"
|
||||||
|
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||||
|
FontSize="{ThemeResource AutoSuggestBoxIconFontSize}"
|
||||||
|
FontStyle="Normal"
|
||||||
|
Foreground="{ThemeResource TextControlButtonForeground}"
|
||||||
|
Text="" />
|
||||||
<VisualStateManager.VisualStateGroups>
|
<VisualStateManager.VisualStateGroups>
|
||||||
<VisualStateGroup x:Name="CommonStates">
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
<VisualState x:Name="Normal" />
|
<VisualState x:Name="Normal" />
|
||||||
@ -414,16 +422,6 @@
|
|||||||
</VisualState>
|
</VisualState>
|
||||||
</VisualStateGroup>
|
</VisualStateGroup>
|
||||||
</VisualStateManager.VisualStateGroups>
|
</VisualStateManager.VisualStateGroups>
|
||||||
<TextBlock
|
|
||||||
x:Name="GlyphElement"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
AutomationProperties.AccessibilityView="Raw"
|
|
||||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
|
||||||
FontSize="{ThemeResource AutoSuggestBoxIconFontSize}"
|
|
||||||
FontStyle="Normal"
|
|
||||||
Foreground="{ThemeResource TextControlButtonForeground}"
|
|
||||||
Text="" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
@ -518,92 +516,6 @@
|
|||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<VisualStateManager.VisualStateGroups>
|
|
||||||
<VisualStateGroup x:Name="CommonStates">
|
|
||||||
|
|
||||||
<VisualState x:Name="Disabled">
|
|
||||||
|
|
||||||
<Storyboard>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderContentPresenter" Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlHeaderForegroundDisabled}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundDisabled}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushDisabled}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundDisabled}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundDisabled}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
</Storyboard>
|
|
||||||
</VisualState>
|
|
||||||
<VisualState x:Name="Normal" />
|
|
||||||
|
|
||||||
<VisualState x:Name="PointerOver">
|
|
||||||
|
|
||||||
<Storyboard>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushPointerOver}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundPointerOver}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundPointerOver}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundPointerOver}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
</Storyboard>
|
|
||||||
</VisualState>
|
|
||||||
<VisualState x:Name="Focused">
|
|
||||||
|
|
||||||
<Storyboard>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundFocused}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundFocused}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushFocused}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderThickness">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderThemeThicknessFocused}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundFocused}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="QueryButton" Storyboard.TargetProperty="Foreground">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForeground}" />
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
</Storyboard>
|
|
||||||
</VisualState>
|
|
||||||
|
|
||||||
</VisualStateGroup>
|
|
||||||
<VisualStateGroup x:Name="ButtonStates">
|
|
||||||
<VisualState x:Name="ButtonVisible">
|
|
||||||
|
|
||||||
<Storyboard>
|
|
||||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeleteButton" Storyboard.TargetProperty="Visibility">
|
|
||||||
<DiscreteObjectKeyFrame KeyTime="0">
|
|
||||||
<DiscreteObjectKeyFrame.Value>
|
|
||||||
<Visibility>Visible</Visibility>
|
|
||||||
</DiscreteObjectKeyFrame.Value>
|
|
||||||
</DiscreteObjectKeyFrame>
|
|
||||||
</ObjectAnimationUsingKeyFrames>
|
|
||||||
</Storyboard>
|
|
||||||
</VisualState>
|
|
||||||
<VisualState x:Name="ButtonCollapsed" />
|
|
||||||
|
|
||||||
</VisualStateGroup>
|
|
||||||
|
|
||||||
</VisualStateManager.VisualStateGroups>
|
|
||||||
<Border
|
<Border
|
||||||
x:Name="BorderElement"
|
x:Name="BorderElement"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
@ -692,6 +604,91 @@
|
|||||||
Content="{TemplateBinding Description}"
|
Content="{TemplateBinding Description}"
|
||||||
Foreground="{ThemeResource SystemControlDescriptionTextForegroundBrush}" />
|
Foreground="{ThemeResource SystemControlDescriptionTextForegroundBrush}" />
|
||||||
|
|
||||||
|
<VisualStateManager.VisualStateGroups>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
|
||||||
|
<VisualState x:Name="Disabled">
|
||||||
|
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlHeaderForegroundDisabled}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundDisabled}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushDisabled}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundDisabled}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundDisabled}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
|
||||||
|
<VisualState x:Name="PointerOver">
|
||||||
|
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushPointerOver}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundPointerOver}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundPointerOver}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundPointerOver}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Focused">
|
||||||
|
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PlaceholderTextContentPresenter" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlPlaceholderForegroundFocused}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="Background">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBackgroundFocused}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderBrush">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderBrushFocused}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard.TargetProperty="BorderThickness">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlBorderThemeThicknessFocused}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlForegroundFocused}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="QueryButton" Storyboard.TargetProperty="Foreground">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TextControlButtonForeground}" />
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
|
||||||
|
</VisualStateGroup>
|
||||||
|
<VisualStateGroup x:Name="ButtonStates">
|
||||||
|
<VisualState x:Name="ButtonVisible">
|
||||||
|
|
||||||
|
<Storyboard>
|
||||||
|
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeleteButton" Storyboard.TargetProperty="Visibility">
|
||||||
|
<DiscreteObjectKeyFrame KeyTime="0">
|
||||||
|
<DiscreteObjectKeyFrame.Value>
|
||||||
|
<Visibility>Visible</Visibility>
|
||||||
|
</DiscreteObjectKeyFrame.Value>
|
||||||
|
</DiscreteObjectKeyFrame>
|
||||||
|
</ObjectAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="ButtonCollapsed" />
|
||||||
|
|
||||||
|
</VisualStateGroup>
|
||||||
|
|
||||||
|
</VisualStateManager.VisualStateGroups>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
@ -719,7 +716,6 @@
|
|||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="AutoSuggestBox">
|
<ControlTemplate TargetType="AutoSuggestBox">
|
||||||
<Grid x:Name="LayoutRoot">
|
<Grid x:Name="LayoutRoot">
|
||||||
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
@ -728,14 +724,6 @@
|
|||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<VisualStateManager.VisualStateGroups>
|
|
||||||
<VisualStateGroup x:Name="Orientation">
|
|
||||||
<VisualState x:Name="Landscape" />
|
|
||||||
<VisualState x:Name="Portrait" />
|
|
||||||
</VisualStateGroup>
|
|
||||||
|
|
||||||
</VisualStateManager.VisualStateGroups>
|
|
||||||
|
|
||||||
<TextBox
|
<TextBox
|
||||||
x:Name="TextBox"
|
x:Name="TextBox"
|
||||||
Width="{TemplateBinding Width}"
|
Width="{TemplateBinding Width}"
|
||||||
@ -781,6 +769,13 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</Popup>
|
</Popup>
|
||||||
|
|
||||||
|
<VisualStateManager.VisualStateGroups>
|
||||||
|
<VisualStateGroup x:Name="Orientation">
|
||||||
|
<VisualState x:Name="Landscape" />
|
||||||
|
<VisualState x:Name="Portrait" />
|
||||||
|
</VisualStateGroup>
|
||||||
|
|
||||||
|
</VisualStateManager.VisualStateGroups>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
|
@ -17,27 +17,6 @@
|
|||||||
<!-- Error tooltip -->
|
<!-- Error tooltip -->
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<VisualStateManager.VisualStateGroups>
|
|
||||||
<VisualStateGroup x:Name="CommonStates">
|
|
||||||
<VisualState x:Name="Normal" />
|
|
||||||
<VisualState x:Name="Highlight">
|
|
||||||
<VisualState.Setters>
|
|
||||||
<Setter Target="HighlightBorder.Opacity" Value="0.1" />
|
|
||||||
<Setter Target="HighlightBorder.BorderBrush" Value="{ThemeResource AccentTextFillColorPrimaryBrush}" />
|
|
||||||
<Setter Target="HighlightBorder.Background" Value="{ThemeResource AccentTextFillColorPrimaryBrush}" />
|
|
||||||
</VisualState.Setters>
|
|
||||||
</VisualState>
|
|
||||||
<VisualState x:Name="Error">
|
|
||||||
<VisualState.Setters>
|
|
||||||
<Setter Target="HighlightBorder.Opacity" Value="1" />
|
|
||||||
<Setter Target="HighlightBorder.BorderBrush" Value="{ThemeResource SystemFillColorCriticalBackgroundBrush}" />
|
|
||||||
<Setter Target="HighlightBorder.Background" Value="{ThemeResource SystemFillColorCriticalBackgroundBrush}" />
|
|
||||||
<Setter Target="ErrorIcon.Visibility" Value="Visible" />
|
|
||||||
</VisualState.Setters>
|
|
||||||
</VisualState>
|
|
||||||
</VisualStateGroup>
|
|
||||||
</VisualStateManager.VisualStateGroups>
|
|
||||||
|
|
||||||
<Border
|
<Border
|
||||||
Name="HighlightBorder"
|
Name="HighlightBorder"
|
||||||
Grid.ColumnSpan="4"
|
Grid.ColumnSpan="4"
|
||||||
@ -121,5 +100,26 @@
|
|||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
</ToolTipService.ToolTip>
|
</ToolTipService.ToolTip>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
<VisualStateManager.VisualStateGroups>
|
||||||
|
<VisualStateGroup x:Name="CommonStates">
|
||||||
|
<VisualState x:Name="Normal" />
|
||||||
|
<VisualState x:Name="Highlight">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="HighlightBorder.Opacity" Value="0.1" />
|
||||||
|
<Setter Target="HighlightBorder.BorderBrush" Value="{ThemeResource AccentTextFillColorPrimaryBrush}" />
|
||||||
|
<Setter Target="HighlightBorder.Background" Value="{ThemeResource AccentTextFillColorPrimaryBrush}" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
<VisualState x:Name="Error">
|
||||||
|
<VisualState.Setters>
|
||||||
|
<Setter Target="HighlightBorder.Opacity" Value="1" />
|
||||||
|
<Setter Target="HighlightBorder.BorderBrush" Value="{ThemeResource SystemFillColorCriticalBackgroundBrush}" />
|
||||||
|
<Setter Target="HighlightBorder.Background" Value="{ThemeResource SystemFillColorCriticalBackgroundBrush}" />
|
||||||
|
<Setter Target="ErrorIcon.Visibility" Value="Visible" />
|
||||||
|
</VisualState.Setters>
|
||||||
|
</VisualState>
|
||||||
|
</VisualStateGroup>
|
||||||
|
</VisualStateManager.VisualStateGroups>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
@ -366,26 +366,27 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListView.ItemTemplate>
|
</ListView.ItemTemplate>
|
||||||
</ListView>
|
</ListView>
|
||||||
<TextBlock x:Uid="CounterCheatSheet_Title"
|
<TextBlock
|
||||||
|
x:Uid="CounterCheatSheet_Title"
|
||||||
|
Grid.Row="2"
|
||||||
Margin="0,10,0,0"
|
Margin="0,10,0,0"
|
||||||
FontWeight="SemiBold" Grid.Row="2" />
|
FontWeight="SemiBold" />
|
||||||
<ListView Margin="-4,12,0,0"
|
<ListView
|
||||||
|
Grid.Row="3"
|
||||||
|
Margin="-4,12,0,0"
|
||||||
IsItemClickEnabled="True"
|
IsItemClickEnabled="True"
|
||||||
ItemClick="DateTimeItemClick"
|
ItemClick="DateTimeItemClick"
|
||||||
ItemsSource="{x:Bind CounterShortcuts}"
|
ItemsSource="{x:Bind CounterShortcuts}"
|
||||||
SelectionMode="None" Grid.Row="3">
|
SelectionMode="None">
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
<DataTemplate
|
<DataTemplate x:DataType="local:PatternSnippet">
|
||||||
x:DataType="local:PatternSnippet">
|
<Grid Margin="-10,0,0,0" ColumnSpacing="8">
|
||||||
<Grid Margin="-10,0,0,0"
|
|
||||||
ColumnSpacing="8">
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition
|
<ColumnDefinition Width="Auto" />
|
||||||
Width="Auto" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition
|
|
||||||
Width="*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Border Padding="8"
|
<Border
|
||||||
|
Padding="8"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Background="{ThemeResource ButtonBackground}"
|
Background="{ThemeResource ButtonBackground}"
|
||||||
BorderBrush="{ThemeResource ButtonBorderBrush}"
|
BorderBrush="{ThemeResource ButtonBorderBrush}"
|
||||||
@ -396,7 +397,8 @@
|
|||||||
Foreground="{ThemeResource ButtonForeground}"
|
Foreground="{ThemeResource ButtonForeground}"
|
||||||
Text="{x:Bind Code}" />
|
Text="{x:Bind Code}" />
|
||||||
</Border>
|
</Border>
|
||||||
<TextBlock Grid.Column="1"
|
<TextBlock
|
||||||
|
Grid.Column="1"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
FontSize="12"
|
FontSize="12"
|
||||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||||
|
@ -63,9 +63,6 @@
|
|||||||
<ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj">
|
<ProjectReference Include="..\..\..\common\Themes\Themes.vcxproj">
|
||||||
<Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
|
<Project>{98537082-0fdb-40de-abd8-0dc5a4269bab}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\..\common\version\version.vcxproj">
|
|
||||||
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\lib\PowerRenameLib.vcxproj">
|
<ProjectReference Include="..\lib\PowerRenameLib.vcxproj">
|
||||||
<Project>{51920f1f-c28c-4adf-8660-4238766796c2}</Project>
|
<Project>{51920f1f-c28c-4adf-8660-4238766796c2}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
@ -165,7 +165,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Monaco
|
|||||||
}
|
}
|
||||||
catch (NullReferenceException e)
|
catch (NullReferenceException e)
|
||||||
{
|
{
|
||||||
Logger.LogError("NullReferenceException catched. Skipping exception.", e);
|
Logger.LogError("NullReferenceException caught. Skipping exception.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (WebView2RuntimeNotFoundException e)
|
catch (WebView2RuntimeNotFoundException e)
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 27.5.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
|
||||||
|
<!-- Generator: Adobe Illustrator 27.5.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg viewBox="0 0 100 100"
|
||||||
|
xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="50"
|
||||||
|
cy="50"
|
||||||
|
fill="rgba(0, 0, 255, 1)"
|
||||||
|
r="50">
|
||||||
|
<script>alert("valid-message")</script>
|
||||||
|
</circle>
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<!-- Generator: Adobe Illustrator 27.5.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
After Width: | Height: | Size: 552 B |
@ -4,14 +4,12 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.InteropServices.ComTypes;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Common.ComInterlop;
|
|
||||||
using Microsoft.PowerToys.STATestExtension;
|
using Microsoft.PowerToys.STATestExtension;
|
||||||
using Microsoft.PowerToys.ThumbnailHandler.Svg;
|
using Microsoft.PowerToys.ThumbnailHandler.Svg;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Moq;
|
|
||||||
|
|
||||||
namespace SvgThumbnailProviderUnitTests
|
namespace SvgThumbnailProviderUnitTests
|
||||||
{
|
{
|
||||||
@ -211,5 +209,17 @@ namespace SvgThumbnailProviderUnitTests
|
|||||||
|
|
||||||
Assert.IsTrue(bitmap != null);
|
Assert.IsTrue(bitmap != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void SvgCommentsAreHandledCorrectly()
|
||||||
|
{
|
||||||
|
var filePath = "HelperFiles/WithComments.svg";
|
||||||
|
|
||||||
|
SvgThumbnailProvider svgThumbnailProvider = new SvgThumbnailProvider(filePath);
|
||||||
|
|
||||||
|
Bitmap bitmap = svgThumbnailProvider.GetThumbnail(8);
|
||||||
|
|
||||||
|
Assert.IsTrue(bitmap != null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,15 +38,19 @@
|
|||||||
<ProjectReference Include="..\SvgThumbnailProvider\SvgThumbnailProvider.csproj" />
|
<ProjectReference Include="..\SvgThumbnailProvider\SvgThumbnailProvider.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="..\STATestClassAttribute.cs" Link="STATestClassAttribute.cs" />
|
<Compile Include="..\STATestClassAttribute.cs"
|
||||||
<Compile Include="..\STATestMethodAttribute.cs" Link="STATestMethodAttribute.cs" />
|
Link="STATestClassAttribute.cs" />
|
||||||
|
<Compile Include="..\STATestMethodAttribute.cs"
|
||||||
|
Link="STATestMethodAttribute.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="HelperFiles\file1.svg">
|
<Content Include="HelperFiles\*.svg">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="HelperFiles\file2.svg">
|
<Content Include="HelperFiles\*.bmp">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -119,7 +119,7 @@ namespace Common.Utilities
|
|||||||
|
|
||||||
while ((index = s.IndexOf('<', index)) != -1)
|
while ((index = s.IndexOf('<', index)) != -1)
|
||||||
{
|
{
|
||||||
if (index < s.Length - 1 && s[index + 1] != '?')
|
if (index < s.Length - 1 && s[index + 1] != '?' && s[index + 1] != '!')
|
||||||
{
|
{
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
@ -130,11 +130,11 @@ namespace Common.Utilities
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int FindFirstXmlCloseTagIndex(string s)
|
private static int FindFirstXmlCloseTagIndex(string s, int openTagIndex)
|
||||||
{
|
{
|
||||||
int index = 1;
|
int index = 1;
|
||||||
|
|
||||||
while ((index = s.IndexOf('>', index)) != -1)
|
while ((index = s.IndexOf('>', openTagIndex)) != -1)
|
||||||
{
|
{
|
||||||
if (index > 0 && s[index - 1] != '?')
|
if (index > 0 && s[index - 1] != '?')
|
||||||
{
|
{
|
||||||
@ -160,7 +160,7 @@ namespace Common.Utilities
|
|||||||
return stringSvgData;
|
return stringSvgData;
|
||||||
}
|
}
|
||||||
|
|
||||||
int firstXmlCloseTagIndex = FindFirstXmlCloseTagIndex(stringSvgData);
|
int firstXmlCloseTagIndex = FindFirstXmlCloseTagIndex(stringSvgData, firstXmlOpenTagIndex);
|
||||||
if (firstXmlCloseTagIndex == -1)
|
if (firstXmlCloseTagIndex == -1)
|
||||||
{
|
{
|
||||||
return stringSvgData;
|
return stringSvgData;
|
||||||
@ -192,13 +192,18 @@ namespace Common.Utilities
|
|||||||
styleIndex -= numRemoved;
|
styleIndex -= numRemoved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
firstXmlCloseTagIndex -= numRemoved;
|
||||||
|
|
||||||
stringSvgData = RemoveAttribute(stringSvgData, heightIndex, HeightAttribute, out numRemoved);
|
stringSvgData = RemoveAttribute(stringSvgData, heightIndex, HeightAttribute, out numRemoved);
|
||||||
if (styleIndex != -1 && styleIndex > heightIndex)
|
if (styleIndex != -1 && styleIndex > heightIndex)
|
||||||
{
|
{
|
||||||
styleIndex -= numRemoved;
|
styleIndex -= numRemoved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
firstXmlCloseTagIndex -= numRemoved;
|
||||||
|
|
||||||
stringSvgData = RemoveAttribute(stringSvgData, styleIndex, StyleAttribute, out numRemoved);
|
stringSvgData = RemoveAttribute(stringSvgData, styleIndex, StyleAttribute, out numRemoved);
|
||||||
|
firstXmlCloseTagIndex -= numRemoved;
|
||||||
|
|
||||||
width = CheckUnit(width);
|
width = CheckUnit(width);
|
||||||
height = CheckUnit(height);
|
height = CheckUnit(height);
|
||||||
@ -213,7 +218,7 @@ namespace Common.Utilities
|
|||||||
scaling += $" _height:expression(this.scrollHeight > {heightR} ? " {height}" : "auto"); _width:expression(this.scrollWidth > {widthR} ? "{width}" : "auto");";
|
scaling += $" _height:expression(this.scrollHeight > {heightR} ? " {height}" : "auto"); _width:expression(this.scrollWidth > {widthR} ? "{width}" : "auto");";
|
||||||
|
|
||||||
string newStyle = $"style=\"{scaling}{centering}{oldStyle}\"";
|
string newStyle = $"style=\"{scaling}{centering}{oldStyle}\"";
|
||||||
int insertAt = stringSvgData.IndexOf(">", StringComparison.InvariantCultureIgnoreCase);
|
int insertAt = firstXmlCloseTagIndex;
|
||||||
|
|
||||||
stringSvgData = stringSvgData.Insert(insertAt, " " + newStyle);
|
stringSvgData = stringSvgData.Insert(insertAt, " " + newStyle);
|
||||||
|
|
||||||
|
@ -55,6 +55,12 @@ namespace RegistryPreview
|
|||||||
resourceLoader.GetString("YesNoCancelDialogCloseButtonText"));
|
resourceLoader.GetString("YesNoCancelDialogCloseButtonText"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check to see if the textbox's context menu is open
|
||||||
|
if (textBox.ContextFlyout != null && textBox.ContextFlyout.IsOpen)
|
||||||
|
{
|
||||||
|
textBox.ContextFlyout.Hide();
|
||||||
|
}
|
||||||
|
|
||||||
// Save window placement
|
// Save window placement
|
||||||
SaveWindowPlacementFile(settingsFolder, windowPlacementFile);
|
SaveWindowPlacementFile(settingsFolder, windowPlacementFile);
|
||||||
}
|
}
|
||||||
|
@ -292,13 +292,20 @@ namespace RegistryPreview
|
|||||||
|
|
||||||
// set the name and the value
|
// set the name and the value
|
||||||
string name = registryLine.Substring(0, equal);
|
string name = registryLine.Substring(0, equal);
|
||||||
|
|
||||||
|
// trim the whitespace and quotes from the name
|
||||||
|
name = name.Trim();
|
||||||
name = StripFirstAndLast(name);
|
name = StripFirstAndLast(name);
|
||||||
|
|
||||||
// Clean out any escaped characters in the value, only for the preview
|
// Clean out any escaped characters in the value, only for the preview
|
||||||
name = StripEscapedCharacters(name);
|
name = StripEscapedCharacters(name);
|
||||||
|
|
||||||
|
// set the value
|
||||||
string value = registryLine.Substring(equal + 1);
|
string value = registryLine.Substring(equal + 1);
|
||||||
|
|
||||||
|
// trim the whitespace from the value
|
||||||
|
value = value.Trim();
|
||||||
|
|
||||||
// Create a new listview item that will be used to display the value
|
// Create a new listview item that will be used to display the value
|
||||||
registryValue = new RegistryValue(name, "REG_SZ", string.Empty);
|
registryValue = new RegistryValue(name, "REG_SZ", string.Empty);
|
||||||
|
|
||||||
@ -1027,10 +1034,13 @@ namespace RegistryPreview
|
|||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if (jsonWindowPlacement != null)
|
||||||
{
|
{
|
||||||
fileContents = jsonWindowPlacement.Stringify();
|
fileContents = jsonWindowPlacement.Stringify();
|
||||||
await Windows.Storage.FileIO.WriteTextAsync(storageFile, fileContents);
|
await Windows.Storage.FileIO.WriteTextAsync(storageFile, fileContents);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Debug.WriteLine(ex.Message);
|
Debug.WriteLine(ex.Message);
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Web;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.Windows.AppLifecycle;
|
using Microsoft.Windows.AppLifecycle;
|
||||||
using Windows.ApplicationModel.Activation;
|
using Windows.ApplicationModel.Activation;
|
||||||
@ -52,6 +53,20 @@ namespace RegistryPreview
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (activatedArgs.Kind == ExtendedActivationKind.Protocol)
|
||||||
|
{
|
||||||
|
// When the app is the default handler for REG files and the filename has non-ASCII characters, the app gets activated by Protocol
|
||||||
|
AppFilename = string.Empty;
|
||||||
|
if (activatedArgs.Data != null)
|
||||||
|
{
|
||||||
|
IProtocolActivatedEventArgs eventArgs = (IProtocolActivatedEventArgs)activatedArgs.Data;
|
||||||
|
if (eventArgs.Uri.AbsoluteUri.Length > 0)
|
||||||
|
{
|
||||||
|
AppFilename = eventArgs.Uri.Query.Replace("?ContractId=Windows.File&Verb=open&File=", string.Empty);
|
||||||
|
AppFilename = HttpUtility.UrlDecode(AppFilename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Right click on a REG file and selected Preview
|
// Right click on a REG file and selected Preview
|
||||||
|
@ -50,12 +50,12 @@ bool VideoConferenceModule::isHotkeyPressed(DWORD code, PowerToysSettings::Hotke
|
|||||||
|
|
||||||
void VideoConferenceModule::reverseMicrophoneMute()
|
void VideoConferenceModule::reverseMicrophoneMute()
|
||||||
{
|
{
|
||||||
bool muted = false;
|
// All controlled mic should same state with _microphoneTrackedInUI
|
||||||
|
// Avoid manually change in Control Panel make controlled mic has different state
|
||||||
|
bool muted = !getMicrophoneMuteState();
|
||||||
for (auto& controlledMic : instance->_controlledMicrophones)
|
for (auto& controlledMic : instance->_controlledMicrophones)
|
||||||
{
|
{
|
||||||
const bool was_muted = controlledMic->muted();
|
controlledMic->set_muted(muted);
|
||||||
controlledMic->toggle_muted();
|
|
||||||
muted = muted || !was_muted;
|
|
||||||
}
|
}
|
||||||
if (muted)
|
if (muted)
|
||||||
{
|
{
|
||||||
@ -283,6 +283,10 @@ void VideoConferenceModule::onModuleSettingsChanged()
|
|||||||
{
|
{
|
||||||
toolbar.setToolbarHide(val.value());
|
toolbar.setToolbarHide(val.value());
|
||||||
}
|
}
|
||||||
|
if (const auto val = values.get_string_value(L"startup_action"))
|
||||||
|
{
|
||||||
|
settings.startupAction = val.value();
|
||||||
|
}
|
||||||
|
|
||||||
const auto selectedMic = values.get_string_value(L"selected_mic");
|
const auto selectedMic = values.get_string_value(L"selected_mic");
|
||||||
if (selectedMic && selectedMic != settings.selectedMicrophone)
|
if (selectedMic && selectedMic != settings.selectedMicrophone)
|
||||||
@ -308,7 +312,7 @@ void VideoConferenceModule::onMicrophoneConfigurationChanged()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool mutedStateForNewMics = _microphoneTrackedInUI ? _microphoneTrackedInUI->muted() : _mic_muted_state_during_disconnect;
|
const bool mutedStateForNewMics = getMicrophoneMuteState();
|
||||||
std::unordered_set<std::wstring_view> currentlyTrackedMicsIds;
|
std::unordered_set<std::wstring_view> currentlyTrackedMicsIds;
|
||||||
for (const auto& controlledMic : _controlledMicrophones)
|
for (const auto& controlledMic : _controlledMicrophones)
|
||||||
{
|
{
|
||||||
@ -338,6 +342,7 @@ void VideoConferenceModule::onMicrophoneConfigurationChanged()
|
|||||||
toolbar.setMicrophoneMute(muted);
|
toolbar.setMicrophoneMute(muted);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
setMuteChangedCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoConferenceModule::VideoConferenceModule()
|
VideoConferenceModule::VideoConferenceModule()
|
||||||
@ -401,6 +406,25 @@ void VideoConferenceModule::set_config(const wchar_t* config)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VideoConferenceModule::setMuteChangedCallback()
|
||||||
|
{
|
||||||
|
// Keep all controlledMic mute state same _microphoneTrackedInUI
|
||||||
|
// Should not change manually in Control Panel
|
||||||
|
for (const auto& controlledMic : _controlledMicrophones)
|
||||||
|
{
|
||||||
|
if (controlledMic->id() != _microphoneTrackedInUI->id())
|
||||||
|
{
|
||||||
|
controlledMic->set_mute_changed_callback([&](const bool muted) {
|
||||||
|
auto muteState = getMicrophoneMuteState();
|
||||||
|
if (muted != muteState)
|
||||||
|
{
|
||||||
|
controlledMic->set_muted(muteState);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void VideoConferenceModule::init_settings()
|
void VideoConferenceModule::init_settings()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -447,6 +471,10 @@ void VideoConferenceModule::init_settings()
|
|||||||
{
|
{
|
||||||
toolbar.setToolbarHide(val.value());
|
toolbar.setToolbarHide(val.value());
|
||||||
}
|
}
|
||||||
|
if (const auto val = powerToysSettings.get_string_value(L"startup_action"))
|
||||||
|
{
|
||||||
|
settings.startupAction = val.value();
|
||||||
|
}
|
||||||
if (const auto val = powerToysSettings.get_string_value(L"selected_mic"); val && *val != settings.selectedMicrophone)
|
if (const auto val = powerToysSettings.get_string_value(L"selected_mic"); val && *val != settings.selectedMicrophone)
|
||||||
{
|
{
|
||||||
settings.selectedMicrophone = *val;
|
settings.selectedMicrophone = *val;
|
||||||
@ -509,6 +537,22 @@ void VideoConferenceModule::updateControlledMicrophones(const std::wstring_view
|
|||||||
});
|
});
|
||||||
toolbar.setMicrophoneMute(_microphoneTrackedInUI->muted());
|
toolbar.setMicrophoneMute(_microphoneTrackedInUI->muted());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settings.startupAction == L"Unmute")
|
||||||
|
{
|
||||||
|
for (auto& controlledMic : _controlledMicrophones)
|
||||||
|
{
|
||||||
|
controlledMic->set_muted(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (settings.startupAction == L"Mute")
|
||||||
|
{
|
||||||
|
for (auto& controlledMic : _controlledMicrophones)
|
||||||
|
{
|
||||||
|
controlledMic->set_muted(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setMuteChangedCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
MicrophoneDevice* VideoConferenceModule::controlledDefaultMic()
|
MicrophoneDevice* VideoConferenceModule::controlledDefaultMic()
|
||||||
@ -669,6 +713,14 @@ void VideoConferenceModule::sendSourceCameraNameUpdate()
|
|||||||
auto updatesChannel = reinterpret_cast<CameraSettingsUpdateChannel*>(memory._data);
|
auto updatesChannel = reinterpret_cast<CameraSettingsUpdateChannel*>(memory._data);
|
||||||
updatesChannel->sourceCameraName.emplace();
|
updatesChannel->sourceCameraName.emplace();
|
||||||
std::copy(begin(settings.selectedCamera), end(settings.selectedCamera), begin(*updatesChannel->sourceCameraName));
|
std::copy(begin(settings.selectedCamera), end(settings.selectedCamera), begin(*updatesChannel->sourceCameraName));
|
||||||
|
if (settings.startupAction == L"Unmute")
|
||||||
|
{
|
||||||
|
updatesChannel->useOverlayImage = false;
|
||||||
|
}
|
||||||
|
else if (settings.startupAction == L"Mute")
|
||||||
|
{
|
||||||
|
updatesChannel->useOverlayImage = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@ struct VideoConferenceSettings
|
|||||||
std::wstring imageOverlayPath;
|
std::wstring imageOverlayPath;
|
||||||
std::wstring selectedMicrophone;
|
std::wstring selectedMicrophone;
|
||||||
|
|
||||||
|
std::wstring startupAction;
|
||||||
|
|
||||||
bool pushToReverseEnabled = false;
|
bool pushToReverseEnabled = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -71,6 +73,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void setMuteChangedCallback();
|
||||||
void init_settings();
|
void init_settings();
|
||||||
void updateControlledMicrophones(const std::wstring_view new_mic);
|
void updateControlledMicrophones(const std::wstring_view new_mic);
|
||||||
MicrophoneDevice* controlledDefaultMic();
|
MicrophoneDevice* controlledDefaultMic();
|
||||||
|
@ -140,6 +140,9 @@
|
|||||||
<ProjectReference Include="..\VideoConferenceShared\VideoConferenceShared.vcxproj">
|
<ProjectReference Include="..\VideoConferenceShared\VideoConferenceShared.vcxproj">
|
||||||
<Project>{459e0768-7ebd-4c41-bba1-6db3b3815e0a}</Project>
|
<Project>{459e0768-7ebd-4c41-bba1-6db3b3815e0a}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\..\common\version\version.vcxproj">
|
||||||
|
<Project>{cc6e41ac-8174-4e8a-8d22-85dd7f4851df}</Project>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
@ -53,11 +53,6 @@ bool MicrophoneDevice::muted() const noexcept
|
|||||||
return muted;
|
return muted;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MicrophoneDevice::toggle_muted() noexcept
|
|
||||||
{
|
|
||||||
set_muted(!muted());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::wstring_view MicrophoneDevice::id() const noexcept
|
std::wstring_view MicrophoneDevice::id() const noexcept
|
||||||
{
|
{
|
||||||
return _id ? _id.get() : FALLBACK_ID;
|
return _id ? _id.get() : FALLBACK_ID;
|
||||||
@ -70,6 +65,10 @@ std::wstring_view MicrophoneDevice::name() const noexcept
|
|||||||
|
|
||||||
void MicrophoneDevice::set_mute_changed_callback(mute_changed_cb_t callback) noexcept
|
void MicrophoneDevice::set_mute_changed_callback(mute_changed_cb_t callback) noexcept
|
||||||
{
|
{
|
||||||
|
if (_notifier)
|
||||||
|
{
|
||||||
|
_endpoint->UnregisterControlChangeNotify(_notifier.get());
|
||||||
|
}
|
||||||
_mute_changed_callback = std::move(callback);
|
_mute_changed_callback = std::move(callback);
|
||||||
_notifier = winrt::make<VolumeNotifier>(this);
|
_notifier = winrt::make<VolumeNotifier>(this);
|
||||||
|
|
||||||
|
@ -54,7 +54,6 @@ public:
|
|||||||
bool active() const noexcept;
|
bool active() const noexcept;
|
||||||
void set_muted(const bool muted) noexcept;
|
void set_muted(const bool muted) noexcept;
|
||||||
bool muted() const noexcept;
|
bool muted() const noexcept;
|
||||||
void toggle_muted() noexcept;
|
|
||||||
|
|
||||||
std::wstring_view id() const noexcept;
|
std::wstring_view id() const noexcept;
|
||||||
std::wstring_view name() const noexcept;
|
std::wstring_view name() const noexcept;
|
||||||
|
@ -51,7 +51,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
[JsonPropertyName("activationaction")]
|
[JsonPropertyName("activationaction")]
|
||||||
public ColorPickerActivationAction ActivationAction { get; set; }
|
public ColorPickerActivationAction ActivationAction { get; set; }
|
||||||
|
|
||||||
// Property ColorHistory is not used, the color history is saved separatedly in the colorHistory.json file
|
// Property ColorHistory is not used, the color history is saved separately in the colorHistory.json file
|
||||||
[JsonPropertyName("colorhistory")]
|
[JsonPropertyName("colorhistory")]
|
||||||
public List<string> ColorHistory { get; set; }
|
public List<string> ColorHistory { get; set; }
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace Microsoft.PowerToys.Settings.UI.Library.Enumerations
|
namespace Microsoft.PowerToys.Settings.UI.Library.Enumerations
|
||||||
{
|
{
|
||||||
// NOTE: don't change the order (numbers) of the enumeration entires
|
// NOTE: don't change the order (numbers) of the enumeration entries
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The type of the color representation
|
/// The type of the color representation
|
||||||
|
@ -292,9 +292,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get data needed for process
|
// get data needed for process
|
||||||
var backupRetoreSettings = JsonNode.Parse(GetBackupRestoreSettingsJson());
|
var backupRestoreSettings = JsonNode.Parse(GetBackupRestoreSettingsJson());
|
||||||
var currentSettingsFiles = GetSettingsFiles(backupRetoreSettings, appBasePath).ToList().ToDictionary(x => x.Substring(appBasePath.Length));
|
var currentSettingsFiles = GetSettingsFiles(backupRestoreSettings, appBasePath).ToList().ToDictionary(x => x.Substring(appBasePath.Length));
|
||||||
var backupSettingsFiles = GetSettingsFiles(backupRetoreSettings, latestSettingsFolder).ToList().ToDictionary(x => x.Substring(latestSettingsFolder.Length));
|
var backupSettingsFiles = GetSettingsFiles(backupRestoreSettings, latestSettingsFolder).ToList().ToDictionary(x => x.Substring(latestSettingsFolder.Length));
|
||||||
|
|
||||||
if (backupSettingsFiles.Count == 0)
|
if (backupSettingsFiles.Count == 0)
|
||||||
{
|
{
|
||||||
@ -306,13 +306,13 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
foreach (var currentFile in backupSettingsFiles)
|
foreach (var currentFile in backupSettingsFiles)
|
||||||
{
|
{
|
||||||
var relativePath = currentFile.Value.Substring(latestSettingsFolder.Length + 1);
|
var relativePath = currentFile.Value.Substring(latestSettingsFolder.Length + 1);
|
||||||
var retoreFullPath = Path.Combine(appBasePath, relativePath);
|
var restoreFullPath = Path.Combine(appBasePath, relativePath);
|
||||||
var settingsToRestoreJson = GetExportVersion(backupRetoreSettings, currentFile.Key, currentFile.Value);
|
var settingsToRestoreJson = GetExportVersion(backupRestoreSettings, currentFile.Key, currentFile.Value);
|
||||||
|
|
||||||
if (currentSettingsFiles.TryGetValue(currentFile.Key, out string value))
|
if (currentSettingsFiles.TryGetValue(currentFile.Key, out string value))
|
||||||
{
|
{
|
||||||
// we have a setting file to restore to
|
// we have a setting file to restore to
|
||||||
var currentSettingsFileJson = GetExportVersion(backupRetoreSettings, currentFile.Key, value);
|
var currentSettingsFileJson = GetExportVersion(backupRestoreSettings, currentFile.Key, value);
|
||||||
|
|
||||||
if (JsonNormalizer.Normalize(settingsToRestoreJson) != JsonNormalizer.Normalize(currentSettingsFileJson))
|
if (JsonNormalizer.Normalize(settingsToRestoreJson) != JsonNormalizer.Normalize(currentSettingsFileJson))
|
||||||
{
|
{
|
||||||
@ -339,7 +339,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
if (anyFilesUpdated)
|
if (anyFilesUpdated)
|
||||||
{
|
{
|
||||||
// something was changed do we need to return true to indicate a restart is needed.
|
// something was changed do we need to return true to indicate a restart is needed.
|
||||||
var restartAfterRestore = (bool?)backupRetoreSettings!["RestartAfterRestore"];
|
var restartAfterRestore = (bool?)backupRestoreSettings!["RestartAfterRestore"];
|
||||||
if (!restartAfterRestore.HasValue || restartAfterRestore.Value)
|
if (!restartAfterRestore.HasValue || restartAfterRestore.Value)
|
||||||
{
|
{
|
||||||
return (true, $"RESTART APP", "Success");
|
return (true, $"RESTART APP", "Success");
|
||||||
@ -639,11 +639,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get data needed for process
|
// get data needed for process
|
||||||
var backupRetoreSettings = JsonNode.Parse(GetBackupRestoreSettingsJson());
|
var backupRestoreSettings = JsonNode.Parse(GetBackupRestoreSettingsJson());
|
||||||
var currentSettingsFiles = GetSettingsFiles(backupRetoreSettings, appBasePath).ToList().ToDictionary(x => x.Substring(appBasePath.Length));
|
var currentSettingsFiles = GetSettingsFiles(backupRestoreSettings, appBasePath).ToList().ToDictionary(x => x.Substring(appBasePath.Length));
|
||||||
var fullBackupDir = Path.Combine(Path.GetTempPath(), $"settings_{DateTime.UtcNow.ToFileTimeUtc().ToString(CultureInfo.InvariantCulture)}");
|
var fullBackupDir = Path.Combine(Path.GetTempPath(), $"settings_{DateTime.UtcNow.ToFileTimeUtc().ToString(CultureInfo.InvariantCulture)}");
|
||||||
var latestSettingsFolder = GetLatestSettingsFolder();
|
var latestSettingsFolder = GetLatestSettingsFolder();
|
||||||
var lastBackupSettingsFiles = GetSettingsFiles(backupRetoreSettings, latestSettingsFolder).ToList().ToDictionary(x => x.Substring(latestSettingsFolder.Length));
|
var lastBackupSettingsFiles = GetSettingsFiles(backupRestoreSettings, latestSettingsFolder).ToList().ToDictionary(x => x.Substring(latestSettingsFolder.Length));
|
||||||
|
|
||||||
lastBackupExists = lastBackupSettingsFiles.Count > 0;
|
lastBackupExists = lastBackupSettingsFiles.Count > 0;
|
||||||
|
|
||||||
@ -661,13 +661,13 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
tempFile = currentFile;
|
tempFile = currentFile;
|
||||||
|
|
||||||
// need to check and back this up;
|
// need to check and back this up;
|
||||||
var currentSettingsFileToBackup = GetExportVersion(backupRetoreSettings, currentFile.Key, currentFile.Value);
|
var currentSettingsFileToBackup = GetExportVersion(backupRestoreSettings, currentFile.Key, currentFile.Value);
|
||||||
|
|
||||||
var doBackup = false;
|
var doBackup = false;
|
||||||
if (lastBackupSettingsFiles.TryGetValue(currentFile.Key, out string value))
|
if (lastBackupSettingsFiles.TryGetValue(currentFile.Key, out string value))
|
||||||
{
|
{
|
||||||
// there is a previous backup for this, get an export version of it.
|
// there is a previous backup for this, get an export version of it.
|
||||||
var lastSettingsFileDoc = GetExportVersion(backupRetoreSettings, currentFile.Key, value);
|
var lastSettingsFileDoc = GetExportVersion(backupRestoreSettings, currentFile.Key, value);
|
||||||
|
|
||||||
// check to see if the new export version would be same as last export version.
|
// check to see if the new export version would be same as last export version.
|
||||||
if (JsonNormalizer.Normalize(currentSettingsFileToBackup) != JsonNormalizer.Normalize(lastSettingsFileDoc))
|
if (JsonNormalizer.Normalize(currentSettingsFileToBackup) != JsonNormalizer.Normalize(lastSettingsFileDoc))
|
||||||
@ -804,9 +804,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
/// Method <c>GetExportVersion</c> gets the version of the settings file that we want to backup.
|
/// Method <c>GetExportVersion</c> gets the version of the settings file that we want to backup.
|
||||||
/// It will be formatted and all problematic settings removed from it.
|
/// It will be formatted and all problematic settings removed from it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetExportVersion(JsonNode backupRetoreSettings, string settingFileKey, string settingsFileName)
|
public static string GetExportVersion(JsonNode backupRestoreSettings, string settingFileKey, string settingsFileName)
|
||||||
{
|
{
|
||||||
var ignoredSettings = GetIgnoredSettings(backupRetoreSettings, settingFileKey);
|
var ignoredSettings = GetIgnoredSettings(backupRestoreSettings, settingFileKey);
|
||||||
var settingsFile = JsonDocument.Parse(File.ReadAllText(settingsFileName));
|
var settingsFile = JsonDocument.Parse(File.ReadAllText(settingsFileName));
|
||||||
|
|
||||||
var outputBuffer = new ArrayBufferWriter<byte>();
|
var outputBuffer = new ArrayBufferWriter<byte>();
|
||||||
@ -828,7 +828,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
if (settingFileKey.Equals("\\PowerToys Run\\settings.json", StringComparison.OrdinalIgnoreCase))
|
if (settingFileKey.Equals("\\PowerToys Run\\settings.json", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
// PowerToys Run hack fix-up
|
// PowerToys Run hack fix-up
|
||||||
var ptRunIgnoredSettings = GetPTRunIgnoredSettings(backupRetoreSettings);
|
var ptRunIgnoredSettings = GetPTRunIgnoredSettings(backupRestoreSettings);
|
||||||
var ptrSettings = JsonNode.Parse(Encoding.UTF8.GetString(outputBuffer.WrittenSpan));
|
var ptrSettings = JsonNode.Parse(Encoding.UTF8.GetString(outputBuffer.WrittenSpan));
|
||||||
|
|
||||||
foreach (JsonObject pluginToChange in ptRunIgnoredSettings)
|
foreach (JsonObject pluginToChange in ptRunIgnoredSettings)
|
||||||
@ -856,13 +856,13 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Method <c>GetPTRunIgnoredSettings</c> gets the 'Run-Plugin-level' settings we should ignore because they are problematic to backup/restore.
|
/// Method <c>GetPTRunIgnoredSettings</c> gets the 'Run-Plugin-level' settings we should ignore because they are problematic to backup/restore.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static JsonArray GetPTRunIgnoredSettings(JsonNode backupRetoreSettings)
|
private static JsonArray GetPTRunIgnoredSettings(JsonNode backupRestoreSettings)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(backupRetoreSettings);
|
ArgumentNullException.ThrowIfNull(backupRestoreSettings);
|
||||||
|
|
||||||
if (backupRetoreSettings["IgnoredPTRunSettings"] != null)
|
if (backupRestoreSettings["IgnoredPTRunSettings"] != null)
|
||||||
{
|
{
|
||||||
return (JsonArray)backupRetoreSettings["IgnoredPTRunSettings"];
|
return (JsonArray)backupRestoreSettings["IgnoredPTRunSettings"];
|
||||||
}
|
}
|
||||||
|
|
||||||
return new JsonArray();
|
return new JsonArray();
|
||||||
@ -871,20 +871,20 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Method <c>GetIgnoredSettings</c> gets the 'top-level' settings we should ignore because they are problematic to backup/restore.
|
/// Method <c>GetIgnoredSettings</c> gets the 'top-level' settings we should ignore because they are problematic to backup/restore.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static string[] GetIgnoredSettings(JsonNode backupRetoreSettings, string settingFileKey)
|
private static string[] GetIgnoredSettings(JsonNode backupRestoreSettings, string settingFileKey)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(backupRetoreSettings);
|
ArgumentNullException.ThrowIfNull(backupRestoreSettings);
|
||||||
|
|
||||||
if (settingFileKey.StartsWith("\\", StringComparison.OrdinalIgnoreCase))
|
if (settingFileKey.StartsWith("\\", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
settingFileKey = settingFileKey.Substring(1);
|
settingFileKey = settingFileKey.Substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (backupRetoreSettings["IgnoredSettings"] != null)
|
if (backupRestoreSettings["IgnoredSettings"] != null)
|
||||||
{
|
{
|
||||||
if (backupRetoreSettings["IgnoredSettings"][settingFileKey] != null)
|
if (backupRestoreSettings["IgnoredSettings"][settingFileKey] != null)
|
||||||
{
|
{
|
||||||
var settingsArray = (JsonArray)backupRetoreSettings["IgnoredSettings"][settingFileKey];
|
var settingsArray = (JsonArray)backupRestoreSettings["IgnoredSettings"][settingFileKey];
|
||||||
|
|
||||||
Console.WriteLine("settingsArray " + settingsArray.GetType().FullName);
|
Console.WriteLine("settingsArray " + settingsArray.GetType().FullName);
|
||||||
|
|
||||||
|
@ -95,6 +95,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
|||||||
[JsonPropertyName("toolbar_hide")]
|
[JsonPropertyName("toolbar_hide")]
|
||||||
public StringProperty ToolbarHide { get; set; } = "When both camera and microphone are unmuted";
|
public StringProperty ToolbarHide { get; set; } = "When both camera and microphone are unmuted";
|
||||||
|
|
||||||
|
[JsonPropertyName("startup_action")]
|
||||||
|
public StringProperty StartupAction { get; set; } = "Nothing";
|
||||||
|
|
||||||
// converts the current to a json string.
|
// converts the current to a json string.
|
||||||
public string ToJsonString()
|
public string ToJsonString()
|
||||||
{
|
{
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
"selected_camera": { "value": "USB Video Device" },
|
"selected_camera": { "value": "USB Video Device" },
|
||||||
"theme": { "value": "light" },
|
"theme": { "value": "light" },
|
||||||
"toolbar_monitor": { "value": "All monitors" },
|
"toolbar_monitor": { "value": "All monitors" },
|
||||||
"toolbar_position": { "value": "Bottom center" }
|
"toolbar_position": { "value": "Bottom center" },
|
||||||
|
"startup_action": { "value": "Nothing" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,11 +146,22 @@
|
|||||||
<ComboBoxItem x:Uid="VideoConference_ToolbarHideNever" />
|
<ComboBoxItem x:Uid="VideoConference_ToolbarHideNever" />
|
||||||
<ComboBoxItem x:Uid="VideoConference_ToolbarHideUnmuted" />
|
<ComboBoxItem x:Uid="VideoConference_ToolbarHideUnmuted" />
|
||||||
<ComboBoxItem x:Uid="VideoConference_ToolbarHideMuted" />
|
<ComboBoxItem x:Uid="VideoConference_ToolbarHideMuted" />
|
||||||
|
<ComboBoxItem x:Uid="VideoConference_ToolbarHideTimeout" />
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
</controls:SettingsCard>
|
</controls:SettingsCard>
|
||||||
</controls:SettingsExpander.Items>
|
</controls:SettingsExpander.Items>
|
||||||
</controls:SettingsExpander>
|
</controls:SettingsExpander>
|
||||||
</custom:SettingsGroup>
|
</custom:SettingsGroup>
|
||||||
|
|
||||||
|
<custom:SettingsGroup x:Uid="VideoConference_Behavior" IsEnabled="{Binding Mode=OneWay, Path=IsEnabled}">
|
||||||
|
<controls:SettingsCard x:Uid="VideoConference_StartupAction">
|
||||||
|
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{Binding Mode=TwoWay, Path=StartupActionIndex}">
|
||||||
|
<ComboBoxItem x:Uid="VideoConference_StartupActionNothing" />
|
||||||
|
<ComboBoxItem x:Uid="VideoConference_StartupActionUnmute" />
|
||||||
|
<ComboBoxItem x:Uid="VideoConference_StartupActionMute" />
|
||||||
|
</ComboBox>
|
||||||
|
</controls:SettingsCard>
|
||||||
|
</custom:SettingsGroup>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</custom:SettingsPageControl.ModuleContent>
|
</custom:SettingsPageControl.ModuleContent>
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user