views:

49

answers:

2

lets say you are adding a feature to an old and running windows form application now the whole application is running in one thread and the application is really big and have many forms so you cant refract it to run in multithreads, now the application gui freeze everytime you make a process , is there is any way to have an indicator that its loading or in progress while its freezing ? without changing the whole design of the software to support threads etc ?

by the way i dont want it to stop freezing its ok to freeze i just want it to to indicate that its doing something !

any idea would be appreciated, thanks...

+1  A: 

See BackGroundWorker componet if application is written using .net 2.0 or higher version.

saurabh
but using background worker is going to force me to change the whole application adding all the process that makes the gui freeze to the backgroundworker and then adding a progress bar or something , that is not applicable , i dont want the application to stop freezing ! i just want to display something saying wait or loading without changing the whole application
Stacker
+1  A: 

You can set the form's Cursor property to Cursors.WaitCursor upon starting the long running action, and reset it to Cursors.Default upon finish. While your action executes you can call Application.DoEvents() but it may cause side effects if other events trigger in the mean time.

devnull
then im gonna have to go through the whole application and write that code before all these tons of methods and change it back after all these tons of methods , i guess my question is not applicable then
Stacker
@Stacker - what i gave you is a quick and very dirty fix to address your problem. the solution proposed by @saurabh is more elegant and less error prone. even if it envolves rewrites, it's a small price to pay for a better responsive app.
devnull