Esempio n. 1
0
        private void OnDoWork(IThreadInvoker invoker, CancellationToken token)
        {
            _updater.CheckForUpdate(_currentVersion);

            if (!_updater.IsUpdateAvailable)
            {
                return;
            }

            invoker.InvokeOnUIThreadSync(OnUpdateReadyToDownload);

            if (!AllowDownload)
            {
                return;
            }

            invoker.InvokeOnUIThreadSync(OnBeforeDownload);

            _updater.DownloadProgressChanged += delegate(FileDownloadProgress progress)
            {
                invoker.InvokeOnUIThreadSync(cancellationToken => ProgressChanged(progress));
            };

            token.Register(_updater.CancelDownload);

            _updater.DownloadUpdate();
        }
Esempio n. 2
0
 private bool InvokeBeforeStart()
 {
     if (_beforeStart == null)
     {
         return(true);
     }
     return(Try(() => _invoker.InvokeOnUIThreadSync(_ => _beforeStart())));
 }
Esempio n. 3
0
        private void OnDoWork(IThreadInvoker invoker, CancellationToken token)
        {
            _updater.CheckForUpdate(_currentVersion);

            if (!_updater.IsUpdateAvailable)
                return;

            invoker.InvokeOnUIThreadSync(OnUpdateReadyToDownload);

            if (!AllowDownload)
                return;

            invoker.InvokeOnUIThreadSync(OnBeforeDownload);

            _updater.DownloadProgressChanged += delegate(FileDownloadProgress progress)
                {
                    invoker.InvokeOnUIThreadSync(cancellationToken => ProgressChanged(progress));
                };

            token.Register(_updater.CancelDownload);

            _updater.DownloadUpdate();
        }