Hello i'm just curious what you think about this: i want to start a longrunning method in a MainForm then show a modal dialog box with progressbar on in (which show operation progress, as you can guess). I know that this should be a multithreaded app (asynchronously) and i've seen plenty examples, but none of them works as fine as i want it to. What i really want to do is:
- run a longrunning method in background thread (whatever it does, say encryption, copying files, or even call sleep method - just do some calculations which takes time)
- show a modal dialog box with progressbar and Cancel button
- if the operation completed successfully - form with progressbar should get lost itself (i mean Close() but without user interaction)
- if users clicked the cancel button - operation should be canceled
I'll be really grateful for code example as simply as it can be - just to help me realize how it can be done.