Click here to Skip to main content
15,796,738 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, i have a problem with showing splash screen while loading.
public static void Main(string[] args)
private static void CallMainForm(string[] args = null)
    SplashScreen splash = new SplashScreen();
	//loading and other stuff
	MainWindow mainWindow = new MainWindow(args);
	while (mainWindow.CanExit == false)

public static void DoEvents()
    if (Application.Current != null)
        Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { }));

There is CanClose property, that determines, if splash screen can be closed and also prevents alt+f4 click on splash screen window:
splash screen:
public void RequestClose()
    this.CanClose = true;
public bool CanClose { get; set; }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    if (!CanClose)
        e.Cancel = true;

and in constructor of splash screen i launch label color changing animation:
public SplashScreen()
    CanClose = false;

when i launch application, the animation of splash screen not working and splash window freezes.
any ideas how to fix this?
Sergey Alexandrovich Kryukov 21-Mar-15 22:41pm    
It cannot be fixed, the whole idea is so-oooo wrong. First of all, why do you think that you really can do something useful during your animation? Let's say, you can see that it takes so much time to initialize you main window before you can show it. But can you expect that the time delay before the user can see the animation will be considerably shorter? I'm not saying that flash screens are totally useless, I'm just trying to give an idea on what to start with...

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