且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在脚本运行时刷新表单上的数据的后台作业?

更新时间:2023-10-21 11:12:34

不错的小工具.

我删除了对 Job 的所有引用,并将作业中的代码添加到 Tick 本身中:

I removed all references to the Job, and added the code from the job into the Tick itself:

$Timer.Add_Tick({
   $Status = GetStatus
   #LAN
   If ($Status.LANOnStatus -eq $True)
      {$Pb_LANOn.Image = $GreenLight}
   else
      {$Pb_LANOn.Image = $RedLight}
   ...
})

既然你提到这个函数花费了太多时间,我也将Tick间隔从3秒增加到10秒.这在我的 PC 上似乎运行良好.

Since you mentioned the function took too much time, I also increased the Tick interval from 3 to 10 seconds. This seems to work fine on my PC.