mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Using new thread to check upgrade
This commit is contained in:
parent
4d3df4cda6
commit
72988cc6fb
3 changed files with 23 additions and 26 deletions
|
|
@ -8,13 +8,13 @@ using Wox.Infrastructure;
|
|||
|
||||
namespace Wox.Plugin.Sys
|
||||
{
|
||||
public class Sys : IPlugin, ISettingProvider ,IPluginI18n
|
||||
{
|
||||
List<Result> availableResults = new List<Result>();
|
||||
public class Sys : IPlugin, ISettingProvider, IPluginI18n
|
||||
{
|
||||
List<Result> availableResults = new List<Result>();
|
||||
private PluginInitContext context;
|
||||
|
||||
#region DllImport
|
||||
|
||||
#region DllImport
|
||||
|
||||
internal const int EWX_LOGOFF = 0x00000000;
|
||||
internal const int EWX_SHUTDOWN = 0x00000001;
|
||||
internal const int EWX_REBOOT = 0x00000002;
|
||||
|
|
@ -26,7 +26,7 @@ namespace Wox.Plugin.Sys
|
|||
[DllImport("user32")]
|
||||
private static extern void LockWorkStation();
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
public System.Windows.Controls.Control CreateSettingPanel()
|
||||
{
|
||||
|
|
@ -35,11 +35,6 @@ namespace Wox.Plugin.Sys
|
|||
|
||||
public List<Result> Query(Query query)
|
||||
{
|
||||
if (availableResults.Count == 0)
|
||||
{
|
||||
LoadCommands();
|
||||
}
|
||||
|
||||
List<Result> results = new List<Result>();
|
||||
foreach (Result availableResult in availableResults)
|
||||
{
|
||||
|
|
@ -54,6 +49,7 @@ namespace Wox.Plugin.Sys
|
|||
public void Init(PluginInitContext context)
|
||||
{
|
||||
this.context = context;
|
||||
LoadCommands();
|
||||
}
|
||||
|
||||
private void LoadCommands()
|
||||
|
|
@ -153,5 +149,5 @@ namespace Wox.Plugin.Sys
|
|||
{
|
||||
return context.API.GetTranslation("wox_plugin_sys_plugin_description");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@ using System.Windows.Controls;
|
|||
|
||||
namespace Wox.Plugin.Sys
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for SysSettings.xaml
|
||||
/// </summary>
|
||||
public partial class SysSettings : UserControl
|
||||
{
|
||||
public SysSettings(List<Result> Results)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ using Wox.Core.i18n;
|
|||
using Wox.Core.UserSettings;
|
||||
using Wox.Infrastructure.Http;
|
||||
using Wox.Infrastructure.Logger;
|
||||
using System.Threading;
|
||||
|
||||
namespace Wox.Core.Updater
|
||||
{
|
||||
|
|
@ -82,22 +83,25 @@ namespace Wox.Core.Updater
|
|||
|
||||
public void CheckUpdate()
|
||||
{
|
||||
string json = HttpRequest.Get(VersionCheckURL, HttpProxy.Instance);
|
||||
if (!string.IsNullOrEmpty(json))
|
||||
ThreadPool.QueueUserWorkItem(o =>
|
||||
{
|
||||
try
|
||||
string json = HttpRequest.Get(VersionCheckURL, HttpProxy.Instance);
|
||||
if (!string.IsNullOrEmpty(json))
|
||||
{
|
||||
NewRelease = JsonConvert.DeserializeObject<Release>(json);
|
||||
if (IsNewerThanCurrent(NewRelease) && !UserSettingStorage.Instance.DontPromptUpdateMsg)
|
||||
try
|
||||
{
|
||||
StartUpdate();
|
||||
NewRelease = JsonConvert.DeserializeObject<Release>(json);
|
||||
if (IsNewerThanCurrent(NewRelease) && !UserSettingStorage.Instance.DontPromptUpdateMsg)
|
||||
{
|
||||
StartUpdate();
|
||||
}
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
}
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void StartUpdate()
|
||||
|
|
|
|||
Loading…
Reference in a new issue