public async Task Execute() { if (!_updateHelper.IsTimeForNextUpdate()) { return; } var onlineVersion = await _onlineVersionHelper.LoadOnlineVersionAsync(); if (!_updateHelper.UpdateShouldBeShown()) { return; } if (onlineVersion == null) { _logger.Error("OnlineVersion not available"); return; } var thisVersion = _versionHelper.ApplicationVersion; if (thisVersion.CompareTo(onlineVersion.Version) < 0) { await _updateDownloader.StartDownloadAsync(onlineVersion); } }
private bool TryLaunchUpdate(IApplicationVersion version, string caption, string filePath) { try { var interaction = new UpdateDownloadInteraction(async() => await _updateDownloader.StartDownloadAsync(version)); _interactionInvoker.Invoke(interaction); if (interaction.Success) { // Hash test if (!_hashUtil.VerifyFileMd5(filePath, version.FileHash)) { //Hash does not fit should we retry download var message = _translation.DownloadHashErrorMessage; var res = ShowMessage(message, caption, MessageOptions.YesNo, MessageIcon.Warning); if (res == MessageResponse.Yes) // Yes please retry download: Download was not successful { return(false); } } } } catch (Exception) { var message = _translation.DownloadErrorMessage; var res = ShowMessage(message, caption, MessageOptions.YesNo, MessageIcon.PDFCreator); if (res == MessageResponse.Yes) { Process.Start(version.DownloadUrl); } } return(true); // Download was successful }