Click here to Skip to main content
15,393,638 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I recently created an app that retrieves the CPU, System and GPU information. Retrieving this information takes a lot of time and makes the program seem like it is non-responsive. I have used a DevExpress trial that allowed me to add a WaitForm using the SplashScreenManager. This worked great because while the data is being received a loading panel would show telling the user to wait. I really liked this whole animated design and fell in love with the professional look it gave my program. However, my trial expired and I do not have the neccessary funds to buy a license from DevExpress.

Now I am wondering. Is there any way to make my own WaitForm and SplashScreens? Is the only way to use WorkerThreads? And can it still have the professional Look and Feel like DevExpress WaitForms?

Thanks in advance,
Updated 5-Dec-12 3:21am
Mendor81 5-Dec-12 6:14am
Have a look into multithreading and background workers combined with some progressbars should do the trick

Get yourself a copy of one of the free Visual Studio Express IDEs[^] and use one of the samples from MSDN or CodeProject to build your product.
A splash screen (or, something that does what the DevExpress WaitForm does) is simply a form that is displayed while your app does something, and that is later hidden when the app is ready to move on.

So - you can create your own form, that contains the images, text, etc., that you want on your splash screen. That form might use a timer that ticks every 1/10th of a second, say, if you want to have an animation (which you'll have to create, or you might build an animated GIF). The interesting part is how to display the form, then replace it with 'the main form' of the application.

I trust that you're at least minimally familiar with the Application object. (In Visual Studio, create a new WinForms project and open the Program.cs file). Application.Run() is where the action starts: typically (as in Program.cs) it takes an instance of a Form. You should read the MSDN documentation for the Application object, because it can do more sophisticated things.

But you may not need to. You might be able to do something like this:
static class Program
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    static void Main()
        Application.Run(new SplashScreen());
        Application.Run(new MainApplicationForm());

Clearly, while the SplashScreen form is visible, the application must do some important things, namely:
(a) Get the CPU, GPU, etc. information into some public static storage, for later use by the application
(b) Close the splash screen when that data has been retrieved.
(c) Wait before starting the main application behaviour until that work is done. (The example above accomplishes this because the second Run() method won't be invoked until the first has exited). There are almost certainly more graceful approaches than invoking Run() twice, but it works.

There are many ways of doing this; one would be to create a worker thread (pay attention to Form.Invoke - inherited from Control - to take action on a form from some thread other than the one it was created on); another would be to have the splash screen do that work, and close itself when done.

Note - if you haven't come across the topic before, understanding the difference between Modal and Modeless forms would be useful here; also, read about the differences between Form.Show() and Form.ShowDialog().

Hope that helps!
(Hmm: No funds to buy DevExpress == learning opportunity! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900