From 65577a67dc620af71ba9d6f30b3a947a9800a187 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Thu, 12 May 2016 03:01:33 +0100 Subject: [PATCH] Add option to disable auto updates --- Wox.Core/UserSettings/Settings.cs | 2 ++ Wox/App.xaml.cs | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Wox.Core/UserSettings/Settings.cs b/Wox.Core/UserSettings/Settings.cs index 70deb9c46b..e7b2c8b0e4 100644 --- a/Wox.Core/UserSettings/Settings.cs +++ b/Wox.Core/UserSettings/Settings.cs @@ -22,6 +22,8 @@ namespace Wox.Core.UserSettings public string ResultFontWeight { get; set; } public string ResultFontStretch { get; set; } + public bool AutoUpdates { get; set; } = true; + public double WindowLeft { get; set; } public double WindowTop { get; set; } public int MaxResultsToShow { get; set; } = 6; diff --git a/Wox/App.xaml.cs b/Wox/App.xaml.cs index dcd6b03aea..be698c0e84 100644 --- a/Wox/App.xaml.cs +++ b/Wox/App.xaml.cs @@ -17,6 +17,7 @@ namespace Wox public static PublicAPIInstance API { get; private set; } private const string Unique = "Wox_Unique_Application_Mutex"; private static bool _disposed; + private Settings _settings; [STAThread] public static void Main() @@ -41,13 +42,13 @@ namespace Wox ImageLoader.PreloadImages(); var storage = new JsonStrorage(); - var settings = storage.Load(); + _settings = storage.Load(); - PluginManager.LoadPlugins(settings.PluginSettings); - var vm = new MainViewModel(settings, storage); - var pluginsSettings = settings.PluginSettings; - var window = new MainWindow(settings, vm); - API = new PublicAPIInstance(settings, vm); + PluginManager.LoadPlugins(_settings.PluginSettings); + var vm = new MainViewModel(_settings, storage); + var pluginsSettings = _settings.PluginSettings; + var window = new MainWindow(_settings, vm); + API = new PublicAPIInstance(_settings, vm); PluginManager.InitializePlugins(API); RegisterExitEvents(); @@ -60,7 +61,11 @@ namespace Wox private async void OnActivated(object sender, EventArgs e) { - Updater.UpdateApp(); + // todo happlebao add option in gui + if (_settings.AutoUpdates) + { + Updater.UpdateApp(); + } } private void RegisterExitEvents()