Use variable instead of global static method

1. introduce variable
2. part of #389
3. refactoring program suffix in program plugin
4. 全局变量一时爽,代码重构火葬场
This commit is contained in:
bao-qian
2016-03-28 03:09:57 +01:00
parent c596039453
commit b22a4501cc
36 changed files with 402 additions and 343 deletions

View File

@@ -22,6 +22,7 @@ namespace Wox.Core.Updater
private const string UpdateFeedURL = "http://upgrade.getwox.com/update.xml";
//private const string UpdateFeedURL = "http://127.0.0.1:8888/update.xml";
private static SemanticVersion currentVersion;
private UserSettingStorage _settings;
public event EventHandler PrepareUpdateReady;
public event EventHandler UpdateError;
@@ -43,6 +44,7 @@ namespace Wox.Core.Updater
private UpdaterManager()
{
UpdateManager.Instance.UpdateSource = GetUpdateSource();
_settings = UserSettingStorage.Instance;
}
public SemanticVersion CurrentVersion
@@ -87,7 +89,7 @@ namespace Wox.Core.Updater
try
{
NewRelease = JsonConvert.DeserializeObject<Release>(json);
if (IsNewerThanCurrent(NewRelease) && !UserSettingStorage.Instance.DontPromptUpdateMsg)
if (IsNewerThanCurrent(NewRelease) && !_settings.DontPromptUpdateMsg)
{
StartUpdate();
}
@@ -146,7 +148,7 @@ namespace Wox.Core.Updater
// get out of the way so the console window isn't obstructed
try
{
UpdateManager.Instance.ApplyUpdates(true, UserSettingStorage.Instance.EnableUpdateLog, false);
UpdateManager.Instance.ApplyUpdates(true, _settings.EnableUpdateLog, false);
}
catch (Exception e)
{