Interaction logic for Splash.xaml
Inheritance: System.Windows.Window
Example #1
0
        private void OnBackgroundInitComplete(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Cancelled || e.Error != null)
            {
                m_logger.Error("Error during initialization.");
                if (e.Error != null && m_logger != null)
                {
                    m_logger.Error(e.Error.Message);
                    m_logger.Error(e.Error.StackTrace);
                }

                Current.Shutdown(-1);
                return;
            }

            Current.Dispatcher.BeginInvoke(
                System.Windows.Threading.DispatcherPriority.Normal,
                (Action)delegate ()
                {
                    Exit += OnApplicationShutdown;

                    // Must be done or our single instance enforcement is going to bug out.
                    // https://github.com/TechnikEmpire/StahpIt-WPF/issues/2
                    m_splashScreen.Close();
                    m_splashScreen = null;
                    //

                    m_primaryWindow.Show();
                    OnViewChangeRequest(this, new ViewChangeRequestArgs(View.Dashboard));
                }
            );

            // Check for updates, always.
            WinSparkle.CheckUpdateWithoutUI();
        }
Example #2
0
        /// <summary>
        /// Entry point for the application.
        /// </summary>
        /// <param name="e">
        /// Arguments passed to the executable at launch.
        /// </param>
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            m_filteringCategoriesObservable = new ObservableCollection<CategorizedFilteredRequestsViewModel>();

            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            m_splashScreen = new Splash();
            m_splashScreen.Show();

            m_backgroundInitWorker = new BackgroundWorker();
            m_backgroundInitWorker.DoWork += DoBackgroundInit;
            m_backgroundInitWorker.RunWorkerCompleted += OnBackgroundInitComplete;

            m_backgroundInitWorker.RunWorkerAsync(e);
        }