Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
220
ultraActivityIndicator doesn't refresh
posted

Good morning. I have a process that takes a long time to finish, so that the user does not think it's frozen I put a ultraActivityIndicator type control.

The idea is: I active the animation control, run the process and when the process has finished then I stop the animation.

Everything is fine, but when I launch the process, the animation stops. I suppose that it has something to do with the fact that the process consumes all the processing time and do not let the control refresh.  My process is an external procedure call, so I can't do "Application.DoEvents", "ultraActivityIndicator.Refresh" or something like that during the execution.

Is there any solution to this?

Thanks.

Parents
  • 48586
    Verified Answer
    posted

    Hello ,

     

    The scenario that you describe is caused by fact that the UltraActivityIndicator works in the main thread of the application, and when your process is running in the main thread it occupied all resource of this thread  and you get this behavior. The solution for this to make you calculations in BackgroundWorker, for more information please look at the following link:

    http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker%28v=vs.95%29.aspx

     

    I also have created a very based sample that illustrates my suggestion. Run the sample and press “Work in main thread” and you will get your behavior. Press “Work in background” and the indicator won’t freeze. Both buttons call Thread.Sleep(5000); to simulate work, but “Work in main thread” simulates work in main thread and “Work in background” simulates work in background.

     

    I hope this help.

    WinAtivityIndicator.zip
Reply Children
No Data