From 9ca67acc5dec3ba788e14a74e4e3bdb71f2a318a Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Sun, 30 Oct 2022 11:33:30 -0500 Subject: [PATCH] Change logic to not do anything if file not exist. --- Flow.Launcher/ResultListBox.xaml.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Flow.Launcher/ResultListBox.xaml.cs b/Flow.Launcher/ResultListBox.xaml.cs index 27037241c..a0ffc159a 100644 --- a/Flow.Launcher/ResultListBox.xaml.cs +++ b/Flow.Launcher/ResultListBox.xaml.cs @@ -80,20 +80,18 @@ namespace Flow.Launcher return; } - Point mpos = e.GetPosition(null); - Vector diff = this.start - mpos; + Point mousePosition = e.GetPosition(null); + Vector diff = this.start - mousePosition; if (Math.Abs(diff.X) < SystemParameters.MinimumHorizontalDragDistance - || Math.Abs(diff.Y) < SystemParameters.MinimumVerticalDragDistance) + || Math.Abs(diff.Y) < SystemParameters.MinimumVerticalDragDistance + || !File.Exists(file)) return; - DataObject data; - data = File.Exists(file) - ? new DataObject(DataFormats.FileDrop, new[] - { - file - }) - : new DataObject(DataFormats.UnicodeText, file); + var data = new DataObject(DataFormats.FileDrop, new[] + { + file + }); DragDrop.DoDragDrop((DependencyObject)sender, data, DragDropEffects.Move | DragDropEffects.Copy); e.Handled = true; }