简体   繁体   中英

PowerShell and WPF GUI freeze

I have a PowerShell function to look in a directory for zip files, extract it, and rename the files. The function also changes the status bar item to update what file it is on. I noticed that when this runs the GUI would freeze.

How can I get the function run and update the GUI without it freezing?

Don't do expensive operations on the UI thread -- use a background worker. Here's a tutorial: http://dotnetperls.com/backgroundworker-introduction

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM