/* UpdateInfo.cs $ This file is part of the HandBrake source code. Homepage: . It may be used under the terms of the GNU General Public License. */ namespace Handbrake.ToolWindows { using System; using System.Windows.Forms; using HandBrake.ApplicationServices.Model.General; /// /// A window to display update information. /// public partial class UpdateInfo : Form { /// /// An instance of the Appcast Reader /// private readonly UpdateCheckInformation appcast; /// /// The Current Version /// private readonly string currentVersion; /// /// The Current Build /// private readonly string currentBuild; /// /// Initializes a new instance of the class. /// /// /// The appcast reader. /// /// /// The current Version. /// /// /// The current Build. /// public UpdateInfo(UpdateCheckInformation reader, string currentVersion, string currentBuild) { InitializeComponent(); appcast = reader; this.currentVersion = currentVersion; this.currentBuild = currentBuild; GetRss(); SetVersions(); } /// /// Gets the SkipVersion number /// public int SkipVersion { get; private set; } /// /// Get the RSS feed /// private void GetRss() { wBrowser.Url = appcast.DescriptionUrl; } /// /// Set the versions /// private void SetVersions() { string old = string.Format("(You have: {0} / {1})", this.currentVersion, this.currentBuild); string newBuild = appcast.Version.Trim() + " (" + appcast.Build + ")"; lbl_update_text.Text = string.Format("HandBrake {0} is now available. {1}", newBuild, old); } /// /// Handle the Install Update button click event. /// /// /// The sender. /// /// /// The EventArgs. /// private void BtnInstallUpdateClick(object sender, EventArgs e) { DownloadUpdate download = new DownloadUpdate(appcast.DownloadFile); download.ShowDialog(); this.DialogResult = DialogResult.OK; } /// /// Handle the Remind Later button click event /// /// /// The sender. /// /// /// The EventArgs. /// private void BtnRemindLaterClick(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; } /// /// Handle the Skip update button click event /// /// /// The sender. /// /// /// The e. /// private void BtnSkipClick(object sender, EventArgs e) { this.SkipVersion = int.Parse(appcast.Build); this.DialogResult = DialogResult.OK; } } }