mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix Multiple Drag and drop causing NotReturn Method Call
This commit is contained in:
parent
ee9c53d2f9
commit
5b6a18879c
1 changed files with 11 additions and 7 deletions
|
|
@ -92,6 +92,8 @@ namespace Flow.Launcher
|
|||
private Point start;
|
||||
private string path;
|
||||
private string query;
|
||||
// this method is called by the UI thread, which is single threaded, so we can be sloppy with locking
|
||||
private bool isDragging;
|
||||
|
||||
private void ResultList_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
|
|
@ -101,15 +103,16 @@ namespace Flow.Launcher
|
|||
path = result.Result.CopyText;
|
||||
query = result.Result.OriginQuery.RawQuery;
|
||||
start = e.GetPosition(null);
|
||||
isDragging = true;
|
||||
}
|
||||
|
||||
private void ResultList_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.LeftButton != MouseButtonState.Pressed)
|
||||
if (e.LeftButton != MouseButtonState.Pressed|| !isDragging)
|
||||
{
|
||||
start = default;
|
||||
path = string.Empty;
|
||||
query = string.Empty;
|
||||
isDragging = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -123,15 +126,16 @@ namespace Flow.Launcher
|
|||
|| Math.Abs(diff.Y) < SystemParameters.MinimumVerticalDragDistance)
|
||||
return;
|
||||
|
||||
isDragging = false;
|
||||
|
||||
var data = new DataObject(DataFormats.FileDrop, new[]
|
||||
{
|
||||
path
|
||||
});
|
||||
DragDrop.DoDragDrop((DependencyObject)sender, data, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
|
||||
App.API.ChangeQuery(query, true);
|
||||
|
||||
e.Handled = true;
|
||||
|
||||
var effect = DragDrop.DoDragDrop((DependencyObject)sender, data, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
if (effect == DragDropEffects.Move)
|
||||
App.API.ChangeQuery(query, true);
|
||||
}
|
||||
private void ResultListBox_OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue