Replace ResultItem usercontrol with listbox to improve ui performance

This commit is contained in:
qianlifeng
2014-02-19 22:50:15 +08:00
parent 729640d6ec
commit 4736921d05
5 changed files with 142 additions and 160 deletions

View File

@@ -40,7 +40,6 @@ namespace Wox
InitialTray();
hook.KeyPressed += OnHotKey;
hook.RegisterHotKey(XModifierKeys.Alt, Keys.Space);
resultCtrl.resultItemChangedEvent += resultCtrl_resultItemChangedEvent;
ThreadPool.SetMaxThreads(30, 10);
InitProgressbarAnimation();
try
@@ -106,11 +105,6 @@ namespace Wox
notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(childen);
}
private void resultCtrl_resultItemChangedEvent()
{
resultCtrl.Margin = resultCtrl.GetCurrentResultCount() > 0 ? new Thickness { Top = grid.Margin.Top } : new Thickness { Top = 0 };
}
private void OnHotKey(object sender, KeyPressedEventArgs e)
{
if (!IsVisible)
@@ -301,8 +295,10 @@ namespace Wox
});
resultCtrl.Dispatcher.Invoke(new Action(() =>
{
var t1 = Environment.TickCount;
List<Result> l = list.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == tbQuery.Text).ToList();
resultCtrl.AddResults(l);
Debug.WriteLine("Time:" + (Environment.TickCount - t1) + " Count:" + l.Count);
}));
}
}