/// <summary> /// Download Progress Action /// </summary> /// <param name="info"> /// The info. /// </param> private void DownloadProgress(DownloadStatus info) { if (info.TotalBytes == 0 || info.BytesRead == 0) { return; } long p = (info.BytesRead * 100) / info.TotalBytes; int progress; int.TryParse(p.ToString(CultureInfo.InvariantCulture), out progress); this.DownloadProgressPercentage = progress; this.UpdateMessage = string.Format( "Downloading... {0}% - {1}k of {2}k", this.DownloadProgressPercentage, (info.BytesRead / 1024), (info.TotalBytes / 1024)); }
/// <summary> /// Download Complete Action /// </summary> /// <param name="info"> /// The info. /// </param> private void DownloadComplete(DownloadStatus info) { this.UpdateAvailable = false; this.UpdateMessage = info.WasSuccessful ? "Update Downloaded" : "Update Failed. You can try downloading the update from http://handbrake.fr"; Process.Start(Path.Combine(Path.GetTempPath(), "handbrake-setup.exe")); Execute.OnUIThread(() => Application.Current.Shutdown()); }
/// <summary> /// Download Complete Action /// </summary> /// <param name="info"> /// The info. /// </param> private void DownloadComplete(DownloadStatus info) { this.UpdateAvailable = false; this.UpdateMessage = info.WasSuccessful ? Resources.OptionsViewModel_UpdateDownloaded : Resources.OptionsViewModel_UpdateFailed; Process.Start(Path.Combine(Path.GetTempPath(), "handbrake-setup.exe")); Execute.OnUIThread(() => Application.Current.Shutdown()); }
/// <summary> /// Download Progress Action /// </summary> /// <param name="info"> /// The info. /// </param> private void DownloadProgress(DownloadStatus info) { if (info.TotalBytes == 0 || info.BytesRead == 0) { this.UpdateAvailable = false; this.UpdateMessage = info.WasSuccessful ? Resources.OptionsViewModel_UpdateDownloaded : Resources.OptionsViewModel_UpdateServiceUnavailable; return; } long p = (info.BytesRead * 100) / info.TotalBytes; int progress; int.TryParse(p.ToString(CultureInfo.InvariantCulture), out progress); this.DownloadProgressPercentage = progress; this.UpdateMessage = string.Format( "Downloading... {0}% - {1}k of {2}k", this.DownloadProgressPercentage, (info.BytesRead / 1024), (info.TotalBytes / 1024)); }
/// <summary> /// Download Progress Action /// </summary> /// <param name="info"> /// The info. /// </param> private void DownloadProgress(DownloadStatus info) { if (info.TotalBytes == 0 || info.BytesRead == 0) { this.UpdateAvailable = false; this.UpdateMessage = info.WasSuccessful ? "Update Downloaded" : "Update Service Unavailable. You can try downloading the update from https://handbrake.fr"; return; } long p = (info.BytesRead * 100) / info.TotalBytes; int progress; int.TryParse(p.ToString(CultureInfo.InvariantCulture), out progress); this.DownloadProgressPercentage = progress; this.UpdateMessage = string.Format( "Downloading... {0}% - {1}k of {2}k", this.DownloadProgressPercentage, (info.BytesRead / 1024), (info.TotalBytes / 1024)); }