Ejemplo 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();
        }
Ejemplo n.º 2
0
 private bool InvokeBeforeStart()
 {
     if (_beforeStart == null)
     {
         return(true);
     }
     return(Try(() => _invoker.InvokeOnUIThreadSync(_ => _beforeStart())));
 }
Ejemplo 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();
        }