mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-06-29 01:22:34 -05:00
sync fork & remove merge issues
This commit is contained in:
@ -16,136 +16,72 @@ Function Get-WinUtilToggleStatus {
|
||||
if($ToggleSwitch -eq "WPFToggleDarkMode") {
|
||||
$app = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').AppsUseLightTheme
|
||||
$system = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').SystemUsesLightTheme
|
||||
if($app -eq 0 -and $system -eq 0) {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
return $app -eq 0 -and $system -eq 0
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleBingSearch") {
|
||||
$bingsearch = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search').BingSearchEnabled
|
||||
if($bingsearch -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
return $bingsearch -ne 0
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleNumLock") {
|
||||
$numlockvalue = (Get-ItemProperty -path 'HKCU:\Control Panel\Keyboard').InitialKeyboardIndicators
|
||||
if($numlockvalue -eq 2) {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
return $numlockvalue -eq 2
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleVerboseLogon") {
|
||||
$VerboseStatusvalue = (Get-ItemProperty -path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System').VerboseStatus
|
||||
if($VerboseStatusvalue -eq 1) {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
return $VerboseStatusvalue -eq 1
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleShowExt") {
|
||||
$hideextvalue = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').HideFileExt
|
||||
if($hideextvalue -eq 0) {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
return $hideextvalue -eq 0
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleSnapWindow") {
|
||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Control Panel\Desktop').WindowArrangementActive
|
||||
if($hidesnap -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
return $hidesnap -ne 0
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleSnapFlyout") {
|
||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').EnableSnapAssistFlyout
|
||||
if($hidesnap -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
return $hidesnap -ne 0
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleSnapSuggestion") {
|
||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').SnapAssist
|
||||
if($hidesnap -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
return $hidesnap -ne 0
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleMouseAcceleration") {
|
||||
$MouseSpeed = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseSpeed
|
||||
$MouseThreshold1 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold1
|
||||
$MouseThreshold2 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold2
|
||||
|
||||
if($MouseSpeed -eq 1 -and $MouseThreshold1 -eq 6 -and $MouseThreshold2 -eq 10) {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
return $MouseSpeed -eq 1 -and $MouseThreshold1 -eq 6 -and $MouseThreshold2 -eq 10
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleTaskbarSearch") {
|
||||
$SearchButton = (Get-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search").SearchboxTaskbarMode
|
||||
if($SearchButton -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
return $SearchButton -ne 0
|
||||
}
|
||||
if ($ToggleSwitch -eq "WPFToggleStickyKeys") {
|
||||
$StickyKeys = (Get-ItemProperty -path 'HKCU:\Control Panel\Accessibility\StickyKeys').Flags
|
||||
if($StickyKeys -eq 58) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
return $StickyKeys -ne 58
|
||||
}
|
||||
if ($ToggleSwitch -eq "WPFToggleTaskView") {
|
||||
$TaskView = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').ShowTaskViewButton
|
||||
if($TaskView -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
return $TaskView -ne 0
|
||||
}
|
||||
|
||||
if ($ToggleSwitch -eq "WPFToggleHiddenFiles") {
|
||||
$HiddenFiles = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').Hidden
|
||||
if($HiddenFiles -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
return $HiddenFiles -ne 0
|
||||
}
|
||||
|
||||
if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") {
|
||||
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
|
||||
if($TaskbarWidgets -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
return $TaskbarWidgets -ne 0
|
||||
}
|
||||
if ($ToggleSwitch -eq "WPFToggleTaskbarAlignment") {
|
||||
$TaskbarAlignment = (Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskbarAl
|
||||
if($TaskbarAlignment -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
return $TaskbarAlignment -ne 0
|
||||
}
|
||||
if ($ToggleSwitch -eq "WPFToggleDetailedBSoD") {
|
||||
$DetailedBSoD1 = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisplayParameters
|
||||
$DetailedBSoD2 = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisableEmoticon
|
||||
if (($DetailedBSoD1 -eq 0) -or ($DetailedBSoD2 -eq 0) -or !$DetailedBSoD1 -or !$DetailedBSoD2) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
return !(($DetailedBSoD1 -eq 0) -or ($DetailedBSoD2 -eq 0) -or !$DetailedBSoD1 -or !$DetailedBSoD2)
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ Function Invoke-WinUtilDarkMode {
|
||||
$Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
|
||||
Set-ItemProperty -Path $Path -Name AppsUseLightTheme -Value $DarkMoveValue
|
||||
Set-ItemProperty -Path $Path -Name SystemUsesLightTheme -Value $DarkMoveValue
|
||||
Invoke-WinUtilExplorerRefresh
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
|
33
functions/private/Invoke-WinUtilExplorerRefresh.ps1
Normal file
33
functions/private/Invoke-WinUtilExplorerRefresh.ps1
Normal file
@ -0,0 +1,33 @@
|
||||
function Invoke-WinUtilExplorerRefresh {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Refreshes the Windows Explorer
|
||||
#>
|
||||
|
||||
Invoke-WPFRunspace -DebugPreference $DebugPreference -ScriptBlock {
|
||||
# Send the WM_SETTINGCHANGE message to all windows
|
||||
Add-Type -TypeDefinition @"
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
public class Win32 {
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
|
||||
public static extern IntPtr SendMessageTimeout(
|
||||
IntPtr hWnd,
|
||||
uint Msg,
|
||||
IntPtr wParam,
|
||||
string lParam,
|
||||
uint fuFlags,
|
||||
uint uTimeout,
|
||||
out IntPtr lpdwResult);
|
||||
}
|
||||
"@
|
||||
|
||||
$HWND_BROADCAST = [IntPtr]0xffff
|
||||
$WM_SETTINGCHANGE = 0x1A
|
||||
$SMTO_ABORTIFHUNG = 0x2
|
||||
$timeout = 100
|
||||
|
||||
# Send the broadcast message to all windows
|
||||
[Win32]::SendMessageTimeout($HWND_BROADCAST, $WM_SETTINGCHANGE, [IntPtr]::Zero, "ImmersiveColorSet", $SMTO_ABORTIFHUNG, $timeout, [ref]([IntPtr]::Zero))
|
||||
}
|
||||
}
|
@ -47,6 +47,7 @@ function Remove-Features() {
|
||||
$_.FeatureName -NotLike "*NetFx*" -AND
|
||||
$_.FeatureName -NotLike "*Media*" -AND
|
||||
$_.FeatureName -NotLike "*NFS*" -AND
|
||||
$_.FeatureName -NotLike "*SearchEngine*" -AND
|
||||
$_.State -ne "Disabled"
|
||||
}
|
||||
|
||||
|
180
functions/private/Invoke-WinutilThemeChange.ps1
Normal file
180
functions/private/Invoke-WinutilThemeChange.ps1
Normal file
@ -0,0 +1,180 @@
|
||||
function Invoke-WinutilThemeChange {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Toggles between light and dark themes for a Windows utility application.
|
||||
|
||||
.DESCRIPTION
|
||||
This function toggles the theme of the user interface between 'Light' and 'Dark' modes,
|
||||
modifying various UI elements such as colors, margins, corner radii, font families, etc.
|
||||
If the '-init' switch is used, it initializes the theme based on the system's current dark mode setting.
|
||||
|
||||
.PARAMETER init
|
||||
A switch parameter. If set to $true, the function initializes the theme based on the system’s current dark mode setting.
|
||||
|
||||
.EXAMPLE
|
||||
Invoke-WinutilThemeChange
|
||||
# Toggles the theme between 'Light' and 'Dark'.
|
||||
|
||||
.EXAMPLE
|
||||
Invoke-WinutilThemeChange -init
|
||||
# Initializes the theme based on the system's dark mode and applies the shared theme.
|
||||
#>
|
||||
param (
|
||||
[switch]$init = $false,
|
||||
[string]$theme
|
||||
)
|
||||
|
||||
function Set-WinutilTheme {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Applies the specified theme to the application's user interface.
|
||||
|
||||
.DESCRIPTION
|
||||
This internal function applies the given theme by setting the relevant properties
|
||||
like colors, font families, corner radii, etc., in the UI. It uses the
|
||||
'Set-ThemeResourceProperty' helper function to modify the application's resources.
|
||||
|
||||
.PARAMETER currentTheme
|
||||
The name of the theme to be applied. Common values are "Light", "Dark", or "shared".
|
||||
#>
|
||||
param (
|
||||
[string]$currentTheme
|
||||
)
|
||||
|
||||
function Set-ThemeResourceProperty {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets a specific UI property in the application's resources.
|
||||
|
||||
.DESCRIPTION
|
||||
This helper function sets a property (e.g., color, margin, corner radius) in the
|
||||
application's resources, based on the provided type and value. It includes
|
||||
error handling to manage potential issues while setting a property.
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the resource property to modify (e.g., "MainBackgroundColor", "ButtonBackgroundMouseoverColor").
|
||||
|
||||
.PARAMETER Value
|
||||
The value to assign to the resource property (e.g., "#FFFFFF" for a color).
|
||||
|
||||
.PARAMETER Type
|
||||
The type of the resource, such as "ColorBrush", "CornerRadius", "GridLength", or "FontFamily".
|
||||
#>
|
||||
param($Name, $Value, $Type)
|
||||
try {
|
||||
# Set the resource property based on its type
|
||||
$sync.Form.Resources[$Name] = switch ($Type) {
|
||||
"ColorBrush" { [Windows.Media.SolidColorBrush]::new($Value) }
|
||||
"Color" {
|
||||
# Convert hex string to RGB values
|
||||
$hexColor = $Value.TrimStart("#")
|
||||
$r = [Convert]::ToInt32($hexColor.Substring(0,2), 16)
|
||||
$g = [Convert]::ToInt32($hexColor.Substring(2,2), 16)
|
||||
$b = [Convert]::ToInt32($hexColor.Substring(4,2), 16)
|
||||
[Windows.Media.Color]::FromRgb($r, $g, $b)
|
||||
}
|
||||
"CornerRadius" { [System.Windows.CornerRadius]::new($Value) }
|
||||
"GridLength" { [System.Windows.GridLength]::new($Value) }
|
||||
"Thickness" {
|
||||
# Parse the Thickness value (supports 1, 2, or 4 inputs)
|
||||
$values = $Value -split ","
|
||||
switch ($values.Count) {
|
||||
1 { [System.Windows.Thickness]::new([double]$values[0]) }
|
||||
2 { [System.Windows.Thickness]::new([double]$values[0], [double]$values[1]) }
|
||||
4 { [System.Windows.Thickness]::new([double]$values[0], [double]$values[1], [double]$values[2], [double]$values[3]) }
|
||||
}
|
||||
}
|
||||
"FontFamily" { [Windows.Media.FontFamily]::new($Value) }
|
||||
"Double" { [double]$Value }
|
||||
default { $Value }
|
||||
}
|
||||
}
|
||||
catch {
|
||||
# Log a warning if there's an issue setting the property
|
||||
Write-Warning "Failed to set property $($Name): $_"
|
||||
}
|
||||
}
|
||||
|
||||
# Retrieve all theme properties from the theme configuration
|
||||
$themeProperties = $sync.configs.themes.$currentTheme.PSObject.Properties
|
||||
foreach ($_ in $themeProperties) {
|
||||
# Apply properties that deal with colors
|
||||
if ($_.Name -like "*color*") {
|
||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "ColorBrush"
|
||||
# For certain color properties, also set complementary values (e.g., BorderColor -> CBorderColor) This is required because e.g DropShadowEffect requires a <Color> and not a <SolidColorBrush> object
|
||||
if ($_.Name -in @("BorderColor", "ButtonBackgroundMouseoverColor")) {
|
||||
Set-ThemeResourceProperty -Name "C$($_.Name)" -Value $_.Value -Type "Color"
|
||||
}
|
||||
}
|
||||
# Apply corner radius properties
|
||||
elseif ($_.Name -like "*Radius*") {
|
||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "CornerRadius"
|
||||
}
|
||||
# Apply row height properties
|
||||
elseif ($_.Name -like "*RowHeight*") {
|
||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "GridLength"
|
||||
}
|
||||
# Apply thickness or margin properties
|
||||
elseif (($_.Name -like "*Thickness*") -or ($_.Name -like "*margin")) {
|
||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "Thickness"
|
||||
}
|
||||
# Apply font family properties
|
||||
elseif ($_.Name -like "*FontFamily*") {
|
||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "FontFamily"
|
||||
}
|
||||
# Apply any other properties as doubles (numerical values)
|
||||
else {
|
||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "Double"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$LightPreferencePath = "$env:LOCALAPPDATA\winutil\LightTheme.ini"
|
||||
$DarkPreferencePath = "$env:LOCALAPPDATA\winutil\DarkTheme.ini"
|
||||
|
||||
if ($init) {
|
||||
Set-WinutilTheme -currentTheme "shared"
|
||||
if (Test-Path $LightPreferencePath) {
|
||||
$theme = "Light"
|
||||
}
|
||||
elseif (Test-Path $DarkPreferencePath) {
|
||||
$theme = "Dark"
|
||||
}
|
||||
else {
|
||||
$theme = "Auto"
|
||||
}
|
||||
}
|
||||
|
||||
switch ($theme) {
|
||||
"Auto" {
|
||||
$systemUsesDarkMode = Get-WinUtilToggleStatus WPFToggleDarkMode
|
||||
if ($systemUsesDarkMode) {
|
||||
Set-WinutilTheme -currentTheme "Dark"
|
||||
}
|
||||
else{
|
||||
Set-WinutilTheme -currentTheme "Light"
|
||||
}
|
||||
|
||||
|
||||
$themeButtonIcon = [char]0xF08C
|
||||
Remove-Item $LightPreferencePath -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item $DarkPreferencePath -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
"Dark" {
|
||||
Set-WinutilTheme -currentTheme $theme
|
||||
$themeButtonIcon = [char]0xE708
|
||||
$null = New-Item $DarkPreferencePath -Force
|
||||
Remove-Item $LightPreferencePath -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
"Light" {
|
||||
Set-WinutilTheme -currentTheme $theme
|
||||
$themeButtonIcon = [char]0xE706
|
||||
$null = New-Item $LightPreferencePath -Force
|
||||
Remove-Item $DarkPreferencePath -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
# Update the theme selector button with the appropriate icon
|
||||
$ThemeButton = $sync.Form.FindName("ThemeButton")
|
||||
$ThemeButton.Content = [string]$themeButtonIcon
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
function Set-WinUtilUITheme {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the theme of the XAML file
|
||||
|
||||
.PARAMETER inputXML
|
||||
A string representing the XAML object to modify
|
||||
|
||||
.PARAMETER customThemeName
|
||||
The name of the custom theme to set the XAML to. Defaults to 'matrix'
|
||||
|
||||
.PARAMETER defaultThemeName
|
||||
The name of the default theme to use when setting the XAML. Defaults to '_default'
|
||||
|
||||
.EXAMPLE
|
||||
$returnVal = Set-WinUtilUITheme -inputXAML $inputXAML
|
||||
if ($returnVal[0] -eq "") {
|
||||
Write-Host "Failed to process inputXML"
|
||||
} else {
|
||||
$inputXML = $returnVal[0]
|
||||
}
|
||||
# to know which theme this function has used, access the second item in returned value.
|
||||
Write-Host "Theme used in processing: $($returnVal[1])"
|
||||
#>
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory, position=0)]
|
||||
[string]$inputXML,
|
||||
|
||||
[Parameter(position=1)]
|
||||
[string]$customThemeName = 'matrix',
|
||||
|
||||
[Parameter(position=2)]
|
||||
[string]$defaultThemeName = '_default'
|
||||
)
|
||||
|
||||
try {
|
||||
# Note:
|
||||
# Reason behind not caching the '$sync.configs.themes` object into a variable,
|
||||
# because this code can modify the themes object.. meaning it's better to access it
|
||||
# using the more verbose way, rather than introduce possible bugs into the code, just for the sake of readability.
|
||||
#
|
||||
if (-NOT $sync.configs.themes) {
|
||||
throw [GenericException]::new("[Set-WinUtilTheme] Did not find 'config.themes' inside `$sync variable.")
|
||||
}
|
||||
|
||||
if (-NOT $sync.configs.themes.$defaultThemeName) {
|
||||
throw [GenericException]::new("[Set-WinUtilTheme] Did not find '$defaultThemeName' theme in the themes config file.")
|
||||
}
|
||||
|
||||
$themeToUse = $customThemeName
|
||||
if ($sync.configs.themes.$themeToUse) {
|
||||
# Loop through every default theme option, and modify the custom theme in $sync variable,
|
||||
# so that it has full options available for other functions to use.
|
||||
foreach ($option in $sync.configs.themes.$defaultThemeName.PSObject.Properties) {
|
||||
$optionName = $option.Name
|
||||
$optionValue = $option.Value
|
||||
if (-NOT $sync.configs.themes.$themeToUse.$optionName) {
|
||||
$sync.configs.themes.$themeToUse | Add-Member -MemberType NoteProperty -Name $optionName -Value $optionValue
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Write-Debug "[Set-WinUtilTheme] Theme '$customThemeName' was not found, using '$defaultThemeName' instead."
|
||||
$themeToUse = $defaultThemeName
|
||||
}
|
||||
|
||||
foreach ($property in $sync.configs.themes.$themeToUse.PSObject.Properties) {
|
||||
$key = $property.Name
|
||||
$value = $property.Value
|
||||
# Add curly braces around the key
|
||||
$formattedKey = "{$key}"
|
||||
# Replace the key with the value in the input XML
|
||||
$inputXML = $inputXML.Replace($formattedKey, $value)
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Host "[Set-WinUtilTheme] Unable to apply theme" -ForegroundColor Red
|
||||
Write-Host "$($psitem.Exception.Message)" -ForegroundColor Red
|
||||
$inputXML = "" # Make inputXML equal an empty string, indicating something went wrong to the function caller.
|
||||
}
|
||||
|
||||
return @($inputXML, $themeToUse);
|
||||
}
|
@ -33,25 +33,25 @@ function Show-CustomDialog {
|
||||
#>
|
||||
param(
|
||||
[string]$Message,
|
||||
[int]$Width = 300,
|
||||
[int]$Height = 200,
|
||||
[int]$FontSize = 10,
|
||||
[int]$HeaderFontSize = 14,
|
||||
[int]$IconSize = 25,
|
||||
[int]$Width = $sync.Form.Resources.CustomDialogWidth,
|
||||
[int]$Height = $sync.Form.Resources.CustomDialogHeight,
|
||||
[int]$FontSize = $sync.Form.Resources.CustomDialogFontSize,
|
||||
[int]$HeaderFontSize = $sync.Form.Resources.CustomDialogFontSizeHeader,
|
||||
[int]$IconSize = $sync.Form.Resources.CustomDialogLogoSize,
|
||||
[bool]$EnableScroll = $false
|
||||
)
|
||||
|
||||
Add-Type -AssemblyName PresentationFramework
|
||||
|
||||
# Define theme colors
|
||||
$foregroundColor = $sync.configs.themes.$ctttheme.MainForegroundColor
|
||||
$backgroundColor = $sync.configs.themes.$ctttheme.MainBackgroundColor
|
||||
$foregroundColor = $sync.Form.Resources.MainForegroundColor
|
||||
$backgroundColor = $sync.Form.Resources.MainBackgroundColor
|
||||
$font = New-Object Windows.Media.FontFamily("Consolas")
|
||||
$borderColor = $sync.configs.themes.$ctttheme.BorderColor # ButtonInstallBackgroundColor
|
||||
$buttonBackgroundColor = $sync.configs.themes.$ctttheme.ButtonInstallBackgroundColor
|
||||
$buttonForegroundColor = $sync.configs.themes.$ctttheme.ButtonInstallForegroundColor
|
||||
$borderColor = $sync.Form.Resources.BorderColor # ButtonInstallBackgroundColor
|
||||
$buttonBackgroundColor = $sync.Form.Resources.ButtonInstallBackgroundColor
|
||||
$buttonForegroundColor = $sync.Form.Resources.ButtonInstallForegroundColor
|
||||
$shadowColor = [Windows.Media.ColorConverter]::ConvertFromString("#AAAAAAAA")
|
||||
$logocolor = $sync.configs.themes.$ctttheme.LabelboxForegroundColor
|
||||
$logocolor = $sync.Form.Resources.LabelboxForegroundColor
|
||||
|
||||
# Create a custom dialog window
|
||||
$dialog = New-Object Windows.Window
|
||||
@ -162,7 +162,7 @@ function Show-CustomDialog {
|
||||
$hyperlink.NavigateUri = New-Object System.Uri($match.Groups[1].Value)
|
||||
$hyperlink.Inlines.Add($match.Groups[2].Value)
|
||||
$hyperlink.TextDecorations = [Windows.TextDecorations]::None # Remove underline
|
||||
$hyperlink.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor
|
||||
$hyperlink.Foreground = $sync.Form.Resources.LinkForegroundColor
|
||||
|
||||
$hyperlink.Add_Click({
|
||||
param($sender, $args)
|
||||
@ -170,11 +170,11 @@ function Show-CustomDialog {
|
||||
})
|
||||
$hyperlink.Add_MouseEnter({
|
||||
param($sender, $args)
|
||||
$sender.Foreground = $sync.configs.themes.$ctttheme.LinkHoverForegroundColor
|
||||
$sender.Foreground = $sync.Form.Resources.LinkHoverForegroundColor
|
||||
})
|
||||
$hyperlink.Add_MouseLeave({
|
||||
param($sender, $args)
|
||||
$sender.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor
|
||||
$sender.Foreground = $sync.Form.Resources.LinkForegroundColor
|
||||
})
|
||||
|
||||
$messageTextBlock.Inlines.Add($hyperlink)
|
||||
|
Reference in New Issue
Block a user