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