mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-09 09:31:15 +10:00
Clean up analyzer warnings across app search and ISO workflows (#4794)
* Clean up analyzer warnings * Align analyzer warning cleanup policy * Run PSScriptAnalyzer directly in unittests workflow * Bind lazy-rendered buttons to click handlers * Remove WinUtil performance tracing * Fix Win11 ISO creator temp directory reuse
This commit is contained in:
+16
-14
@@ -57,10 +57,8 @@ $sync.configs.appxHashtable = @{}
|
||||
$sync.configs.appx.PSObject.Properties | ForEach-Object {
|
||||
$sync.configs.appxHashtable[$_.Name] = $_.Value
|
||||
}
|
||||
Write-WinUtilPerformanceCheckpoint -Name "Config hashtables initialized"
|
||||
|
||||
Set-Preferences
|
||||
Write-WinUtilPerformanceCheckpoint -Name "Preferences loaded"
|
||||
|
||||
if ($Preset) {
|
||||
Initialize-WinUtilRunspacePool | Out-Null
|
||||
@@ -101,7 +99,6 @@ $reader = (New-Object System.Xml.XmlNodeReader $xaml)
|
||||
try {
|
||||
$sync["Form"] = [Windows.Markup.XamlReader]::Load( $reader )
|
||||
$readerOperationSuccessful = $true
|
||||
Write-WinUtilPerformanceCheckpoint -Name "XAML loaded"
|
||||
} catch [System.Management.Automation.MethodInvocationException] {
|
||||
Write-Host "We ran into a problem with the XAML code. Check the syntax for this control..." -ForegroundColor Red
|
||||
Write-Host $error[0].Exception.Message -ForegroundColor Red
|
||||
@@ -136,6 +133,7 @@ $sync.Form.Add_Loaded({
|
||||
[System.IntPtr]$lParam,
|
||||
[ref]$handled
|
||||
)
|
||||
$null = $hwnd, $wParam, $lParam
|
||||
# Check for the Event WM_SETTINGCHANGE (0x1001A) and validate that Button shows the icon for "Auto" => [char]0xF08C
|
||||
if (($msg -eq 0x001A) -and $sync.ThemeButton.Content -eq [char]0xF08C) {
|
||||
$currentTime = [datetime]::Now
|
||||
@@ -150,7 +148,6 @@ $sync.Form.Add_Loaded({
|
||||
})
|
||||
|
||||
Invoke-WinutilThemeChange -theme $sync.preferences.theme
|
||||
Write-WinUtilPerformanceCheckpoint -Name "Theme applied"
|
||||
|
||||
|
||||
# Build only the default tab before first paint; other tabs initialize on first activation.
|
||||
@@ -184,17 +181,23 @@ switch ($sync.preferences.packagemanager) {
|
||||
$sync.keys | ForEach-Object {
|
||||
if($sync.$psitem) {
|
||||
if($($sync["$psitem"].GetType() | Select-Object -ExpandProperty Name) -eq "ToggleButton") {
|
||||
$sync["$psitem"].Add_Click({
|
||||
[System.Object]$Sender = $args[0]
|
||||
Invoke-WPFButton $Sender.name
|
||||
})
|
||||
if ($sync.Buttons -notcontains $psitem) {
|
||||
$sync["$psitem"].Add_Click({
|
||||
[System.Object]$Sender = $args[0]
|
||||
Invoke-WPFButton $Sender.name
|
||||
})
|
||||
$sync.Buttons.Add($psitem) | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
if($($sync["$psitem"].GetType() | Select-Object -ExpandProperty Name) -eq "Button") {
|
||||
$sync["$psitem"].Add_Click({
|
||||
[System.Object]$Sender = $args[0]
|
||||
Invoke-WPFButton $Sender.name
|
||||
})
|
||||
if ($sync.Buttons -notcontains $psitem) {
|
||||
$sync["$psitem"].Add_Click({
|
||||
[System.Object]$Sender = $args[0]
|
||||
Invoke-WPFButton $Sender.name
|
||||
})
|
||||
$sync.Buttons.Add($psitem) | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
if ($($sync["$psitem"].GetType() | Select-Object -ExpandProperty Name) -eq "TextBlock") {
|
||||
@@ -221,7 +224,6 @@ Set-WinUtilTaskbaritem -state "None"
|
||||
$sync["Form"].title = $sync["Form"].title + " " + $sync.version
|
||||
# Set the commands that will run when the form is closed
|
||||
$sync["Form"].Add_Closing({
|
||||
Stop-WinUtilPerformanceTrace -Name "Window closing"
|
||||
Close-WinUtilRunspacePool
|
||||
[System.GC]::Collect()
|
||||
})
|
||||
@@ -290,7 +292,6 @@ $sync["Form"].Add_Deactivated({
|
||||
})
|
||||
|
||||
$sync["Form"].Add_ContentRendered({
|
||||
Write-WinUtilPerformanceCheckpoint -Name "First content rendered"
|
||||
# Load the Windows Forms assembly
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
$primaryScreen = [System.Windows.Forms.Screen]::PrimaryScreen
|
||||
@@ -378,6 +379,7 @@ $sync["SearchBar"].Add_TextChanged({
|
||||
|
||||
$sync["Form"].Add_Loaded({
|
||||
param($e)
|
||||
$null = $e
|
||||
$sync.Form.MinWidth = "1000"
|
||||
$sync["Form"].MaxWidth = [Double]::PositiveInfinity
|
||||
$sync["Form"].MaxHeight = [Double]::PositiveInfinity
|
||||
|
||||
Reference in New Issue
Block a user