Fix a crash in Win8

This commit is contained in:
qianlifeng 2014-07-27 17:15:12 +08:00
parent 6e2e067d66
commit 3fea8eb820
2 changed files with 10 additions and 15 deletions

View File

@ -22,7 +22,7 @@
<StackPanel Orientation="Vertical">
<TextBox Style="{DynamicResource QueryBoxStyle}" PreviewDragOver="TbQuery_OnPreviewDragOver" AllowDrop="True" Grid.Row="0" x:Name="tbQuery" PreviewKeyDown="TbQuery_OnPreviewKeyDown" TextChanged="TextBoxBase_OnTextChanged" />
<Line Style="{DynamicResource PendingLineStyle}" x:Name="progressBar" Y1="0" Y2="0" X2="100" Grid.Row="1" Height="2" StrokeThickness="1"></Line>
<wox:ResultPanel x:Name="resultCtrl" Grid.Row="2"/>
<wox:ResultPanel x:Name="resultCtrl" />
</StackPanel>
</Border>
</Window>

View File

@ -325,14 +325,12 @@ namespace Wox
}
}, TimeSpan.FromMilliseconds(ShouldNotDelayQuery ? 0 : 150));
}
private bool ShouldNotDelayQuery
{
get
{
return (bool)Dispatcher.Invoke(new Func<bool>(() =>
{
return IsCMDMode || IsWebSearchMode;
}));
return IsCMDMode || IsWebSearchMode;
}
}
@ -350,11 +348,10 @@ namespace Wox
{
Query q = new Query(tbQuery.Text);
return !UserSettingStorage.Instance.EnableWebSearchSuggestion &&
UserSettingStorage.Instance.WebSearches.Exists(o => o.ActionWord == q.ActionName && o.Enabled);
UserSettingStorage.Instance.WebSearches.Exists(o => o.ActionWord == q.ActionName && o.Enabled);
}
}
private void Border_OnMouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left) DragMove();
@ -521,7 +518,7 @@ namespace Wox
toolTip.IsOpen = false;
e.Handled = true;
break;
case Key.Back:
if (BackKeyDownEvent != null)
{
@ -533,7 +530,7 @@ namespace Wox
}
break;
case Key.Enter:
case Key.Enter:
case Key.Tab:
AcceptSelect(resultCtrl.GetActiveResult());
e.Handled = true;
@ -578,12 +575,10 @@ namespace Wox
{
waitShowResultList.AddRange(list);
}
Dispatcher.DelayInvoke("ShowResult", k => resultCtrl.Dispatcher.Invoke(new Action(() =>
{
List<Result> l = waitShowResultList.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == lastQuery).ToList();
waitShowResultList.Clear();
resultCtrl.AddResults(l);
})), TimeSpan.FromMilliseconds(ShouldNotDelayQuery ? 0 : 50));
List<Result> l = waitShowResultList.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == lastQuery).ToList();
waitShowResultList.Clear();
Dispatcher.Invoke(new Action(() => resultCtrl.AddResults(l)));
}
}