Indentation Fixes

This commit is contained in:
Mr.k 2024-11-20 16:04:36 +03:00
parent 39ee4d53c0
commit 55f0fc5e9c
No known key found for this signature in database
4 changed files with 199 additions and 200 deletions

View File

@ -1,15 +1,15 @@
function Get-LocalizedYesNo { function Get-LocalizedYesNo {
<# <#
.SYNOPSIS .SYNOPSIS
This function runs choice.exe and captures its output to extract yes no in a localized Windows This function runs choice.exe and captures its output to extract yes no in a localized Windows
.DESCRIPTION .DESCRIPTION
The function retrieves the output of the command 'cmd /c "choice <nul 2>nul"' and converts the default output for Yes and No The function retrieves the output of the command 'cmd /c "choice <nul 2>nul"' and converts the default output for Yes and No
in the localized format, such as "Yes=<first character>, No=<second character>". in the localized format, such as "Yes=<first character>, No=<second character>".
.EXAMPLE .EXAMPLE
$yesNoArray = Get-LocalizedYesNo $yesNoArray = Get-LocalizedYesNo
Write-Host "Yes=$($yesNoArray[0]), No=$($yesNoArray[1])" Write-Host "Yes=$($yesNoArray[0]), No=$($yesNoArray[1])"
#> #>
# Run choice and capture its options as output # Run choice and capture its options as output
@ -30,5 +30,4 @@ function Get-LocalizedYesNo {
Write-Debug "According to takeown.exe local Yes is $charactersArray[0]" Write-Debug "According to takeown.exe local Yes is $charactersArray[0]"
# Return the array of characters # Return the array of characters
return $charactersArray return $charactersArray
}
}

View File

@ -1,30 +1,30 @@
function Invoke-WinUtilAssets { function Invoke-WinUtilAssets {
param ( param (
$type, $type,
$Size, $Size,
[switch]$render [switch]$render
) )
# Create the Viewbox and set its size # Create the Viewbox and set its size
$LogoViewbox = New-Object Windows.Controls.Viewbox $LogoViewbox = New-Object Windows.Controls.Viewbox
$LogoViewbox.Width = $Size $LogoViewbox.Width = $Size
$LogoViewbox.Height = $Size $LogoViewbox.Height = $Size
# Create a Canvas to hold the paths # Create a Canvas to hold the paths
$canvas = New-Object Windows.Controls.Canvas $canvas = New-Object Windows.Controls.Canvas
$canvas.Width = 100 $canvas.Width = 100
$canvas.Height = 100 $canvas.Height = 100
# Define a scale factor for the content inside the Canvas # Define a scale factor for the content inside the Canvas
$scaleFactor = $Size / 100 $scaleFactor = $Size / 100
# Apply a scale transform to the Canvas content # Apply a scale transform to the Canvas content
$scaleTransform = New-Object Windows.Media.ScaleTransform($scaleFactor, $scaleFactor) $scaleTransform = New-Object Windows.Media.ScaleTransform($scaleFactor, $scaleFactor)
$canvas.LayoutTransform = $scaleTransform $canvas.LayoutTransform = $scaleTransform
switch ($type) { switch ($type) {
'logo' { 'logo' {
$LogoPathData1 = @" $LogoPathData1 = @"
M 18.00,14.00 M 18.00,14.00
C 18.00,14.00 45.00,27.74 45.00,27.74 C 18.00,14.00 45.00,27.74 45.00,27.74
45.00,27.74 57.40,34.63 57.40,34.63 45.00,27.74 57.40,34.63 57.40,34.63
@ -36,11 +36,11 @@ C 18.00,14.00 45.00,27.74 45.00,27.74
38.34,41.74 25.78,38.60 21.28,33.79 38.34,41.74 25.78,38.60 21.28,33.79
16.81,29.02 18.00,20.20 18.00,14.00 Z 16.81,29.02 18.00,20.20 18.00,14.00 Z
"@ "@
$LogoPath1 = New-Object Windows.Shapes.Path $LogoPath1 = New-Object Windows.Shapes.Path
$LogoPath1.Data = [Windows.Media.Geometry]::Parse($LogoPathData1) $LogoPath1.Data = [Windows.Media.Geometry]::Parse($LogoPathData1)
$LogoPath1.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#0567ff") $LogoPath1.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#0567ff")
$LogoPathData2 = @" $LogoPathData2 = @"
M 107.00,14.00 M 107.00,14.00
C 109.01,19.06 108.93,30.37 104.66,34.21 C 109.01,19.06 108.93,30.37 104.66,34.21
100.47,37.98 86.38,43.10 84.60,47.21 100.47,37.98 86.38,43.10 84.60,47.21
@ -52,11 +52,11 @@ C 109.01,19.06 108.93,30.37 104.66,34.21
67.99,35.63 80.00,28.26 80.00,28.26 67.99,35.63 80.00,28.26 80.00,28.26
80.00,28.26 107.00,14.00 107.00,14.00 Z 80.00,28.26 107.00,14.00 107.00,14.00 Z
"@ "@
$LogoPath2 = New-Object Windows.Shapes.Path $LogoPath2 = New-Object Windows.Shapes.Path
$LogoPath2.Data = [Windows.Media.Geometry]::Parse($LogoPathData2) $LogoPath2.Data = [Windows.Media.Geometry]::Parse($LogoPathData2)
$LogoPath2.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#0567ff") $LogoPath2.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#0567ff")
$LogoPathData3 = @" $LogoPathData3 = @"
M 19.00,46.00 M 19.00,46.00
C 21.36,47.14 28.67,50.71 30.01,52.63 C 21.36,47.14 28.67,50.71 30.01,52.63
31.17,54.30 30.99,57.04 31.00,59.00 31.17,54.30 30.99,57.04 31.00,59.00
@ -75,125 +75,125 @@ C 21.36,47.14 28.67,50.71 30.01,52.63
46.21,102.83 36.63,98.57 31.04,93.68 46.21,102.83 36.63,98.57 31.04,93.68
16.88,81.28 19.00,62.88 19.00,46.00 Z 16.88,81.28 19.00,62.88 19.00,46.00 Z
"@ "@
$LogoPath3 = New-Object Windows.Shapes.Path $LogoPath3 = New-Object Windows.Shapes.Path
$LogoPath3.Data = [Windows.Media.Geometry]::Parse($LogoPathData3) $LogoPath3.Data = [Windows.Media.Geometry]::Parse($LogoPathData3)
$LogoPath3.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#a3a4a6") $LogoPath3.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#a3a4a6")
$canvas.Children.Add($LogoPath1) | Out-Null $canvas.Children.Add($LogoPath1) | Out-Null
$canvas.Children.Add($LogoPath2) | Out-Null $canvas.Children.Add($LogoPath2) | Out-Null
$canvas.Children.Add($LogoPath3) | Out-Null $canvas.Children.Add($LogoPath3) | Out-Null
} }
'checkmark' { 'checkmark' {
$canvas.Width = 512 $canvas.Width = 512
$canvas.Height = 512 $canvas.Height = 512
$scaleFactor = $Size / 2.54 $scaleFactor = $Size / 2.54
$scaleTransform = New-Object Windows.Media.ScaleTransform($scaleFactor, $scaleFactor) $scaleTransform = New-Object Windows.Media.ScaleTransform($scaleFactor, $scaleFactor)
$canvas.LayoutTransform = $scaleTransform $canvas.LayoutTransform = $scaleTransform
# Define the circle path # Define the circle path
$circlePathData = "M 1.27,0 A 1.27,1.27 0 1,0 1.27,2.54 A 1.27,1.27 0 1,0 1.27,0" $circlePathData = "M 1.27,0 A 1.27,1.27 0 1,0 1.27,2.54 A 1.27,1.27 0 1,0 1.27,0"
$circlePath = New-Object Windows.Shapes.Path $circlePath = New-Object Windows.Shapes.Path
$circlePath.Data = [Windows.Media.Geometry]::Parse($circlePathData) $circlePath.Data = [Windows.Media.Geometry]::Parse($circlePathData)
$circlePath.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#39ba00") $circlePath.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#39ba00")
# Define the checkmark path # Define the checkmark path
$checkmarkPathData = "M 0.873 1.89 L 0.41 1.391 A 0.17 0.17 0 0 1 0.418 1.151 A 0.17 0.17 0 0 1 0.658 1.16 L 1.016 1.543 L 1.583 1.013 A 0.17 0.17 0 0 1 1.599 1 L 1.865 0.751 A 0.17 0.17 0 0 1 2.105 0.759 A 0.17 0.17 0 0 1 2.097 0.999 L 1.282 1.759 L 0.999 2.022 L 0.874 1.888 Z" $checkmarkPathData = "M 0.873 1.89 L 0.41 1.391 A 0.17 0.17 0 0 1 0.418 1.151 A 0.17 0.17 0 0 1 0.658 1.16 L 1.016 1.543 L 1.583 1.013 A 0.17 0.17 0 0 1 1.599 1 L 1.865 0.751 A 0.17 0.17 0 0 1 2.105 0.759 A 0.17 0.17 0 0 1 2.097 0.999 L 1.282 1.759 L 0.999 2.022 L 0.874 1.888 Z"
$checkmarkPath = New-Object Windows.Shapes.Path $checkmarkPath = New-Object Windows.Shapes.Path
$checkmarkPath.Data = [Windows.Media.Geometry]::Parse($checkmarkPathData) $checkmarkPath.Data = [Windows.Media.Geometry]::Parse($checkmarkPathData)
$checkmarkPath.Fill = [Windows.Media.Brushes]::White $checkmarkPath.Fill = [Windows.Media.Brushes]::White
# Add the paths to the Canvas # Add the paths to the Canvas
$canvas.Children.Add($circlePath) | Out-Null $canvas.Children.Add($circlePath) | Out-Null
$canvas.Children.Add($checkmarkPath) | Out-Null $canvas.Children.Add($checkmarkPath) | Out-Null
} }
'warning' { 'warning' {
$canvas.Width = 512 $canvas.Width = 512
$canvas.Height = 512 $canvas.Height = 512
# Define a scale factor for the content inside the Canvas # Define a scale factor for the content inside the Canvas
$scaleFactor = $Size / 512 # Adjust scaling based on the canvas size $scaleFactor = $Size / 512 # Adjust scaling based on the canvas size
$scaleTransform = New-Object Windows.Media.ScaleTransform($scaleFactor, $scaleFactor) $scaleTransform = New-Object Windows.Media.ScaleTransform($scaleFactor, $scaleFactor)
$canvas.LayoutTransform = $scaleTransform $canvas.LayoutTransform = $scaleTransform
# Define the circle path # Define the circle path
$circlePathData = "M 256,0 A 256,256 0 1,0 256,512 A 256,256 0 1,0 256,0" $circlePathData = "M 256,0 A 256,256 0 1,0 256,512 A 256,256 0 1,0 256,0"
$circlePath = New-Object Windows.Shapes.Path $circlePath = New-Object Windows.Shapes.Path
$circlePath.Data = [Windows.Media.Geometry]::Parse($circlePathData) $circlePath.Data = [Windows.Media.Geometry]::Parse($circlePathData)
$circlePath.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#f41b43") $circlePath.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#f41b43")
# Define the exclamation mark path # Define the exclamation mark path
$exclamationPathData = "M 256 307.2 A 35.89 35.89 0 0 1 220.14 272.74 L 215.41 153.3 A 35.89 35.89 0 0 1 251.27 116 H 260.73 A 35.89 35.89 0 0 1 296.59 153.3 L 291.86 272.74 A 35.89 35.89 0 0 1 256 307.2 Z" $exclamationPathData = "M 256 307.2 A 35.89 35.89 0 0 1 220.14 272.74 L 215.41 153.3 A 35.89 35.89 0 0 1 251.27 116 H 260.73 A 35.89 35.89 0 0 1 296.59 153.3 L 291.86 272.74 A 35.89 35.89 0 0 1 256 307.2 Z"
$exclamationPath = New-Object Windows.Shapes.Path $exclamationPath = New-Object Windows.Shapes.Path
$exclamationPath.Data = [Windows.Media.Geometry]::Parse($exclamationPathData) $exclamationPath.Data = [Windows.Media.Geometry]::Parse($exclamationPathData)
$exclamationPath.Fill = [Windows.Media.Brushes]::White $exclamationPath.Fill = [Windows.Media.Brushes]::White
# Get the bounds of the exclamation mark path # Get the bounds of the exclamation mark path
$exclamationBounds = $exclamationPath.Data.Bounds $exclamationBounds = $exclamationPath.Data.Bounds
# Calculate the center position for the exclamation mark path # Calculate the center position for the exclamation mark path
$exclamationCenterX = ($canvas.Width - $exclamationBounds.Width) / 2 - $exclamationBounds.X $exclamationCenterX = ($canvas.Width - $exclamationBounds.Width) / 2 - $exclamationBounds.X
$exclamationPath.SetValue([Windows.Controls.Canvas]::LeftProperty, $exclamationCenterX) $exclamationPath.SetValue([Windows.Controls.Canvas]::LeftProperty, $exclamationCenterX)
# Define the rounded rectangle at the bottom (dot of exclamation mark) # Define the rounded rectangle at the bottom (dot of exclamation mark)
$roundedRectangle = New-Object Windows.Shapes.Rectangle $roundedRectangle = New-Object Windows.Shapes.Rectangle
$roundedRectangle.Width = 80 $roundedRectangle.Width = 80
$roundedRectangle.Height = 80 $roundedRectangle.Height = 80
$roundedRectangle.RadiusX = 30 $roundedRectangle.RadiusX = 30
$roundedRectangle.RadiusY = 30 $roundedRectangle.RadiusY = 30
$roundedRectangle.Fill = [Windows.Media.Brushes]::White $roundedRectangle.Fill = [Windows.Media.Brushes]::White
# Calculate the center position for the rounded rectangle # Calculate the center position for the rounded rectangle
$centerX = ($canvas.Width - $roundedRectangle.Width) / 2 $centerX = ($canvas.Width - $roundedRectangle.Width) / 2
$roundedRectangle.SetValue([Windows.Controls.Canvas]::LeftProperty, $centerX) $roundedRectangle.SetValue([Windows.Controls.Canvas]::LeftProperty, $centerX)
$roundedRectangle.SetValue([Windows.Controls.Canvas]::TopProperty, 324.34) $roundedRectangle.SetValue([Windows.Controls.Canvas]::TopProperty, 324.34)
# Add the paths to the Canvas # Add the paths to the Canvas
$canvas.Children.Add($circlePath) | Out-Null $canvas.Children.Add($circlePath) | Out-Null
$canvas.Children.Add($exclamationPath) | Out-Null $canvas.Children.Add($exclamationPath) | Out-Null
$canvas.Children.Add($roundedRectangle) | Out-Null $canvas.Children.Add($roundedRectangle) | Out-Null
} }
default { default {
Write-Host "Invalid type: $type" Write-Host "Invalid type: $type"
} }
} }
# Add the Canvas to the Viewbox # Add the Canvas to the Viewbox
$LogoViewbox.Child = $canvas $LogoViewbox.Child = $canvas
if ($render) { if ($render) {
# Measure and arrange the canvas to ensure proper rendering # Measure and arrange the canvas to ensure proper rendering
$canvas.Measure([Windows.Size]::new($canvas.Width, $canvas.Height)) $canvas.Measure([Windows.Size]::new($canvas.Width, $canvas.Height))
$canvas.Arrange([Windows.Rect]::new(0, 0, $canvas.Width, $canvas.Height)) $canvas.Arrange([Windows.Rect]::new(0, 0, $canvas.Width, $canvas.Height))
$canvas.UpdateLayout() $canvas.UpdateLayout()
# Initialize RenderTargetBitmap correctly with dimensions # Initialize RenderTargetBitmap correctly with dimensions
$renderTargetBitmap = New-Object Windows.Media.Imaging.RenderTargetBitmap($canvas.Width, $canvas.Height, 96, 96, [Windows.Media.PixelFormats]::Pbgra32) $renderTargetBitmap = New-Object Windows.Media.Imaging.RenderTargetBitmap($canvas.Width, $canvas.Height, 96, 96, [Windows.Media.PixelFormats]::Pbgra32)
# Render the canvas to the bitmap # Render the canvas to the bitmap
$renderTargetBitmap.Render($canvas) $renderTargetBitmap.Render($canvas)
# Create a BitmapFrame from the RenderTargetBitmap # Create a BitmapFrame from the RenderTargetBitmap
$bitmapFrame = [Windows.Media.Imaging.BitmapFrame]::Create($renderTargetBitmap) $bitmapFrame = [Windows.Media.Imaging.BitmapFrame]::Create($renderTargetBitmap)
# Create a PngBitmapEncoder and add the frame # Create a PngBitmapEncoder and add the frame
$bitmapEncoder = [Windows.Media.Imaging.PngBitmapEncoder]::new() $bitmapEncoder = [Windows.Media.Imaging.PngBitmapEncoder]::new()
$bitmapEncoder.Frames.Add($bitmapFrame) $bitmapEncoder.Frames.Add($bitmapFrame)
# Save to a memory stream # Save to a memory stream
$imageStream = New-Object System.IO.MemoryStream $imageStream = New-Object System.IO.MemoryStream
$bitmapEncoder.Save($imageStream) $bitmapEncoder.Save($imageStream)
$imageStream.Position = 0 $imageStream.Position = 0
# Load the stream into a BitmapImage # Load the stream into a BitmapImage
$bitmapImage = [Windows.Media.Imaging.BitmapImage]::new() $bitmapImage = [Windows.Media.Imaging.BitmapImage]::new()
$bitmapImage.BeginInit() $bitmapImage.BeginInit()
$bitmapImage.StreamSource = $imageStream $bitmapImage.StreamSource = $imageStream
$bitmapImage.CacheOption = [Windows.Media.Imaging.BitmapCacheOption]::OnLoad $bitmapImage.CacheOption = [Windows.Media.Imaging.BitmapCacheOption]::OnLoad
$bitmapImage.EndInit() $bitmapImage.EndInit()
return $bitmapImage return $bitmapImage
} else { } else {
return $LogoViewbox return $LogoViewbox
} }
} }

View File

@ -1,62 +1,62 @@
function Invoke-WPFtweaksbutton { function Invoke-WPFtweaksbutton {
<# <#
.SYNOPSIS .SYNOPSIS
Invokes the functions associated with each group of checkboxes Invokes the functions associated with each group of checkboxes
#> #>
if($sync.ProcessRunning) { if($sync.ProcessRunning) {
$msg = "[Invoke-WPFtweaksbutton] Install process is currently running." $msg = "[Invoke-WPFtweaksbutton] Install process is currently running."
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning) [System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
return return
}
$Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"]
Set-WinUtilDNS -DNSProvider $sync["WPFchangedns"].text
if ($tweaks.count -eq 0 -and $sync["WPFchangedns"].text -eq "Default") {
$msg = "Please check the tweaks you wish to perform."
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
return
}
Write-Debug "Number of tweaks to process: $($Tweaks.Count)"
# The leading "," in the ParameterList is nessecary because we only provide one argument and powershell cannot be convinced that we want a nested loop with only one argument otherwise
$tweaksHandle = Invoke-WPFRunspace -ParameterList @(,("tweaks",$tweaks)) -DebugPreference $DebugPreference -ScriptBlock {
param(
$tweaks,
$DebugPreference
)
Write-Debug "Inside Number of tweaks to process: $($Tweaks.Count)"
$sync.ProcessRunning = $true
if ($Tweaks.count -eq 1) {
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
} else {
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
} }
# Execute other selected tweaks
for ($i = 0; $i -lt $Tweaks.Count; $i++) { $Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"]
Set-WinUtilProgressBar -Label "Applying $($tweaks[$i])" -Percent ($i / $tweaks.Count * 100)
Invoke-WinUtilTweaks $tweaks[$i] Set-WinUtilDNS -DNSProvider $sync["WPFchangedns"].text
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$Tweaks.Count) })
if ($tweaks.count -eq 0 -and $sync["WPFchangedns"].text -eq "Default") {
$msg = "Please check the tweaks you wish to perform."
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
return
} }
Set-WinUtilProgressBar -Label "Tweaks finished" -Percent 100
$sync.ProcessRunning = $false
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
Write-Host "================================="
Write-Host "-- Tweaks are Finished ---"
Write-Host "================================="
# $ButtonType = [System.Windows.MessageBoxButton]::OK Write-Debug "Number of tweaks to process: $($Tweaks.Count)"
# $MessageboxTitle = "Tweaks are Finished "
# $Messageboxbody = ("Done") # The leading "," in the ParameterList is nessecary because we only provide one argument and powershell cannot be convinced that we want a nested loop with only one argument otherwise
# $MessageIcon = [System.Windows.MessageBoxImage]::Information $tweaksHandle = Invoke-WPFRunspace -ParameterList @(,("tweaks",$tweaks)) -DebugPreference $DebugPreference -ScriptBlock {
# [System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon) param(
} $tweaks,
$DebugPreference
)
Write-Debug "Inside Number of tweaks to process: $($Tweaks.Count)"
$sync.ProcessRunning = $true
if ($Tweaks.count -eq 1) {
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
} else {
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
}
# Execute other selected tweaks
for ($i = 0; $i -lt $Tweaks.Count; $i++) {
Set-WinUtilProgressBar -Label "Applying $($tweaks[$i])" -Percent ($i / $tweaks.Count * 100)
Invoke-WinUtilTweaks $tweaks[$i]
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$Tweaks.Count) })
}
Set-WinUtilProgressBar -Label "Tweaks finished" -Percent 100
$sync.ProcessRunning = $false
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "None" -overlay "checkmark" })
Write-Host "================================="
Write-Host "-- Tweaks are Finished ---"
Write-Host "================================="
# $ButtonType = [System.Windows.MessageBoxButton]::OK
# $MessageboxTitle = "Tweaks are Finished "
# $Messageboxbody = ("Done")
# $MessageIcon = [System.Windows.MessageBoxImage]::Information
# [System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
}
} }

View File

@ -537,19 +537,19 @@ $sync["AutoThemeMenuItem"].Add_Click({
$sync.ThemePopup.IsOpen = $false $sync.ThemePopup.IsOpen = $false
Invoke-WinutilThemeChange -theme "Auto" Invoke-WinutilThemeChange -theme "Auto"
$_.Handled = $false $_.Handled = $false
}) })
# Define event handlers for menu items # Define event handlers for menu items
$sync["DarkThemeMenuItem"].Add_Click({ $sync["DarkThemeMenuItem"].Add_Click({
$sync.ThemePopup.IsOpen = $false $sync.ThemePopup.IsOpen = $false
Invoke-WinutilThemeChange -theme "Dark" Invoke-WinutilThemeChange -theme "Dark"
$_.Handled = $false $_.Handled = $false
}) })
# Define event handlers for menu items # Define event handlers for menu items
$sync["LightThemeMenuItem"].Add_Click({ $sync["LightThemeMenuItem"].Add_Click({
$sync.ThemePopup.IsOpen = $false $sync.ThemePopup.IsOpen = $false
Invoke-WinutilThemeChange -theme "Light" Invoke-WinutilThemeChange -theme "Light"
$_.Handled = $false $_.Handled = $false
}) })
# Define event handler for button click # Define event handler for button click
@ -567,11 +567,11 @@ $sync["SettingsButton"].Add_Click({
# Define event handlers for menu items # Define event handlers for menu items
$sync["ImportMenuItem"].Add_Click({ $sync["ImportMenuItem"].Add_Click({
# Handle Import menu item click # Handle Import menu item click
Write-Debug "Import clicked" Write-Debug "Import clicked"
$sync["SettingsPopup"].IsOpen = $false $sync["SettingsPopup"].IsOpen = $false
Invoke-WPFImpex -type "import" Invoke-WPFImpex -type "import"
$_.Handled = $false $_.Handled = $false
}) })
$sync["ExportMenuItem"].Add_Click({ $sync["ExportMenuItem"].Add_Click({