From 533bc4c2feac9c23510361ceac0b7a8c9a6e9c3c Mon Sep 17 00:00:00 2001 From: bao-qian Date: Sun, 21 Feb 2016 15:26:57 +0000 Subject: [PATCH] Misc part of refactoring for PR #494 --- Wox/App.xaml.cs | 8 +++++--- Wox/PublicAPIInstance.cs | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Wox/App.xaml.cs b/Wox/App.xaml.cs index b5847ac164..3e39447d35 100644 --- a/Wox/App.xaml.cs +++ b/Wox/App.xaml.cs @@ -43,12 +43,14 @@ namespace Wox base.OnStartup(e); WoxDirectroy.Executable = Directory.GetParent(Assembly.GetExecutingAssembly().Location).ToString(); RegisterUnhandledException(); - ThreadPool.QueueUserWorkItem(o => { ImageLoader.ImageLoader.PreloadImages(); }); + + ThreadPool.SetMaxThreads(30, 10); + ThreadPool.SetMinThreads(10, 5); + ThreadPool.QueueUserWorkItem(_ => { ImageLoader.ImageLoader.PreloadImages(); }); MainViewModel mainVM = new MainViewModel(); API = new PublicAPIInstance(mainVM); - Window = new MainWindow(); - Window.DataContext = mainVM; + Window = new MainWindow {DataContext = mainVM}; NotifyIconManager notifyIconManager = new NotifyIconManager(API); diff --git a/Wox/PublicAPIInstance.cs b/Wox/PublicAPIInstance.cs index 2374d46e19..b0c07cd646 100644 --- a/Wox/PublicAPIInstance.cs +++ b/Wox/PublicAPIInstance.cs @@ -30,8 +30,7 @@ namespace Wox { this.MainVM = mainVM; - ThreadPool.SetMaxThreads(30, 10); - ThreadPool.SetMinThreads(10, 5); + GlobalHotkey.Instance.hookedKeyboardCallback += KListener_hookedKeyboardCallback; WebRequest.RegisterPrefix("data", new DataWebRequestFactory());