Splash screen

May 8, 2013 at 2:56 AM

I tried to create a custom splash screen that displays the loading process (e.g. plugins, connecting to server etc.).

So, I have WPF window that contains a progress bar and labels, that show those information. I override the OnStartup method in App.xaml.cs like that:
    protected override void OnStartup(StartupEventArgs e)
      var splashScreen = new myNamespace.Forms.SplashScreen();

      var startupTask = new Task(() =>
        //Load plugins, connect etc.

      startupTask.ContinueWith(p =>
        MainWindow mainWindow = new MainWindow();

        //when main windows is loaded close splash screen
        mainWindow.Loaded += (sender, args) => splashScreen.Close();

        //set application main window;
        this.MainWindow = mainWindow;

        //and finally show it
      }, TaskScheduler.FromCurrentSynchronizationContext());


The problem is the splashScreen is never closing and applying the ModernUI style.

Is it any solution how to show a dynamic splashScreen?
May 8, 2013 at 1:35 PM

I suggest you looking on solution below using native code since in WPF application has significant startup costs, especially in a cold start situation.

Displaying a Splash Screen for WPF with C++.
And Stefan Olson posted a Visual C++ project containing all the code in this series (with a few extra features, including fading out the splash screen and the ability to load from any file, not just application resources).

I use this solution to my apps, it's faster then everything and works like a charm.

Kind regards,

Gabriel Marquez
May 9, 2013 at 2:20 AM
Thank you Gabriel! I'll definitely have a look closer to the solution.