Code: Select all
$autodeploy_Load={
UpdateNavButtons
}
function UpdateNavButtons
{
if (Test-Path C:\update.csv)
{
$a = Get-Content "C:\update.csv"
$a = $a -split ","
$user.Text = $a[1]
$pwd.Text = $a[3]
$client.Text = $a[5]
$back_db.Text = $a[7]
$back_client.Text = $a[9]
}
}
$button1_Click={
#TODO: Place custom script here
$csv = New-Object -TypeName System.Collections.ArrayList
$csv.Add("account,$($user.Text)") | Out-Null
$csv.Add("password,$($pwd.Text)") | Out-Null
$csv.Add("path,$($client.Text)") | Out-Null
$csv.Add("backup_path,$($back_db.Text)") | Out-Null
$csv.Add("backup_path2,$($back_db.Text)") | Out-Null
$csv | Out-File C:\update.csv -Force | Out-String
$RichTextBox1.Select()
$RichTextBox1.Select($RichTextBox1.TextLength,0)
$RichTextBox1.ScrollToCaret()
Invoke-Dploy_ps1
$richtextbox1.Text |Out-File C:\PACKPRESS\logs\Update\info\info.log -encoding utf8 -Force -Append
#Invoke-Dploy_ps1 -txt $richtextbox1
}
My problem is UI will freeze until the whole script completed.
Is there any solution to update the UI during the script running ?
If you can help me ,Thank you very much