Add option to disable auto updates

This commit is contained in:
bao-qian 2016-05-12 03:01:33 +01:00
parent 45d5da98ca
commit 65577a67dc
2 changed files with 14 additions and 7 deletions

View File

@ -22,6 +22,8 @@ namespace Wox.Core.UserSettings
public string ResultFontWeight { get; set; } public string ResultFontWeight { get; set; }
public string ResultFontStretch { get; set; } public string ResultFontStretch { get; set; }
public bool AutoUpdates { get; set; } = true;
public double WindowLeft { get; set; } public double WindowLeft { get; set; }
public double WindowTop { get; set; } public double WindowTop { get; set; }
public int MaxResultsToShow { get; set; } = 6; public int MaxResultsToShow { get; set; } = 6;

View File

@ -17,6 +17,7 @@ namespace Wox
public static PublicAPIInstance API { get; private set; } public static PublicAPIInstance API { get; private set; }
private const string Unique = "Wox_Unique_Application_Mutex"; private const string Unique = "Wox_Unique_Application_Mutex";
private static bool _disposed; private static bool _disposed;
private Settings _settings;
[STAThread] [STAThread]
public static void Main() public static void Main()
@ -41,13 +42,13 @@ namespace Wox
ImageLoader.PreloadImages(); ImageLoader.PreloadImages();
var storage = new JsonStrorage<Settings>(); var storage = new JsonStrorage<Settings>();
var settings = storage.Load(); _settings = storage.Load();
PluginManager.LoadPlugins(settings.PluginSettings); PluginManager.LoadPlugins(_settings.PluginSettings);
var vm = new MainViewModel(settings, storage); var vm = new MainViewModel(_settings, storage);
var pluginsSettings = settings.PluginSettings; var pluginsSettings = _settings.PluginSettings;
var window = new MainWindow(settings, vm); var window = new MainWindow(_settings, vm);
API = new PublicAPIInstance(settings, vm); API = new PublicAPIInstance(_settings, vm);
PluginManager.InitializePlugins(API); PluginManager.InitializePlugins(API);
RegisterExitEvents(); RegisterExitEvents();
@ -60,7 +61,11 @@ namespace Wox
private async void OnActivated(object sender, EventArgs e) private async void OnActivated(object sender, EventArgs e)
{ {
Updater.UpdateApp(); // todo happlebao add option in gui
if (_settings.AutoUpdates)
{
Updater.UpdateApp();
}
} }
private void RegisterExitEvents() private void RegisterExitEvents()