public void PerformUpdate() { AppUpdater.ApplyUpdates(new AppSettings().GetString("UpdateManagerUrl")).ContinueWith(t => { formMain.InvokeOnUiThreadIfRequired(() => { formMain.Close(); }); UpdateManager.RestartApp(); }); }
public void Ready() { //Invoke on DOM ready var appSettings = new AppSettings(); var checkForUpdates = appSettings.Get <bool>("EnableAutoUpdate"); if (!checkForUpdates) { return; } var releaseFolderUrl = appSettings.GetString("UpdateManagerUrl"); try { var updatesAvailableTask = AppUpdater.CheckForUpdates(releaseFolderUrl); updatesAvailableTask.ContinueWith(isAvailable => { isAvailable.Wait(TimeSpan.FromMinutes(1)); bool updatesAvailable = isAvailable.Result; //Only check once one launch then release UpdateManager. if (!updatesAvailable) { AppUpdater.Dispose(); return; } if (formMain == null) { return; } // Notify web client updates are available. formMain.InvokeOnUiThreadIfRequired(() => { formMain.ChromiumBrowser.GetMainFrame().ExecuteJavaScriptAsync("window.updateAvailable();"); }); }); } catch (Exception e) { // Error reaching update server } }
static void Main() { AppHost = new AppHost(); SquirrelAwareApp.HandleEvents( OnInitialInstall, OnAppUpdate, onAppUninstall: OnAppUninstall, onFirstRun: OnFirstRun); Cef.EnableHighDPISupport(); Cef.Initialize(new CefSettings()); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); AppHost.Init().Start("http://*:2337/"); "ServiceStack SelfHost listening at {0} ".Fmt(HostUrl).Print(); Form = new FormMain(); Form.Disposed += (sender, args) => AppUpdater.Dispose(); Application.Run(Form); }
public static void OnAppUninstall(Version version) { // Hook for application uninstall AppUpdater.RemoveShortcutForThisExe(); }
public static void OnAppUpdate(Version version) { // Hook for application update, CheckForUpdates() initiates this. AppUpdater.CreateShortcutForThisExe(); }
public static void OnInitialInstall(Version version) { // Hook for first install AppUpdater.CreateShortcutForThisExe(); }