Skip to content

Instantly share code, notes, and snippets.

Created May 18, 2016 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d921a5190c9434b84b86d77dd16f883b to your computer and use it in GitHub Desktop.
Save anonymous/d921a5190c9434b84b86d77dd16f883b to your computer and use it in GitHub Desktop.
private void grid_liste_piecejointe_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
e.Effect = DragDropEffects.Move;
else
e.Effect = DragDropEffects.None;
}
private void grid_liste_piecejointe_DragDrop(object sender, DragEventArgs e) {
var dropped = ((string[])e.Data.GetData(DataFormats.FileDrop));
var files = dropped.ToList();
if (!files.Any())
return;
foreach (string drop in dropped)
if (Directory.Exists(drop))
files.AddRange(Directory.GetFiles(drop, filterFile, SearchOption.AllDirectories));
foreach (string file in files)
{
if (!checkAttachmentExists(file) && checkExtensionFile(file))
{
PieceJointe pj = new PieceJointe();
pj.setPiecejointe(file);
list_pj.Add(pj);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment