Assign IsFirstTimeRun and IsUpgrade on setting load

This commit is contained in:
Jaex 2016-06-20 08:50:49 +03:00
parent aa8334f439
commit 3143e01a31
2 changed files with 5 additions and 15 deletions

View file

@ -44,22 +44,10 @@ public abstract class SettingsBase<T> where T : SettingsBase<T>, new()
public string ApplicationVersion { get; set; }
[Browsable(false)]
public bool IsFirstTimeRun
{
get
{
return string.IsNullOrEmpty(ApplicationVersion);
}
}
public bool IsFirstTimeRun { get; private set; }
[Browsable(false)]
public bool IsUpgrade
{
get
{
return !IsFirstTimeRun && Helpers.CompareApplicationVersion(ApplicationVersion) < 0;
}
}
public bool IsUpgrade { get; private set; }
protected virtual void OnSettingsSaved(string filePath, bool result)
{
@ -103,6 +91,8 @@ public static T Load(string filePath)
if (setting != null)
{
setting.FilePath = filePath;
setting.IsFirstTimeRun = string.IsNullOrEmpty(setting.ApplicationVersion);
setting.IsUpgrade = !setting.IsFirstTimeRun && Helpers.CompareApplicationVersion(setting.ApplicationVersion) < 0;
}
return setting;

View file

@ -140,7 +140,7 @@ private GitHubRelease GetLatestRelease(bool includePreRelease)
return latestRelease;
}
public bool UpdateReleaseInfo(GitHubRelease release, bool isPortable, bool isBrowserDownloadURL)
private bool UpdateReleaseInfo(GitHubRelease release, bool isPortable, bool isBrowserDownloadURL)
{
if (release != null && !string.IsNullOrEmpty(release.tag_name) && release.tag_name.Length > 1 && release.tag_name[0] == 'v')
{