Got it. This works:
$cache:showprogress = $true
New-UDDynamic -id 'sync-progress' -Content{
If($cache:showprogress){
New-UDProgress -id 'progress' -circular
}
}
New-UDButton -Text "Finish Him" -onclick {
$cache:showprogress = $false
Sync-UDElement -id 'sync-progress'
}
Figured it might help some others
Oh and while I was fiddling working this out, I got to this first - same idea, but updating the percentcomplete and then making it disappear when you hit 100.
$cache:progress = 5
New-UDDynamic -id 'sync-progress' -Content{
If($cache:progress -lt 100){
New-UDProgress -id 'progress' -percentcomplete $cache:progress
}
}
New-UDButton -Text "Half Way" -onclick {
$cache:progress = 50
Sync-UDElement -id 'sync-progress'
}
New-UDButton -Text "Finish Him" -onclick {
$cache:progress = 100
Sync-UDElement -id 'sync-progress'
}