Example #1
0
        private void OnApplicationShutdown(object sender, ExitEventArgs e)
        {
            if (m_filteringEngine != null && m_filteringEngine.IsRunning)
            {
                m_filteringEngine.Stop();
            }

            try
            {
                SaveProgramState();
            }
            catch (Exception err)
            {
                m_logger.Error("Error while saving program state: {0}.", err.Message);
            }

            // Dispose all models that implement IDisposable.
            if (m_modelDashboard != null)
            {
                m_modelDashboard.Dispose();
            }

            if (m_modelSettings != null)
            {
                m_modelSettings.Dispose();
            }

            WinSparkle.Cleanup();
        }
Example #2
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 #3
0
        private void OnWindowClosing(object sender, CancelEventArgs e)
        {
            IsClosing = true;

            if (Startup.IsShuttingDown && Screen.Primary)
            {
                NotificationArea.Instance.Dispose();

                AppBarHelper.RegisterBar(this, Screen, this.ActualWidth * dpiScale, this.ActualHeight * dpiScale);

                WinSparkle.win_sparkle_cleanup();

                if (Startup.IsCairoUserShell)
                {
                    AppBarHelper.ResetWorkArea();
                }
            }
            else if (Startup.IsSettingScreens || Startup.IsShuttingDown)
            {
                AppBarHelper.RegisterBar(this, Screen, this.ActualWidth, this.ActualHeight);
            }
            else
            {
                IsClosing = false;
                e.Cancel  = true;
            }

            _listener.UnHookKeyboard();
        }
Example #4
0
 private static void AppShutDown(AppLib.Common.SingleInstanceApp singleInstance)
 {
     singleInstance.Close();
     _settings.Save();
     _log.Info("Application shutdown");
     _log.WriteToFile();
     WinSparkle.win_sparkle_cleanup();
 }
Example #5
0
 private void initSparkle()
 {
     WinSparkle.win_sparkle_set_appcast_url("https://cairoshell.github.io/appdescriptor.rss");
     canShutdownDelegate = canShutdown;
     shutdownDelegate    = shutdown;
     WinSparkle.win_sparkle_set_can_shutdown_callback(canShutdownDelegate);
     WinSparkle.win_sparkle_set_shutdown_request_callback(shutdownDelegate);
     WinSparkle.win_sparkle_init();
 }
 /// <summary>
 /// Clean up any resources being used.
 /// </summary>
 /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing && (components != null))
     {
         components.Dispose();
     }
     base.Dispose(disposing);
     WinSparkle.win_sparkle_cleanup();
 }
Example #7
0
 protected override void DisposeOfUnManagedResources()
 {
     try
     {
         WinSparkle.win_sparkle_cleanup();
     }
     catch (Exception e)
     {
         _logger.LogError($"Failed to clean up WinSparkle: {e.Message}");
     }
 }
Example #8
0
 public void CheckForUpdates()
 {
     try
     {
         WinSparkle.win_sparkle_check_update_with_ui();
     }
     catch (Exception e)
     {
         _logger.LogError($"Failed to check for updates: {e.Message}");
     }
 }
Example #9
0
        protected override void customClosing()
        {
            if (Startup.IsShuttingDown && Screen.Primary)
            {
                WinSparkle.win_sparkle_cleanup();
            }

            if (WindowManager.Instance.IsSettingDisplays || Startup.IsShuttingDown)
            {
                closeShadow();
            }
        }
Example #10
0
        private void OnWindowClosing(object sender, CancelEventArgs e)
        {
            SysTray.DestroySystemTray();

            AppBarHelper.RegisterBar(this, this.ActualWidth, this.ActualHeight);

            WinSparkle.win_sparkle_cleanup();

            if (Startup.IsCairoUserShell)
            {
                AppBarHelper.ResetWorkArea();
            }
        }
Example #11
0
        /// <summary>
        /// Inits all the callbacks for WinSparkle, so that when we call for update checks and such,
        /// it has all appropriate callbacks to request app shutdown, restart, etc, to allow for
        /// updating.
        /// </summary>
        private void InitWinsparkle()
        {
            m_winsparkleShutdownCheckCb   = new WinSparkle.WinSparkleCanShutdownCheckCallback(WinSparkleCheckIfShutdownOkay);
            m_winsparkleShutdownRequestCb = new WinSparkle.WinSparkleRequestShutdownCallback(WinSparkleRequestsShutdown);

            if (Environment.Is64BitProcess)
            {
                AppcastUrl = System.Configuration.ConfigurationManager.AppSettings["Updatex64AppcastURL"];
            }
            else
            {
                AppcastUrl = System.Configuration.ConfigurationManager.AppSettings["Updatex86AppcastURL"];
            }

            WinSparkle.SetCanShutdownCallback(m_winsparkleShutdownCheckCb);
            WinSparkle.SetShutdownRequestCallback(m_winsparkleShutdownRequestCb);
            WinSparkle.SetAppcastUrl(AppcastUrl);
        }
Example #12
0
        public WinSparkleApplicationUpdateService(ILogger <WinSparkleApplicationUpdateService> logger, ICairoApplication app)
        {
            _logger = logger;
            _app    = app;

            try
            {
                WinSparkle.win_sparkle_set_appcast_url(UpdateUrl);

                _canShutdownDelegate = canShutdown;
                _shutdownDelegate    = doShutdown;

                WinSparkle.win_sparkle_set_can_shutdown_callback(_canShutdownDelegate);
                WinSparkle.win_sparkle_set_shutdown_request_callback(_shutdownDelegate);
                WinSparkle.win_sparkle_init();
            }
            catch (Exception e)
            {
                _logger.LogError($"Failed to initialize WinSparkle: {e.Message}");
            }
        }
Example #13
0
        private void OnWindowClosing(object sender, CancelEventArgs e)
        {
            IsClosing = true;

            if (Startup.IsShuttingDown && Screen.Primary)
            {
                NotificationArea.Instance.Dispose();

                AppBarHelper.RegisterBar(this, Screen, this.ActualWidth * dpiScale, this.ActualHeight * dpiScale);

                WinSparkle.win_sparkle_cleanup();

                // Currently Unused
                if (keyboardListener != null)
                {
                    keyboardListener.UnHookKeyboard();
                }

                if (Startup.IsCairoRunningAsShell)
                {
                    AppBarHelper.ResetWorkArea();
                }

                FullScreenHelper.Instance.FullScreenApps.CollectionChanged -= FullScreenApps_CollectionChanged;
                FullScreenHelper.Instance.Dispose();

                Microsoft.Win32.SystemEvents.TimeChanged -= new EventHandler(TimeChanged);
            }
            else if (Startup.IsSettingScreens || Startup.IsShuttingDown)
            {
                AppBarHelper.RegisterBar(this, Screen, this.ActualWidth * dpiScale, this.ActualHeight * dpiScale);

                FullScreenHelper.Instance.FullScreenApps.CollectionChanged -= FullScreenApps_CollectionChanged;
            }
            else
            {
                IsClosing = false;
                e.Cancel  = true;
            }
        }
Example #14
0
 private void CheckForUpdates(object sender, RoutedEventArgs e)
 {
     WinSparkle.win_sparkle_check_update_with_ui();
 }
 private void EnableAutoUpdates_Click(object sender, RoutedEventArgs e)
 {
     WinSparkle.win_sparkle_set_automatic_check_for_updates(Convert.ToInt32(chkEnableAutoUpdates.IsChecked));
 }
Example #16
0
 private static void SetupAutoUpdater()
 {
     WinSparkle.SetDllDirectory(Paths.Resolve(Paths.NativeDllPath));
     WinSparkle.win_sparkle_set_appcast_url(AppConstants.AutoUpdateURL);
     WinSparkle.win_sparkle_init();
 }
 private void checkUpdateConfig()
 {
     chkEnableAutoUpdates.IsChecked = Convert.ToBoolean(WinSparkle.win_sparkle_get_automatic_check_for_updates());
 }