public void StartDrag(IDragInfo dragInfo) { FileNameItem filenameitem = (FileNameItem)dragInfo.SourceItem; dragInfo.Effects = DragDropEffects.Copy | DragDropEffects.Move; dragInfo.Data = filenameitem; }
private void DeleteItem(object filenameitem) { FileNameItem fni = filenameitem as FileNameItem; Mementor.ElementRemove(FilePaths, fni); FilePaths.Remove(fni); }
public void Dropped(IDropInfo dropInfo) { if (dropInfo.DragInfo != null) { if (dropInfo.DragInfo.VisualSource == dropInfo.VisualTarget && dropInfo.Data.GetType() == typeof(FileNameItem)) { FileNameItem filenameitem = dropInfo.Data as FileNameItem; FileNameItem newfilenameitem = filenameitem.Clone() as FileNameItem; FilePaths.Insert(dropInfo.InsertIndex, newfilenameitem); FilePaths.Remove(filenameitem); } } }
public void Paste(FileSelectorModel fileselectormodel) { DisabledMessages(); MessageAddress = fileselectormodel.MessageAddress; FilePaths.Clear(); foreach (var item in fileselectormodel.FilePaths) { FileNameItem filenameitem = new FileNameItem(Mementor); filenameitem.Paste(item); FilePaths.Add(filenameitem); } EnabledMessages(); send = false; }
public void Drop(IDropInfo dropInfo) { var dataObject = dropInfo.Data as DataObject; if (dataObject != null) { if (dataObject.ContainsFileDropList()) { Mementor.BeginBatch(); var filedrop = dataObject.GetFileDropList(); foreach (string str in filedrop) { foreach (string fm in FileMask) { if (System.IO.Path.GetExtension(str).ToUpperInvariant() == fm) { FileNameItem lbfn = new FileNameItem(Mementor) { FileName = str, FileIsSelected = false }; FilePaths.Add(lbfn); Mementor.ElementAdd(FilePaths, lbfn); } } } Mementor.EndBatch(); } } if (dropInfo.DragInfo != null) { if (dropInfo.DragInfo.VisualSource != dropInfo.VisualTarget && dropInfo.Data.GetType() == typeof(FileNameItem)) { FileNameItem filenameitem = dropInfo.Data as FileNameItem; FileNameItem newfilenameitem = filenameitem.Clone() as FileNameItem; FilePaths.Insert(dropInfo.InsertIndex, newfilenameitem); Mementor.ElementAdd(FilePaths, newfilenameitem); } } }