コード例 #1
0
 public bool AllowDrop(Dictionary <string, object> items)
 {
     if (FDroppable != null)
     {
         return(FDroppable.AllowDrop(items));
     }
     else
     {
         return(false);
     }
 }
コード例 #2
0
        public bool AllowDrop(Dictionary <string, object> items)
        {
            if (FDroppable != null)
            {
                return(FDroppable.AllowDrop(items));
            }

            if (FIdItem != null)
            {
                if (FIdItem is IEditableCollection)
                {
                    object targetItem;
                    var    destination = FIdItem as IEditableCollection;
                    var    mapper      = FIdItem.Mapper;

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

                            foreach (var entry in entries)
                            {
                                if (converter.Convert(entry, out targetItem))
                                {
                                    if (destination.CanAdd(targetItem))
                                    {
                                        return(true);
                                    }
                                }
                            }
                        }
                        else if (mapper.CanMap <IConverter>())
                        {
                            var converter = mapper.Map <IConverter>();
                            if (converter.Convert(item, out targetItem))
                            {
                                return(destination.CanAdd(targetItem));
                            }
                        }
                    }
                }
            }

            return(false);
        }