0

I am using a very component heavy form that takes long time to set up. Part of the set up is behaviour of third party controls, that I cannot gather progress on. (DevExpress XtraScheduler). This freezes the app.

What properties on the form do I need to set up so the forms loads in the background and what events should I contentrate on ?

EDIT:

I am aware of the BackgroundWorker, but If I push the creation of the form on the BW, how will I know when the process is done ? I mean, can I somehow let the form prepare itself (remember I am not in control of what the components are doing) and notify the BW that its done preparing ? What event would that be ?

2 Answers 2

1

If it is the initial load of your application that takes time, you could consider adding a splash screen. If it is a secondary form, then the BackgroundWorker class is an excellent component allowing you to perform time consuming tasks on background threads without freezing your main GUI thread. The DoWork, ProgressChanged and RunWorkerCompleted events are particularly useful.

Sign up to request clarification or add additional context in comments.

2 Comments

I clarified my question a bit. I need to know what events to ties BW to. Nice job with the links.
The RunWorkerCompleted event will be executed when the work is done. You mention that you are not in control of what the controls are doing but at some moment you are calling some function that takes time. It is this function you need to execute inside the DoWork handler.
1

The VB.NET splash screen is perfect for just this. If you're working in C# you can import Microsoft.VisualBasic to get access to the same effect. Your main form loads in the background and the splash screen runs smoothly in the foreground for the duration.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.