Use ItemDrag item instead of selected item to get correct dragged item

This commit is contained in:
Jaex 2016-04-24 02:16:08 +03:00
parent a6603f3e1a
commit 2c65d618dc

View file

@ -1278,12 +1278,18 @@ private void lvUploads_KeyDown(object sender, KeyEventArgs e)
private void lvUploads_ItemDrag(object sender, ItemDragEventArgs e)
{
TaskInfo task = GetCurrentUploadInfo();
ListViewItem item = e.Item as ListViewItem;
if (task != null && !string.IsNullOrEmpty(task.FilePath) && File.Exists(task.FilePath))
if (item != null)
{
AllowDrop = false;
lvUploads.DoDragDrop(new DataObject(DataFormats.FileDrop, new string[] { task.FilePath }), DragDropEffects.Copy);
WorkerTask task = item.Tag as WorkerTask;
if (task != null && task.Info != null && !string.IsNullOrEmpty(task.Info.FilePath) && File.Exists(task.Info.FilePath))
{
AllowDrop = false;
lvUploads.DoDragDrop(new DataObject(DataFormats.FileDrop, new string[] { task.Info.FilePath }), DragDropEffects.Copy);
}
}
}