Esempio n. 1
0
 public void DropItems(Dictionary <string, object> items, System.Drawing.Point pt)
 {
     if (FDroppable != null)
     {
         FDroppable.DropItems(items, pt);
     }
 }
Esempio n. 2
0
        public void DropItems(Dictionary <string, object> items, Point pt)
        {
            if (FDroppable != null)
            {
                FDroppable.DropItems(items, pt);
            }

            if (FIdItem != null)
            {
                if (FIdItem is IEditableIDList)
                {
                    IIDItem targetItem;
                    var     destination    = FIdItem as IEditableIDList;
                    var     mapper         = FIdItem.Mapper;
                    var     commandHistory = mapper.Map <ICommandHistory>();

                    foreach (var item in items.Values)
                    {
                        if (item is string[] && mapper.CanMap <IConverter>())
                        {
                            var entries   = item as string[];
                            var converter = mapper.Map <IConverter>();
                            var command   = new CompoundCommand();

                            foreach (var entry in entries)
                            {
                                if (converter.Convert(entry, out targetItem))
                                {
                                    if (destination.CanAdd(targetItem))
                                    {
                                        command.Append(CreateAddCommand(destination, targetItem));
                                    }
                                }
                            }

                            commandHistory.Insert(command);
                            break;
                        }
                        else if (mapper.CanMap <IConverter>())
                        {
                            var converter = mapper.Map <IConverter>();
                            if (converter.Convert(item, out targetItem))
                            {
                                if (destination.CanAdd(targetItem))
                                {
                                    var command = CreateAddCommand(destination, targetItem);
                                    commandHistory.Insert(command);
                                }
                            }
                        }
                    }
                }
            }
        }