Formatting

This commit is contained in:
Marterich 2025-03-20 00:10:27 +01:00
parent 7b63feab82
commit 553c203ebc
5 changed files with 11 additions and 32 deletions

View File

@ -5,19 +5,19 @@ function Initialize-InstallAppEntry {
Used to as part of the Install Tab UI generation Used to as part of the Install Tab UI generation
.PARAMETER TargetElement .PARAMETER TargetElement
The Element into which the Apps should be placed The Element into which the Apps should be placed
.PARAMETER AppKey .PARAMETER appKey
The Key of the app inside the $sync.configs.applicationsHashtable The Key of the app inside the $sync.configs.applicationsHashtable
#> #>
param( param(
[Windows.Controls.WrapPanel]$TargetElement, [Windows.Controls.WrapPanel]$TargetElement,
$AppKey $appKey
) )
# Create the outer Border for the application type # Create the outer Border for the application type
$border = New-Object Windows.Controls.Border $border = New-Object Windows.Controls.Border
$border.Style = $sync.Form.Resources.AppTileBorderStyle $border.Style = $sync.Form.Resources.AppTileBorderStyle
$border.Tag = $AppKey $border.Tag = $appKey
$border.ToolTip = $Apps.$AppKey.description $border.ToolTip = $Apps.$appKey.description
$border.Add_MouseUp({ $border.Add_MouseUp({
$childCheckbox = ($this.Child.Children | Where-Object {$_.Template.TargetType -eq [System.Windows.Controls.Checkbox]})[0] $childCheckbox = ($this.Child.Children | Where-Object {$_.Template.TargetType -eq [System.Windows.Controls.Checkbox]})[0]
$childCheckBox.isChecked = -not $childCheckbox.IsChecked $childCheckBox.isChecked = -not $childCheckbox.IsChecked
@ -39,7 +39,7 @@ function Initialize-InstallAppEntry {
# Create the CheckBox, vertically centered # Create the CheckBox, vertically centered
$checkBox = New-Object Windows.Controls.CheckBox $checkBox = New-Object Windows.Controls.CheckBox
$checkBox.Name = $AppKey $checkBox.Name = $appKey
$checkbox.Style = $sync.Form.Resources.AppTileCheckboxStyle $checkbox.Style = $sync.Form.Resources.AppTileCheckboxStyle
$checkbox.Add_Checked({ $checkbox.Add_Checked({
Invoke-WPFSelectedAppsUpdate -type "Add" -checkbox $this Invoke-WPFSelectedAppsUpdate -type "Add" -checkbox $this
@ -69,7 +69,7 @@ function Initialize-InstallAppEntry {
# Create the TextBlock for the application name # Create the TextBlock for the application name
$appName = New-Object Windows.Controls.TextBlock $appName = New-Object Windows.Controls.TextBlock
$appName.Style = $sync.Form.Resources.AppTileNameStyle $appName.Style = $sync.Form.Resources.AppTileNameStyle
$appName.Text = $Apps.$AppKey.content $appName.Text = $Apps.$appKey.content
$imageAndNamePanel.Children.Add($appName) | Out-Null $imageAndNamePanel.Children.Add($appName) | Out-Null
# Add the image and name panel to the Checkbox # Add the image and name panel to the Checkbox

View File

@ -10,13 +10,9 @@ function Invoke-WPFUIApps {
switch ($TargetGridName) { switch ($TargetGridName) {
"appspanel" { "appspanel" {
$dockPanel = Initialize-InstallAppsMainElement -TargetGridName $TargetGridName $dockPanel = Initialize-InstallAppsMainElement -TargetGridName $TargetGridName
$null = Initialize-InstallHeader -TargetElement $dockPanel $null = Initialize-InstallHeader -TargetElement $dockPanel
$sync.ItemsControl = Initialize-InstallAppArea -TargetElement $dockPanel $sync.ItemsControl = Initialize-InstallAppArea -TargetElement $dockPanel
Initialize-InstallCategoryAppList -TargetElement $sync.ItemsControl -Apps $Apps Initialize-InstallCategoryAppList -TargetElement $sync.ItemsControl -Apps $Apps
} }
default { default {
Write-Output "$TargetGridName not yet implemented" Write-Output "$TargetGridName not yet implemented"

View File

@ -45,7 +45,6 @@ class GenericException : Exception {
[string]$additionalData [string]$additionalData
GenericException($Message) : base($Message) {} GenericException($Message) : base($Message) {}
} }
log_time_taken "Main.ps1 class setup line 48"
$inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^<Win.*', '<Window' $inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^<Win.*', '<Window'
@ -582,7 +581,5 @@ $sync["SponsorMenuItem"].Add_Click({
Show-CustomDialog -Title "Sponsors" -Message $authorInfo -EnableScroll $true Show-CustomDialog -Title "Sponsors" -Message $authorInfo -EnableScroll $true
}) })
log_time_taken "Main.ps1 before ShowDialog"
$sync["Form"].ShowDialog() | out-null $sync["Form"].ShowDialog() | out-null
Stop-Transcript Stop-Transcript

View File

@ -12,16 +12,6 @@ param (
[switch]$Run [switch]$Run
) )
function log_time_taken {
param (
[string]$description
)
$current_time = Get-Date
$time_taken = $current_time - $sync.start_time
Write-Output "[$time_taken] $description" >> $sync.log
$sync.start_time = $current_time
}
# Set DebugPreference based on the -Debug switch # Set DebugPreference based on the -Debug switch
if ($Debug) { if ($Debug) {
$DebugPreference = "Continue" $DebugPreference = "Continue"
@ -44,8 +34,6 @@ Add-Type -AssemblyName System.Windows.Forms
# Variable to sync between runspaces # Variable to sync between runspaces
$sync = [Hashtable]::Synchronized(@{}) $sync = [Hashtable]::Synchronized(@{})
$sync.log = "$ENV:USERPROFILE\Desktop\winutil.log"
$sync.start_time = Get-Date
$sync.PSScriptRoot = $PSScriptRoot $sync.PSScriptRoot = $PSScriptRoot
$sync.version = "#{replaceme}" $sync.version = "#{replaceme}"
$sync.configs = @{} $sync.configs = @{}
@ -100,5 +88,3 @@ Start-Transcript -Path "$logdir\winutil_$dateTime.log" -Append -NoClobber | Out-
# Set PowerShell window title # Set PowerShell window title
$Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Admin)" $Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Admin)"
clear-host clear-host
Write-Output "" > $sync.log
log_time_taken "Start.ps1 finished"