Ejemplo n.º 1
0
        void OnDrop(int x, int y, DragDropKind dragDropKind, [MarshalAs(UnmanagedType.LPWStr)] string filesString)
        {
            EventSession.DragLeave();
            var pathes = filesString.Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
            var items  = (from n in pathes
                          where Directory.Exists(n)
                          let i = new DirectoryInfo(n)
                                  select new
            {
                parent = i.Parent.FullName,
                item = Item.CreateDirectoryItem(i.Name, i.LastWriteTime, false)
            }).Concat(
                (from n in pathes
                 where File.Exists(n)
                 let i = new FileInfo(n)
                         select new
            {
                parent = i.DirectoryName,
                item = Item.CreateFileItem(i.Name, i.FullName, i.Extension, i.LastWriteTime, i.Length, false)
            })).ToArray();

            if (items.Length == 0)
            {
                return;
            }

            if (items.Any(n => string.Compare(n.parent, items[0].parent, true) != 0))
            {
                MessageBox.Show("Fehler");
                return;
            }

            EventSession.Drop(x, y, dragDropKind, items[0].parent, items.Select(n => n.item).ToArray());
        }
Ejemplo n.º 2
0
 void OnDragLeave()
 {
     EventSession.DragLeave();
 }