winforms - Detect Not Responding in Own App -


Is it possible to find out that when your application stops responding, Can go to task manager / end process and / or last work etc?

Stay with me - this is not a direct answer to your question, but in your situation There are some design advice to avoid. If your app is really locked up and is not responding then there is actually no way to find and answer it. The trick to start is to avoid coming into position.

In my experience, WinForms apps almost never stop responding. Instead, they appear unresponsive while holding long-running tasks or holding in eternal (or at least long lasting) ends.

By putting it on long lasting processes in another thread, the threading technique is a simple trick that works for long lasting loops.

Application.DoEvents ()

Inside the loop. This makes the app feel reactive, that the loop is going on, when it will normally only show the lock.

The way I usually handle it is by placing a status label that I keep updating, the user knows that the app is doing something like this below:

  foreach (myTable.Rows in DataRow R) {StatusLabel.Text = "Resource Now" + R [0] .Ostring (); Application.DoEvents (); ... now do real work}  

This gives the user a response to let them know that the app is actually doing something, and not just "lock up". 99% of the time, user perception is in all cases.

Edit - Added to answer the comment below

Application.DoEvents () does contains a performance hit. You have to decide whether it is worth it or not. As I have shown above (in combination with some kind of progress indicator), it can eliminate the user's frustration, and I have found a meaningful trade-off for those long lasting processes.

My basic answer mentions that 99% of the time I give an example of the example where I used it and realized that it was fair.

I inherited a WinForms application written by one of my predecessors. There was such a process in this application that it was necessary to have weekly and weekly records to be short and processed. At the top of records in large quantities, the database was not well prepared, and as a result the process was more than an hour. The user will be stuck on their computer for an hour, not seeing anything on this screen. The app was really working if there was no way to know them. I added the above code as a temporary solution and the end user was very grateful. He really appreciated knowing that the application was actually working and not only hung.

Adding the App. Doions (processing) from one hour to one hour and five minutes or so it was a slow slower, but the user was happy with it, because it took longer, they knew what it was doing.

Incidentally, I found more happiness because sometimes, due to unusually high numbers of records, the user took a long time, the user finished the final work on the program and ran it again It was thinking that it was closed, it would essentially spend hours to fix the data.

A last side note, I rewritten the app from scratch, in which the database was redesigned, and this process now takes 5 seconds. I do not want to say that you should make big, but to think of why your app is locking if you can see the work in a way that is more efficient and gets a better design, Can save completely in many cases.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -