@@ -390,42 +390,34 @@ private void OnPreviewDragOver(object sender, DragEventArgs e)
390
390
391
391
private Point start ;
392
392
393
- private void FileView_PreviewMouseLeftButtonDown ( object sender , MouseButtonEventArgs e )
393
+ private void ResultList_PreviewMouseLeftButtonDown ( object sender , MouseButtonEventArgs e )
394
394
{
395
395
this . start = e . GetPosition ( null ) ;
396
396
}
397
397
398
- private void FileView_MouseMove ( object sender , System . Windows . Input . MouseEventArgs e )
398
+ private void ResultList_MouseMove ( object sender , System . Windows . Input . MouseEventArgs e )
399
399
{
400
+ if ( this . ResultListBox . SelectedItems . Count == 0 )
401
+ {
402
+ return ;
403
+ }
404
+
400
405
Point mpos = e . GetPosition ( null ) ;
401
406
Vector diff = this . start - mpos ;
402
407
408
+ var r = ( ResultListBox ) sender ;
409
+ var d = ( DependencyObject ) e . OriginalSource ;
410
+ var item = ItemsControl . ContainerFromElement ( r , d ) as ListBoxItem ;
411
+ var result = ( ResultViewModel ) item ? . DataContext ;
412
+
403
413
if ( e . LeftButton == MouseButtonState . Pressed &&
404
414
Math . Abs ( diff . X ) > SystemParameters . MinimumHorizontalDragDistance &&
405
415
Math . Abs ( diff . Y ) > SystemParameters . MinimumVerticalDragDistance )
406
416
{
407
-
408
- if ( this . ResultListBox . SelectedItems . Count == 0 )
409
- {
410
- return ;
411
- }
412
-
413
- var r = ( ResultListBox ) sender ;
414
- var d = ( DependencyObject ) e . OriginalSource ;
415
- var item = ItemsControl . ContainerFromElement ( r , d ) as ListBoxItem ;
416
- var result = ( ResultViewModel ) item ? . DataContext ;
417
-
418
-
419
417
string copyText = string . IsNullOrEmpty ( result . Result . CopyText ) ? result . Result . SubTitle : result . Result . CopyText ;
420
- var isFile = File . Exists ( copyText ) ;
421
- var isFolder = Directory . Exists ( copyText ) ;
422
-
423
- //string path = @"D:\test.png";
424
- string path = Convert . ToString ( copyText ) ;
425
- string [ ] files = { path } ;
418
+ string [ ] files = { copyText } ;
426
419
var data = new DataObject ( System . Windows . DataFormats . FileDrop , files ) ;
427
- //data.SetData(System.Windows.DataFormats.FileDrop, files[0]);
428
- DragDrop . DoDragDrop ( this . ResultListBox , data , System . Windows . DragDropEffects . Copy ) ;
420
+ DragDrop . DoDragDrop ( this . ResultListBox , data , System . Windows . DragDropEffects . Copy | System . Windows . DragDropEffects . Move ) ;
429
421
e . Handled = true ;
430
422
}
431
423
}
0 commit comments