Move the Xaml Generation of the panels to the main script

This commit is contained in:
Martin Wiethan 2024-06-19 00:03:46 +02:00
parent 827398b007
commit 225441b804
2 changed files with 17 additions and 16 deletions

View File

@ -71,29 +71,21 @@ Get-ChildItem .\config | Where-Object {$PSItem.Extension -eq ".cfg"} | ForEach-O
$script_content.Add($(Write-output "`$sync.configs.$($psitem.BaseName) = '$(Get-Content $PSItem.FullName)'")) $script_content.Add($(Write-output "`$sync.configs.$($psitem.BaseName) = '$(Get-Content $PSItem.FullName)'"))
} }
Write-Progress -Activity "Compiling" -Status "Writing xaml"
$xaml = (Get-Content .\xaml\inputXML.xaml).replace("'","''") $xaml = (Get-Content .\xaml\inputXML.xaml).replace("'","''")
# Dot-source the Get-TabXaml function
. .\functions\private\Get-TabXaml.ps1
Write-Progress -Activity "Compiling" -Status "Building: Xaml " -PercentComplete 75
$appXamlContent = Get-TabXaml "applications" 5
$tweaksXamlContent = Get-TabXaml "tweaks"
$featuresXamlContent = Get-TabXaml "feature"
Write-Progress -Activity "Compiling" -Status "Adding: Xaml " -PercentComplete 90
# Replace the placeholder in $inputXML with the content of inputApp.xaml
$xaml = $xaml -replace "{{InstallPanel_applications}}", $appXamlContent
$xaml = $xaml -replace "{{InstallPanel_tweaks}}", $tweaksXamlContent
$xaml = $xaml -replace "{{InstallPanel_features}}", $featuresXamlContent
$script_content.Add($(Write-output "`$inputXML = '$xaml'")) $script_content.Add($(Write-output "`$inputXML = '$xaml'"))
$script_content.Add($(Get-Content .\scripts\main.ps1)) $script_content.Add($(Get-Content .\scripts\main.ps1))
if ($Debug){ if ($Debug){
Write-Progress -Activity "Compiling" -Status "Writing debug files" -PercentComplete 95 Write-Progress -Activity "Compiling" -Status "Writing debug files" -PercentComplete 95
# Dot-source the Get-TabXaml function
. .\functions\private\Get-TabXaml.ps1
$appXamlContent = Get-TabXaml "applications" 5
$tweaksXamlContent = Get-TabXaml "tweaks"
$featuresXamlContent = Get-TabXaml "feature"
$appXamlContent | Out-File -FilePath ".\xaml\inputApp.xaml" -Encoding ascii $appXamlContent | Out-File -FilePath ".\xaml\inputApp.xaml" -Encoding ascii
$tweaksXamlContent | Out-File -FilePath ".\xaml\inputTweaks.xaml" -Encoding ascii $tweaksXamlContent | Out-File -FilePath ".\xaml\inputTweaks.xaml" -Encoding ascii
$featuresXamlContent | Out-File -FilePath ".\xaml\inputFeatures.xaml" -Encoding ascii $featuresXamlContent | Out-File -FilePath ".\xaml\inputFeatures.xaml" -Encoding ascii

View File

@ -52,6 +52,15 @@ $sync.runspace.Open()
$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'
# Dynamically Generate the xaml code for the different panels at Runtime
$appXamlContent = Get-TabXaml "applications" 5
$tweaksXamlContent = Get-TabXaml "tweaks"
$featuresXamlContent = Get-TabXaml "feature"
$inputXML = $inputXML -replace "{{InstallPanel_applications}}", $appXamlContent
$inputXML = $inputXML -replace "{{InstallPanel_tweaks}}", $tweaksXamlContent
$inputXML = $inputXML -replace "{{InstallPanel_features}}", $featuresXamlContent
if ((Get-WinUtilToggleStatus WPFToggleDarkMode) -eq $True) { if ((Get-WinUtilToggleStatus WPFToggleDarkMode) -eq $True) {
if (Invoke-WinUtilGPU -eq $True) { if (Invoke-WinUtilGPU -eq $True) {
$ctttheme = 'Matrix' $ctttheme = 'Matrix'