mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-02-05 23:40:10 +00:00
Feature/pester (#321)
* Update Branch in script * pester for configs * Update Branch in script * update describe * github action * test pipeline * test pipeline * test pipeline * test pipeline * test pipeline * test windows container * gui tests * Updated applications.json to stop failing test * test pipeline * test pipeline * test pipeline * add test for original values if tweak is configured * test pipeline * test pipeline * remove merge request * added test to ensure main script functions Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com> Co-authored-by: DeveloperDurp <DeveloperDurp@users.noreply.github.com>
This commit is contained in:
52
runspace.ps1
52
runspace.ps1
@@ -1,5 +1,5 @@
|
||||
#for CI/CD
|
||||
$BranchToUse = 'main'
|
||||
$BranchToUse = 'feature/pester'
|
||||
|
||||
<#
|
||||
.NOTES
|
||||
@@ -1344,37 +1344,37 @@ write-host "====Chris Titus Tech====="
|
||||
write-host "=====Windows Toolbox====="
|
||||
|
||||
if($gui -eq $true){
|
||||
$inputXML = $inputXML -replace 'mc:Ignorable="d"','' -replace "x:N",'N' -replace '^<Win.*', '<Window'
|
||||
[xml]$XAML = $inputXML
|
||||
$reader=(New-Object System.Xml.XmlNodeReader $xaml)
|
||||
$inputXML = $inputXML -replace 'mc:Ignorable="d"','' -replace "x:N",'N' -replace '^<Win.*', '<Window'
|
||||
[xml]$XAML = $inputXML
|
||||
$reader=(New-Object System.Xml.XmlNodeReader $xaml)
|
||||
|
||||
try{$sync["Form"]=[Windows.Markup.XamlReader]::Load( $reader )}
|
||||
catch [System.Management.Automation.MethodInvocationException] {
|
||||
Write-Warning "We ran into a problem with the XAML code. Check the syntax for this control..."
|
||||
write-host $error[0].Exception.Message -ForegroundColor Red
|
||||
if ($error[0].Exception.Message -like "*button*"){
|
||||
write-warning "Ensure your <button in the `$inputXML does NOT have a Click=ButtonClick property. PS can't handle this`n`n`n`n"}
|
||||
}
|
||||
catch{#if it broke some other way <img draggable="false" role="img" class="emoji" alt="😀" src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/svg/1f600.svg">
|
||||
Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed."
|
||||
}
|
||||
try{$sync["Form"]=[Windows.Markup.XamlReader]::Load( $reader )}
|
||||
catch [System.Management.Automation.MethodInvocationException] {
|
||||
Write-Warning "We ran into a problem with the XAML code. Check the syntax for this control..."
|
||||
write-host $error[0].Exception.Message -ForegroundColor Red
|
||||
if ($error[0].Exception.Message -like "*button*"){
|
||||
write-warning "Ensure your <button in the `$inputXML does NOT have a Click=ButtonClick property. PS can't handle this`n`n`n`n"}
|
||||
}
|
||||
catch{#if it broke some other way <img draggable="false" role="img" class="emoji" alt="😀" src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/svg/1f600.svg">
|
||||
Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed."
|
||||
}
|
||||
|
||||
# Store Form Objects In PowerShell
|
||||
$xaml.SelectNodes("//*[@Name]") | ForEach-Object {$sync["$("$($psitem.Name)")"] = $sync["Form"].FindName($psitem.Name)}
|
||||
# Store Form Objects In PowerShell
|
||||
$xaml.SelectNodes("//*[@Name]") | ForEach-Object {$sync["$("$($psitem.Name)")"] = $sync["Form"].FindName($psitem.Name)}
|
||||
|
||||
#Gives every button the invoke-button function
|
||||
$sync.keys | ForEach-Object {
|
||||
if($sync.$psitem){
|
||||
if($($sync["$psitem"].GetType() | Select-Object -ExpandProperty Name) -eq "Button"){
|
||||
$sync["$psitem"].Add_Click({
|
||||
[System.Object]$Sender = $args[0]
|
||||
Invoke-Button $Sender.name
|
||||
})
|
||||
#Gives every button the invoke-button function
|
||||
$sync.keys | ForEach-Object {
|
||||
if($sync.$psitem){
|
||||
if($($sync["$psitem"].GetType() | Select-Object -ExpandProperty Name) -eq "Button"){
|
||||
$sync["$psitem"].Add_Click({
|
||||
[System.Object]$Sender = $args[0]
|
||||
Invoke-Button $Sender.name
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sync["Form"].ShowDialog() | out-null
|
||||
$sync["Form"].ShowDialog() | out-null
|
||||
}
|
||||
|
||||
<#
|
||||
|
||||
Reference in New Issue
Block a user