如何使用C#检查任何WPF / Windows应用程序中任何层/组件的活动性

问题描述:

您好,

我们是否有办法检查或监控任何WPF应用程序中任何层或组件的活动性?我听说过WatchDog机制用于此目的但无法获得任何正确的信息。



我的情景 -



ComponentOne(ClassLibrary)

||

||在ComponentTwo中使用的引用

V

ComponetTwo(ClassLibrary)

||

||在ComponentThree中使用的引用

V

ComponentThree(.exe / view)



在视图中我想要显示上面两个组件的健康状态,如Active - 如果一切正常,死 - 如果任何线程被中止等等。

我们需要引入一种机制,GUI知道接口是否仍然完好/活着/回应等



我尝试过:



阅读关于WatchDog,但没有运气

Hello,
Do we have any way to check or monitor the activeness of any layer or component in any WPF application ? I heard about WatchDog mechanism to use for this purpose but couldn't get any proper information.

My Scenario -

ComponentOne (ClassLibrary)
||
|| reference being used in ComponentTwo
V
ComponetTwo (ClassLibrary)
||
|| reference being used in ComponentThree
V
ComponentThree (.exe/view)

On view i want to show the health of above two component something like Active-if everything is fine, Dead- if any Thread is aborted etc.
we need to introduce a mechanism that the GUI knows if the Interface is still intact/alive/responding etc.

What I have tried:

Read about WatchDog but no luck

使用Dispatcher.Timer以一定的时间间隔执行代码,检查系统的运行状况;例如连接状态;其他线程; user(in)activity。
Use Dispatcher.Timer(s) to execute code at certain intervals that checks the "health" of your system; e.g. connection status; other threads; user (in)activity.