2 using System.Collections.Generic;
\r
3 using System.ComponentModel;
\r
5 using System.Drawing;
\r
7 using System.Windows.Forms;
\r
13 public partial class frmUpdate : Form
\r
17 InitializeComponent();
\r
20 private void btn_update_click(object sender, EventArgs e)
\r
22 // Try to download the contents of the update file. If sucessful then split the 2 lines and do an update check/
\r
25 String updateFile = Properties.Settings.Default.updateFile;
\r
26 WebClient client = new WebClient();
\r
27 String data = client.DownloadString(updateFile);
\r
28 String[] versionData = data.Split('\n');
\r
30 lbl_GuiVersion.Text = versionData[0];
\r
31 lbl_cliVersion.Text = versionData[1];
\r
33 if ((versionData[0] != Properties.Settings.Default.GuiVersion) || (versionData[1] != Properties.Settings.Default.CliVersion))
\r
35 MessageBox.Show("A new version is available. Please visit the project website to download the update.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
\r
38 //else fail displaying an error message.
\r
42 MessageBox.Show("Unable to check for new version at this time. Please try again later.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
\r
46 private void btn_close_Click(object sender, EventArgs e)
\r
48 this.Close(); // Close the window
\r
51 private void frmUpdate_Load(object sender, EventArgs e)
\r
53 // Set the labels with their correct values.
\r
54 Version.Text = Properties.Settings.Default.GuiVersion;
\r
55 cliVersion.Text = Properties.Settings.Default.CliVersion;
\r