I have a little service that uploads an image, and I use it like this:
ImageInfo result = await service.UploadAsync(imagePath);
What I'd like to do is to display a progress dialog, but only if the upload operation takes more than, say, 2 seconds. After the upload is done, I want to close the progress dialog.
I made a crude solution using Task/ContinueWith, but I was hoping for a more "elegant" way.
How can I achieve this using async/await
?
May be something like this?
Thought I'd still post my solution, as it illustrates how to show and dismiss a modal dialog. It's for WPF, yet the same concept applies to WinForms.