Skip to content

Commit dde5a51

Browse files
committed
Adjust Drag and drop code
1 parent 3e128e1 commit dde5a51

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
using System.Text;
2424
using DataObject = System.Windows.DataObject;
2525
using System.Diagnostics;
26+
using Microsoft.AspNetCore.Http;
27+
using System.IO;
2628

2729
namespace Flow.Launcher
2830
{
@@ -412,22 +414,19 @@ private void FileView_MouseMove(object sender, System.Windows.Input.MouseEventAr
412414
var d = (DependencyObject)e.OriginalSource;
413415
var item = ItemsControl.ContainerFromElement(r, d) as ListBoxItem;
414416
var result = (ResultViewModel)item?.DataContext;
415-
Console.WriteLine("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
416-
Console.WriteLine("result");
417417

418-
// right about here you get the file urls of the selected items.
419-
// should be quite easy, if not, ask.
420-
//string[] files = "asdf.txt";
421418

422-
string path = @"D:\test.png";
419+
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);
423425
string[] files = { path };
424426
var data = new DataObject(System.Windows.DataFormats.FileDrop, files);
425-
data.SetData(System.Windows.DataFormats.Text, files[0]);
426-
DragDrop.DoDragDrop(this, data, System.Windows.DragDropEffects.Copy);
427+
//data.SetData(System.Windows.DataFormats.FileDrop, files[0]);
428+
DragDrop.DoDragDrop(this.ResultListBox, data, System.Windows.DragDropEffects.Copy);
427429
e.Handled = true;
428-
// string dataFormat = System.Windows.DataFormats.FileDrop;
429-
//System.Windows.DataObject dataObject = new System.Windows.DataObject(dataFormat, files);
430-
//DragDrop.DoDragDrop(this.ResultListBox, dataObject, System.Windows.DragDropEffects.Copy);
431430
}
432431
}
433432

0 commit comments

Comments
 (0)