Merge pull request #26 from microsoft/user/ryanbod/removing_unnecessary_locks

User/ryanbod/removing unnecessary locks
This commit is contained in:
ryanbodrug-microsoft 2020-04-04 11:53:08 -07:00 committed by GitHub
commit 564e76956a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,6 @@ namespace Wox
{
public partial class ResultListBox
{
protected object _lock = new object();
private Point _lastpos;
private ListBoxItem curItem = null;
public ResultListBox()
@ -24,34 +23,25 @@ namespace Wox
private void OnMouseEnter(object sender, MouseEventArgs e)
{
lock(_lock)
{
curItem = (ListBoxItem)sender;
var p = e.GetPosition((IInputElement)sender);
_lastpos = p;
}
curItem = (ListBoxItem)sender;
var p = e.GetPosition((IInputElement)sender);
_lastpos = p;
}
private void OnMouseMove(object sender, MouseEventArgs e)
{
lock(_lock)
var p = e.GetPosition((IInputElement)sender);
if (_lastpos != p)
{
var p = e.GetPosition((IInputElement)sender);
if (_lastpos != p)
{
((ListBoxItem)sender).IsSelected = true;
}
((ListBoxItem)sender).IsSelected = true;
}
}
private void ListBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
lock(_lock)
if (curItem != null)
{
if (curItem != null)
{
curItem.IsSelected = true;
}
curItem.IsSelected = true;
}
}
}