Nahum
Nahum

Reputation: 7197

how to test that the wpf gui thread is Alive

I have a modal wpf application and I need a way to monitor if the application is still working and the gui is responding using other process I cannot think of any idea how it can be done.

on other applications I just raise an "alive" event from my main loop but i don't have any clear main loop in the wpf app.

is adding a dispatcher timer to the application that will raise the event is a good idea?

Upvotes: 2

Views: 601

Answers (1)

Sriram Sakthivel
Sriram Sakthivel

Reputation: 73442

Am converting my comment into answer on request.

I think you're looking for Process.Responding property. This will return whether UI is responsive or not.

Note: Process.Responding cannot be used with process which doesn't have UI.

If a process has a user interface, the Responding property contacts the user interface to determine whether the process is responding to user input. If the interface does not respond immediately, the Responding property returns false. Use this property to determine whether the interface of the associated process has stopped responding.

If the process does not have a MainWindowHandle, this property returns true.

For more info take a look at Process.Responding

Upvotes: 2

Related Questions