mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 11:46:30 +02:00
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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user