Example #1
0
        public void ShowSplash(SplashInfo splashInfo)
        {
            if (splash != null)
            {
                splash.DataContext = new SplashViewModel(splashInfo);
            }
            else
            {
                Application.Current.Activated   += AppActivated;
                Application.Current.Deactivated += AppDeactivated;

                Window active = AllWindows.FirstOrDefault(w => w.IsActive);
                restoreActiveWindow = active != null;


                foreach (Window window in AllWindows)
                {
                    window.IsEnabled = false;
                }

                splash             = new SplashView();
                splash.DataContext = new SplashViewModel(splashInfo);
                splash.Owner       = active ?? this.MainWindow;

                splash.Show();
                timer.Start();
            }
        }
Example #2
0
        public void HideSplash()
        {
            if (splash != null)
            {
                Application.Current.Activated   -= AppActivated;
                Application.Current.Deactivated -= AppDeactivated;

                timer.Stop();
                splash.Close();

                if (restoreActiveWindow)
                {
                    splash.Owner?.Activate();
                }

                splash.DataContext = null;
                splash             = null;

                foreach (Window window in AllWindows)
                {
                    window.IsEnabled = true;
                }
            }
        }