We have a WPF application (actually a VSTO WPF application). Some controls have several elements that, when clicked on, load data from the web service and update the user interface. Right now, we are executing these web requests synchronously, blocking the UI thread until the response returns. This prevents the user from clicking on the application while loading data, which potentially puts it in an invalid state for processing data when it is returned.
Of course, the application stops responding if the request takes a long time. Ideally, we would like the cancel button to be active during this time, but nothing else. Is there any reasonable way to do this, or do we have to switch requests to asynchronous execution using a background worker and write something that disables all controls except the cancel button when the request is executed?
edit: for the actions that we are already expecting, it will work for a long time (file upload, etc.), we open the progress dialog box. The fact is that you expect the action to be quite fast (a maximum of a couple of seconds), but from time to time it takes longer. In these circumstances, the instant blink of an entire window is a little distracting.
source share