This commit is contained in:
abdelkader
2024-03-18 13:02:42 -04:00
parent 7d09a9ee3e
commit 7e8c43e011
2 changed files with 13 additions and 19 deletions

View File

@@ -1,5 +1,7 @@
0.5.4 0.5.4
Fix a regression when saving Phones, Website, Email Fix a regression when saving Phones, Website, Email
added the update button in the about dialog to check the latest version.
0.5.3 0.5.3
Support of QR Code. Support of QR Code.

View File

@@ -107,32 +107,24 @@ namespace vCardEditor.View
private async void updateButton_Click(object sender, EventArgs e) private async void updateButton_Click(object sender, EventArgs e)
{ {
string url = ConfigRepository.Instance.VersionUrl;
try try
{ {
using (var client = new System.Net.WebClient()) using (var client = new WebClient())
{ {
string result = await client.DownloadStringTaskAsync(url); string result = await client.DownloadStringTaskAsync(ConfigRepository.Instance.VersionUrl);
if (result.Length > 0) using (var reader = new StringReader(result))
{ {
using (var reader = new StringReader(result)) string InternetVersion = reader.ReadLine();
{ string AssemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
string InternetVersion = reader.ReadLine(); Version v1 = new Version(InternetVersion);
string AssemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); Version v2 = new Version(AssemblyVersion);
Version v1 = new Version(InternetVersion);
Version v2 = new Version(AssemblyVersion);
if (v1.CompareTo(v2) > 0)
MessageBox.Show(String.Format("New version {0} found!", result));
else
MessageBox.Show("You have the latest version!");
}
if (v1.CompareTo(v2) > 0)
MessageBox.Show(string.Format("New version {0} found!", result), "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
else
MessageBox.Show("You have the latest version!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
} }
} }
catch (WebException ) catch (WebException )
{ {