process.WaitForExit()异步 [英] process.WaitForExit() asynchronously

查看:176
本文介绍了process.WaitForExit()异步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要等待进程结束,但 process.WaitForExit()挂我的GUI。有没有一种基于事件的方式,或者我需要生成一个线程阻塞,直到退出,然后委托的情况下自己吗?

I want to wait for a process to finish, but process.WaitForExit() hangs my GUI. Is there an event-based way, or do I need to spawn a thread to block until exit, then delegate the event myself?

推荐答案

<一个href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.exited.aspx">process.Exited + = [事件处理程序]

process.Exited += [EventHandler]

这篇关于process.WaitForExit()异步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆