Refactoring CustomizedPluginConfig

1. Reorder the sequence of initialization of UserSettings.
2. Use dictionary for CustomizedPluginConfigs, so code logic like
`.FirstOrDefault(o => o.ID == id);` are removed
3. part of #389
This commit is contained in:
bao-qian
2016-03-25 01:22:24 +00:00
parent 98f1d5cd9b
commit d6f9fddc94
10 changed files with 79 additions and 86 deletions

View File

@@ -8,9 +8,9 @@ using System.Threading;
using System.Windows;
using Wox.CommandArgs;
using Wox.Core.Plugin;
using Wox.Core.UserSettings;
using Wox.Helper;
using Wox.Infrastructure;
using Wox.Plugin;
using Wox.ViewModel;
using Stopwatch = Wox.Infrastructure.Stopwatch;
@@ -21,7 +21,7 @@ namespace Wox
private const string Unique = "Wox_Unique_Application_Mutex";
public static MainWindow Window { get; private set; }
public static IPublicAPI API { get; private set; }
public static PublicAPIInstance API { get; private set; }
[STAThread]
public static void Main()
@@ -50,11 +50,13 @@ namespace Wox
MainViewModel mainVM = new MainViewModel();
API = new PublicAPIInstance(mainVM);
Window = new MainWindow {DataContext = mainVM};
NotifyIconManager notifyIconManager = new NotifyIconManager(API);
PluginManager.Init(API);
CommandArgsFactory.Execute(e.Args.ToList());
// happlebao todo: the whole setting releated initialization should be put into seperate class/method
API.SetHotkey(UserSettingStorage.Instance.Hotkey, API.OnHotkey);
API.SetCustomPluginHotkey();
});
}