当我们关闭wpf应用程序时,如何关闭所有后台进程. [英] How to close all the background procees when we closing the wpf application.

查看:957
本文介绍了当我们关闭wpf应用程序时,如何关闭所有后台进程.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在wpf应用程序中运行几个后台进程.我们要在关闭应用程序时关闭所有后台进程.当前,当我们关闭应用程序时,应用程序无法完全关闭,并且exe在任务管理器中显示 和Visual Studio引发错误.

We are running several background process in wpf application. We want to close all background process when we close the application.Currently when we close the application then application does not close completely and exe is showing in the task manager and visual studio raising the error.

W e正在运行多个进程,我们不知道哪个进程已经完成,哪些还没有完成.但是我们想用应用程序关闭所有过程.

如何在wpf中解决此问题?

How to fix this in wpf?

推荐答案

您可以使用
You can use Application.Current.Dispatcher.ShutdownStarted event


这篇关于当我们关闭wpf应用程序时,如何关闭所有后台进程.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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