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(); }
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(); }
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(); }
private static void AppShutDown(AppLib.Common.SingleInstanceApp singleInstance) { singleInstance.Close(); _settings.Save(); _log.Info("Application shutdown"); _log.WriteToFile(); WinSparkle.win_sparkle_cleanup(); }
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(); }
protected override void DisposeOfUnManagedResources() { try { WinSparkle.win_sparkle_cleanup(); } catch (Exception e) { _logger.LogError($"Failed to clean up WinSparkle: {e.Message}"); } }
public void CheckForUpdates() { try { WinSparkle.win_sparkle_check_update_with_ui(); } catch (Exception e) { _logger.LogError($"Failed to check for updates: {e.Message}"); } }
protected override void customClosing() { if (Startup.IsShuttingDown && Screen.Primary) { WinSparkle.win_sparkle_cleanup(); } if (WindowManager.Instance.IsSettingDisplays || Startup.IsShuttingDown) { closeShadow(); } }
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(); } }
/// <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); }
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}"); } }
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; } }
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)); }
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()); }