Skip to content

Commit

Permalink
Merge pull request #711 from aydjay/upgradeDetection
Browse files Browse the repository at this point in the history
Version checker queries application state and not assembley
  • Loading branch information
Stickymaddness authored Aug 7, 2017
2 parents 248c4c6 + 81ded20 commit 0a1698c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Procurement/ApplicationState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ namespace Procurement
{
public static class ApplicationState
{
/// <summary>
/// Application version to check for latest release.
/// Must begin with "Procurement ". See: VersionChecker.cs
/// </summary>
public static string Version = "Procurement 1.14.0";
public static POEModel Model = new POEModel();
public static Dictionary<string, Stash> Stash = new Dictionary<string, Stash>();
Expand Down
5 changes: 3 additions & 2 deletions Procurement/Utility/VersionChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ private static void client_DownloadStringCompleted(object sender, DownloadString
string[] updateInfo = e.Result.Split(',');

updateInfo[0] = updateInfo[0].Replace("Procurement ", "");
Version currentVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
Version latestVersion = new Version(updateInfo[0]);
var appVersion = ApplicationState.Version.Replace("Procurement ", "");
var currentVersion = new Version(appVersion);
var latestVersion = new Version(updateInfo[0]);

if (currentVersion >= latestVersion || MessageBox.Show("A new version of Procurement is available! Would you like to download now? (Opens in browser)", "Update Available", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
return;
Expand Down

0 comments on commit 0a1698c

Please sign in to comment.