Ejemplo n.º 1
0
 public void PerformUpdate()
 {
     AppUpdater.ApplyUpdates(new AppSettings().GetString("UpdateManagerUrl")).ContinueWith(t =>
     {
         formMain.InvokeOnUiThreadIfRequired(() =>
         {
             formMain.Close();
         });
         UpdateManager.RestartApp();
     });
 }
Ejemplo n.º 2
0
        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
            }
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public static void OnAppUninstall(Version version)
 {
     // Hook for application uninstall
     AppUpdater.RemoveShortcutForThisExe();
 }
Ejemplo n.º 5
0
 public static void OnAppUpdate(Version version)
 {
     // Hook for application update, CheckForUpdates() initiates this.
     AppUpdater.CreateShortcutForThisExe();
 }
Ejemplo n.º 6
0
 public static void OnInitialInstall(Version version)
 {
     // Hook for first install
     AppUpdater.CreateShortcutForThisExe();
 }