Ejemplo n.º 1
0
        public UpdateHelper(Updater updater, Version currentVersion)
        {
            _updater        = updater;
            _currentVersion = currentVersion;

            _updatesButtonClickAction = CheckForUpdatesAsync;
        }
Ejemplo n.º 2
0
        public UpdateHelper(Updater updater, Version currentVersion)
        {
            _updater = updater;
            _currentVersion = currentVersion;

            _updatesButtonClickAction = CheckForUpdatesAsync;
        }
Ejemplo n.º 3
0
        private void CheckForUpdatesAsync()
        {
            // Prevent user from checking for updates while another check is already in progress
            _updatesButtonClickAction = null;

            var task =
                new TaskBuilder()
                .OnCurrentThread()
                .BeforeStart(OnBeforeStart)
                .DoWork(OnDoWork)
                .Fail(OnFail)
                .Succeed(OnSucceed)
                .Build();

            task.Start();
        }
Ejemplo n.º 4
0
 private void OnSucceed()
 {
     if (_updater.IsUpdateAvailable)
     {
         if (AllowDownload && AllowInstallUpdate)
         {
             _updatesButtonClickAction = InstallUpdateIfAvailable;
             Logger.Info("Update is ready to install");
             Notify(observer => observer.OnUpdateReadyToInstall(_updater.LatestUpdate));
         }
         else
         {
             _updatesButtonClickAction = LaunchBrowser;
             Logger.Info("Update is available");
             Notify(observer => observer.OnUpdateReadyToDownload(_updater.LatestUpdate));
         }
     }
     else
     {
         _updatesButtonClickAction = CheckForUpdatesAsync;
         Logger.Info(string.Format("Application is already up to date"));
         Notify(observer => observer.OnNoUpdateAvailable());
     }
 }
Ejemplo n.º 5
0
        private void CheckForUpdatesAsync()
        {
            // Prevent user from checking for updates while another check is already in progress
            _updatesButtonClickAction = null;

            var task =
                new TaskBuilder()
                    .OnCurrentThread()
                    .BeforeStart(OnBeforeStart)
                    .DoWork(OnDoWork)
                    .Fail(OnFail)
                    .Succeed(OnSucceed)
                    .Build();

            task.Start();
        }
Ejemplo n.º 6
0
 private void OnSucceed()
 {
     if (_updater.IsUpdateAvailable)
     {
         if (AllowDownload && AllowInstallUpdate)
         {
             _updatesButtonClickAction = InstallUpdateIfAvailable;
             Logger.Info("Update is ready to install");
             Notify(observer => observer.OnUpdateReadyToInstall(_updater.LatestUpdate));
         }
         else
         {
             _updatesButtonClickAction = LaunchBrowser;
             Logger.Info("Update is available");
             Notify(observer => observer.OnUpdateReadyToDownload(_updater.LatestUpdate));
         }
     }
     else
     {
         _updatesButtonClickAction = CheckForUpdatesAsync;
         Logger.Info(string.Format("Application is already up to date"));
         Notify(observer => observer.OnNoUpdateAvailable());
     }
 }
Ejemplo n.º 7
0
 private void OnFail(ExceptionEventArgs args)
 {
     _updatesButtonClickAction = CheckForUpdatesAsync;
     Logger.Error("Error checking for update", args.Exception);
     Notify(observer => observer.OnUpdateException(args.Exception));
 }
Ejemplo n.º 8
0
 private void OnFail(ExceptionEventArgs args)
 {
     _updatesButtonClickAction = CheckForUpdatesAsync;
     Logger.Error("Error checking for update", args.Exception);
     Notify(observer => observer.OnUpdateException(args.Exception));
 }