This repository was archived by the owner on Dec 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDragDropController.cs
More file actions
50 lines (41 loc) · 1.42 KB
/
DragDropController.cs
File metadata and controls
50 lines (41 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Windows.Forms;
namespace MultiAppLauncher
{
public class DragDropController
{
private readonly IMainFormView _view;
public DragDropController(IMainFormView view)
{
_view = view;
}
public void DragDrop(DragEventArgs e)
{
var fileNames = e.Data.GetData("FileNameW") as string[];
if (fileNames == null || fileNames.Length == 0)
return;
var profile = new SelectProfile();
if (profile.ShowDialog(_view) == DialogResult.OK)
{
AddFileNameToList(fileNames[0], profile.SelectedProfile);
}
}
public void DragEnter(DragEventArgs e)
{
if (e.Data.GetDataPresent("FileNameW"))
{
e.Effect = DragDropEffects.Copy;
}
}
private void AddFileNameToList(string fileName, string profile)
{
_view.AddListViewItem(new ListViewItem(new[]
{
fileName,
profile,
String.Empty,
String.Empty
}));
}
}
}