Completely rewrite resource load / update / remove

1. part of #468
2. fix #1245, bug introduced in 7e1c77beddf2c978fa1440e799fec4eb9554739d
This commit is contained in:
bao-qian
2017-02-21 02:19:50 +00:00
parent 17e5bb8d53
commit d0c426a7f9
10 changed files with 157 additions and 203 deletions

View File

@@ -4,8 +4,10 @@ using System.Timers;
using System.Windows;
using Wox.Core;
using Wox.Core.Plugin;
using Wox.Core.Resource;
using Wox.Helper;
using Wox.Infrastructure;
using Wox.Infrastructure.Http;
using Wox.Infrastructure.Image;
using Wox.Infrastructure.Logger;
using Wox.Infrastructure.UserSettings;
@@ -58,6 +60,18 @@ namespace Wox
Current.MainWindow = window;
Current.MainWindow.Title = Constant.Wox;
// happlebao todo temp fix for instance code logic
// remove all dictionaries defined in xaml e.g.g App.xaml
Current.Resources.MergedDictionaries.Clear();
// load plugin before change language, because plugin language also needs be changed
InternationalizationManager.Instance.Settings = _settings;
InternationalizationManager.Instance.ChangeLanguage(_settings.Language);
// main windows needs initialized before theme change because of blur settigns
ThemeManager.Instance.Settings = _settings;
ThemeManager.Instance.ChangeTheme(_settings.Theme);
Http.Proxy = _settings.Proxy;
RegisterExitEvents();
AutoStartup();
@@ -68,6 +82,7 @@ namespace Wox
});
}
private void AutoStartup()
{
if (_settings.StartWoxOnSystemStartup)

View File

@@ -60,8 +60,9 @@ namespace Wox
private void OnLoaded(object sender, RoutedEventArgs _)
{
// todo is there a way to set blur only once?
ThemeManager.Instance.SetBlurForWindow();
WindowsInteropHelper.DisableControlBox(this);
ThemeManager.Instance.ChangeTheme(_settings.Theme);
InitProgressbarAnimation();
_viewModel.PropertyChanged += (o, e) =>

View File

@@ -33,11 +33,7 @@ namespace Wox.ViewModel
}
};
// happlebao todo temp fix for instance code logic
InternationalizationManager.Instance.Settings = Settings;
InternationalizationManager.Instance.ChangeLanguage(Settings.Language);
ThemeManager.Instance.Settings = Settings;
Http.Proxy = Settings.Proxy;
}
public Settings Settings { get; set; }