OSDN Git Service

import original 0.9.5 release
[handbrake-jp/handbrake-jp.git] / win / C# / HandBrake.Framework / Views / UpdateInfo.cs
diff --git a/win/C#/HandBrake.Framework/Views/UpdateInfo.cs b/win/C#/HandBrake.Framework/Views/UpdateInfo.cs
new file mode 100644 (file)
index 0000000..906f117
--- /dev/null
@@ -0,0 +1,125 @@
+/*  UpdateInfo.cs $\r
+    This file is part of the HandBrake source code.\r
+    Homepage: <http://handbrake.fr>.\r
+    It may be used under the terms of the GNU General Public License. */\r
+\r
+namespace HandBrake.Framework.Views\r
+{\r
+    using System;\r
+    using System.Windows.Forms;\r
+\r
+    using HandBrake.Framework.Services.Interfaces;\r
+\r
+    /// <summary>\r
+    /// A window to display update information.\r
+    /// </summary>\r
+    public partial class UpdateInfo : Form\r
+    {\r
+        /// <summary>\r
+        /// An instance of the Appcast Reader\r
+        /// </summary>\r
+        private readonly IAppcastReader appcast;\r
+\r
+        /// <summary>\r
+        /// The Current Version\r
+        /// </summary>\r
+        private readonly string currentVersion;\r
+\r
+        /// <summary>\r
+        /// The Current Build\r
+        /// </summary>\r
+        private readonly string currentBuild;\r
+\r
+        /// <summary>\r
+        /// Initializes a new instance of the <see cref="UpdateInfo"/> class.\r
+        /// </summary>\r
+        /// <param name="reader">\r
+        /// The appcast reader.\r
+        /// </param>\r
+        /// <param name="currentVersion">\r
+        /// The current Version.\r
+        /// </param>\r
+        /// <param name="currentBuild">\r
+        /// The current Build.\r
+        /// </param>\r
+        public UpdateInfo(IAppcastReader reader, string currentVersion, string currentBuild)\r
+        {\r
+            InitializeComponent();\r
+\r
+            appcast = reader;\r
+            this.currentVersion = currentVersion;\r
+            this.currentBuild = currentBuild;\r
+            GetRss();\r
+            SetVersions();\r
+        }\r
+        \r
+        /// <summary>\r
+        /// Gets the SkipVersion number\r
+        /// </summary>\r
+        public int SkipVersion { get; private set; }\r
+\r
+\r
+        /// <summary>\r
+        /// Get the RSS feed\r
+        /// </summary>\r
+        private void GetRss()\r
+        {\r
+            wBrowser.Url = appcast.DescriptionUrl;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Set the versions\r
+        /// </summary>\r
+        private void SetVersions()\r
+        {\r
+            string old = string.Format("(You have: {0} / {1})", this.currentVersion, this.currentBuild);\r
+            string newBuild = appcast.Version.Trim() + " (" + appcast.Build + ")";\r
+            lbl_update_text.Text = string.Format("HandBrake {0} is now available. {1}", newBuild, old);\r
+        }\r
+\r
+        /// <summary>\r
+        /// Handle the Install Update button click event.\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The EventArgs.\r
+        /// </param>\r
+        private void BtnInstallUpdateClick(object sender, EventArgs e)\r
+        {\r
+            DownloadUpdate download = new DownloadUpdate(appcast.DownloadFile);\r
+            download.ShowDialog();\r
+            this.DialogResult = DialogResult.OK;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Handle the Remind Later button click event\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The EventArgs.\r
+        /// </param>\r
+        private void BtnRemindLaterClick(object sender, EventArgs e)\r
+        {\r
+            this.DialogResult = DialogResult.Cancel;\r
+        }\r
+\r
+        /// <summary>\r
+        /// Handle the Skip update button click event\r
+        /// </summary>\r
+        /// <param name="sender">\r
+        /// The sender.\r
+        /// </param>\r
+        /// <param name="e">\r
+        /// The e.\r
+        /// </param>\r
+        private void BtnSkipClick(object sender, EventArgs e)\r
+        {\r
+            this.SkipVersion = int.Parse(appcast.Build);\r
+            this.DialogResult = DialogResult.OK;\r
+        }\r
+    }\r
+}
\ No newline at end of file