22 lines
364 B
PowerShell
22 lines
364 B
PowerShell
function Invoke-WPFUIThread {
|
|||
|
|
<#
|
||
|
|
|
||
|
|
.SYNOPSIS
|
||
|
|
Creates and runs a task on Winutil's WPF Forms thread.
|
||
|
|
|
||
|
|
.PARAMETER ScriptBlock
|
||
|
|
The scriptblock to invoke in the thread
|
||
|
|
#>
|
||
|
|
|
||
|
|
[CmdletBinding()]
|
||
|
|
Param (
|
||
|
|
$ScriptBlock
|
||
|
|
)
|
||
|
|
|
||
|
|
if ($PARAM_NOUI) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
$sync.form.Dispatcher.Invoke([action]$ScriptBlock)
|
||
|
|
}
|