Remove Write-Debug (#4498)

* Update Invoke-WinUtilCurrentSystem.ps1

* Update Invoke-WinUtilFontScaling.ps1

* Update Invoke-WinUtilTweaks.ps1

* Update Reset-WPFCheckBoxes.ps1

* Update Set-Preferences.ps1

* Update Update-WinUtilSelections.ps1

* Update Invoke-WPFSelectedCheckboxesUpdate.ps1

* Update Invoke-WPFtweaksbutton.ps1

* Update main.ps1

* Update main.ps1

* Update main.ps1

* Update main.ps1

* Update main.ps1

* Merge branch 'main' into Remove-Write-Debug
This commit is contained in:
Gabi
2026-05-19 21:16:06 +03:00
committed by GitHub
parent a09736f9a8
commit 8034e85521
9 changed files with 7 additions and 98 deletions
-34
View File
@@ -13,14 +13,12 @@ $maxthreads = [int]$env:NUMBER_OF_PROCESSORS
# Create a new session state for parsing variables into our runspace
$hashVars = New-object System.Management.Automation.Runspaces.SessionStateVariableEntry -ArgumentList 'sync',$sync,$Null
$debugVar = New-object System.Management.Automation.Runspaces.SessionStateVariableEntry -ArgumentList 'DebugPreference',$DebugPreference,$Null
$uiVar = New-object System.Management.Automation.Runspaces.SessionStateVariableEntry -ArgumentList 'PARAM_NOUI',$PARAM_NOUI,$Null
$offlineVar = New-object System.Management.Automation.Runspaces.SessionStateVariableEntry -ArgumentList 'PARAM_OFFLINE',$PARAM_OFFLINE,$Null
$InitialSessionState = [System.Management.Automation.Runspaces.InitialSessionState]::CreateDefault()
# Add the variable to the session state
$InitialSessionState.Variables.Add($hashVars)
$InitialSessionState.Variables.Add($debugVar)
$InitialSessionState.Variables.Add($uiVar)
$InitialSessionState.Variables.Add($offlineVar)
@@ -210,7 +208,6 @@ $sync.keys | ForEach-Object {
$sync["$psitem"].Add_MouseUp({
[System.Object]$Sender = $args[0]
Start-Process $Sender.ToolTip -ErrorAction Stop
Write-Debug "Opening: $($Sender.ToolTip)"
})
}
@@ -316,7 +313,6 @@ $sync["Form"].Add_MouseDoubleClick({
})
$sync["Form"].Add_Deactivated({
Write-Debug "WinUtil lost focus"
Invoke-WPFPopup -Action "Hide" -Popups @("Settings", "Theme", "FontScaling")
})
@@ -330,10 +326,6 @@ $sync["Form"].Add_ContentRendered({
$screenWidth = $primaryScreen.Bounds.Width
$screenHeight = $primaryScreen.Bounds.Height
# Print the screen size
Write-Debug "Primary Monitor Width: $screenWidth pixels"
Write-Debug "Primary Monitor Height: $screenHeight pixels"
# Compare with the primary monitor size
if ($sync.Form.ActualWidth -gt $screenWidth -or $sync.Form.ActualHeight -gt $screenHeight) {
Write-Debug "The specified width and/or height is greater than the primary monitor size."
@@ -341,11 +333,7 @@ $sync["Form"].Add_ContentRendered({
$sync.Form.Top = 0
$sync.Form.Width = $screenWidth
$sync.Form.Height = $screenHeight
} else {
Write-Debug "The specified width and height are within the primary monitor size limits."
}
} else {
Write-Debug "Unable to retrieve information about the primary monitor."
}
if ($PARAM_OFFLINE) {
@@ -445,41 +433,33 @@ $sync["Form"].Add_Activated({
})
$sync["ThemeButton"].Add_Click({
Write-Debug "ThemeButton clicked"
Invoke-WPFPopup -PopupActionTable @{ "Settings" = "Hide"; "Theme" = "Toggle"; "FontScaling" = "Hide" }
})
$sync["AutoThemeMenuItem"].Add_Click({
Write-Debug "About clicked"
Invoke-WPFPopup -Action "Hide" -Popups @("Theme")
Invoke-WinutilThemeChange -theme "Auto"
})
$sync["DarkThemeMenuItem"].Add_Click({
Write-Debug "Dark Theme clicked"
Invoke-WPFPopup -Action "Hide" -Popups @("Theme")
Invoke-WinutilThemeChange -theme "Dark"
})
$sync["LightThemeMenuItem"].Add_Click({
Write-Debug "Light Theme clicked"
Invoke-WPFPopup -Action "Hide" -Popups @("Theme")
Invoke-WinutilThemeChange -theme "Light"
})
$sync["SettingsButton"].Add_Click({
Write-Debug "SettingsButton clicked"
Invoke-WPFPopup -PopupActionTable @{ "Settings" = "Toggle"; "Theme" = "Hide"; "FontScaling" = "Hide" }
})
$sync["ImportMenuItem"].Add_Click({
Write-Debug "Import clicked"
Invoke-WPFPopup -Action "Hide" -Popups @("Settings")
Invoke-WPFImpex -type "import"
})
$sync["ExportMenuItem"].Add_Click({
Write-Debug "Export clicked"
Invoke-WPFPopup -Action "Hide" -Popups @("Settings")
Invoke-WPFImpex -type "export"
})
$sync["AboutMenuItem"].Add_Click({
Write-Debug "About clicked"
Invoke-WPFPopup -Action "Hide" -Popups @("Settings")
$authorInfo = @"
@@ -492,12 +472,10 @@ Version : <a href="https://github.com/ChrisTitusTech/winutil/releases/tag/$($sy
Show-CustomDialog -Title "About" -Message $authorInfo
})
$sync["DocumentationMenuItem"].Add_Click({
Write-Debug "Documentation clicked"
Invoke-WPFPopup -Action "Hide" -Popups @("Settings")
Start-Process "https://winutil.christitus.com/"
})
$sync["SponsorMenuItem"].Add_Click({
Write-Debug "Sponsors clicked"
Invoke-WPFPopup -Action "Hide" -Popups @("Settings")
$authorInfo = @"
@@ -517,7 +495,6 @@ $sync["SponsorMenuItem"].Add_Click({
# Font Scaling Event Handlers
$sync["FontScalingButton"].Add_Click({
Write-Debug "FontScalingButton clicked"
Invoke-WPFPopup -PopupActionTable @{ "Settings" = "Hide"; "Theme" = "Hide"; "FontScaling" = "Toggle" }
})
@@ -528,13 +505,11 @@ $sync["FontScalingSlider"].Add_ValueChanged({
})
$sync["FontScalingResetButton"].Add_Click({
Write-Debug "FontScalingResetButton clicked"
$sync.FontScalingSlider.Value = 1.0
$sync.FontScalingValue.Text = "100%"
})
$sync["FontScalingApplyButton"].Add_Click({
Write-Debug "FontScalingApplyButton clicked"
$scaleFactor = $sync.FontScalingSlider.Value
Invoke-WinUtilFontScaling -ScaleFactor $scaleFactor
Invoke-WPFPopup -Action "Hide" -Popups @("FontScaling")
@@ -547,49 +522,40 @@ $sync["WPFTab5BT"].Add_Click({
})
$sync["WPFWin11ISOBrowseButton"].Add_Click({
Write-Debug "WPFWin11ISOBrowseButton clicked"
Invoke-WinUtilISOBrowse
})
$sync["WPFWin11ISODownloadLink"].Add_Click({
Write-Debug "WPFWin11ISODownloadLink clicked"
Start-Process "https://www.microsoft.com/software-download/windows11"
})
$sync["WPFWin11ISOMountButton"].Add_Click({
Write-Debug "WPFWin11ISOMountButton clicked"
Invoke-WinUtilISOMountAndVerify
})
$sync["WPFWin11ISOModifyButton"].Add_Click({
Write-Debug "WPFWin11ISOModifyButton clicked"
Invoke-WinUtilISOModify
})
$sync["WPFWin11ISOChooseISOButton"].Add_Click({
Write-Debug "WPFWin11ISOChooseISOButton clicked"
$sync["WPFWin11ISOOptionUSB"].Visibility = "Collapsed"
Invoke-WinUtilISOExport
})
$sync["WPFWin11ISOChooseUSBButton"].Add_Click({
Write-Debug "WPFWin11ISOChooseUSBButton clicked"
$sync["WPFWin11ISOOptionUSB"].Visibility = "Visible"
Invoke-WinUtilISORefreshUSBDrives
})
$sync["WPFWin11ISORefreshUSBButton"].Add_Click({
Write-Debug "WPFWin11ISORefreshUSBButton clicked"
Invoke-WinUtilISORefreshUSBDrives
})
$sync["WPFWin11ISOWriteUSBButton"].Add_Click({
Write-Debug "WPFWin11ISOWriteUSBButton clicked"
Invoke-WinUtilISOWriteUSB
})
$sync["WPFWin11ISOCleanResetButton"].Add_Click({
Write-Debug "WPFWin11ISOCleanResetButton clicked"
Invoke-WinUtilISOCleanAndReset
})