Hi, In my WPF project I have a splash screen that I want to stay 10 seconds before the main window. In the splash screen I have two buttons one for exiting and another for continuing. My intention is to give the user an option to continue to the main window before 10 seconds is passed. However, the splash screen freezes out for whole 10 seconds and won't let the user click the continue button. How can I prevent that?
public partial class SplashScreen : Window { public SplashScreen() { InitializeComponent(); this.Show(); Sleep(10000); } private void Sleep(int delay) { Thread.Sleep(delay); btnContinue_Click(null, null); } private void btnExit_Click(object sender, RoutedEventArgs e) { Application.Current.Shutdown(); } private void btnContinue_Click(object sender, RoutedEventArgs e) { MainWindow mainw = new MainWindow(); mainw.Show(); Close(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)