예제 #1
0
        public void StartDrag(IDragInfo dragInfo)
        {
            FileNameItem filenameitem = (FileNameItem)dragInfo.SourceItem;

            dragInfo.Effects = DragDropEffects.Copy | DragDropEffects.Move;
            dragInfo.Data    = filenameitem;
        }
예제 #2
0
        private void DeleteItem(object filenameitem)
        {
            FileNameItem fni = filenameitem as FileNameItem;

            Mementor.ElementRemove(FilePaths, fni);
            FilePaths.Remove(fni);
        }
예제 #3
0
 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);
         }
     }
 }
예제 #4
0
        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;
        }
예제 #5
0
        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);
                }
            }
        }