1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| private void SplashLoaded(object sender, RoutedEventArgs e)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(delegate(Object state)
{
LongOperationExecution();
}), null);
}
private void LongOperationExecution()
{
// Here, put the code which take a long time to execute
// BEGIN
int i = 0;
while (i < 50000)
{
i++;
}
// END
this.Dispatcher.BeginInvoke(DispatcherPriority.Send, new DispatcherOperationCallback(delegate(Object state)
{
// code pour une windows
//this.Hide();
//MainWindow window = new MainWindow();
//window.Show();
// mettre le code pour afficher le userControl à la place de visualiser le splashScreen
return null;
}), null);
} |
Partager