示例#1
0
 public void HideSplashScreen()
 {
     if (SplashScreen != null)
     {
         SplashScreen.Dispatcher.BeginInvoke(new Action(() =>
         {
             SplashScreen.Close();
             splashScreen = null;
         }));
     }
 }
示例#2
0
        public void ShowSplashScreen()
        {
            if (SplashScreen == null)
            {
                Thread thread = new Thread(() =>
                {
                    Helper.EnsureThreadLocalized();
                    splashScreen         = new SplashWindow1();
                    SplashScreen.Closed += (sender2, e2) => SplashScreen.Dispatcher.InvokeShutdown();
                    if (!string.IsNullOrEmpty(message))
                    {
                        SplashScreen.Loaded += (sender2, e2) => SplashScreen.SetStatus(message);
                    }
                    SplashScreen.Show();
                    SplashScreen.Activate();
                    System.Windows.Threading.Dispatcher.Run();
                });

                thread.SetApartmentState(ApartmentState.STA);
                thread.IsBackground = false;
                thread.Start();
            }
        }