示例#1
0
        protected virtual object DropItem(object droppedItem, DropContext context)
        {
            if (this.Equals(droppedItem))
            {
                return(droppedItem);
            }


            var theList = context.Data as System.Collections.IList;

            if (theList == null)
            {
                return(droppedItem);
            }

            if (theList.Contains(droppedItem))
            {
                theList.Remove(droppedItem);
            }

            var thisIndex = theList.IndexOf(this);

            if (context.DropLocation == DropLocation.Before)
            {
                theList.Insert(thisIndex, droppedItem);
            }
            else
            {
                theList.Insert(thisIndex + 1, droppedItem);
            }

            return(droppedItem);
        }
示例#2
0
        protected override bool CanDropItem(object droppedItem, DropContext context)
        {
            if (base.CanDropItem(droppedItem, context))
            {
                return(true);
            }

            return(droppedItem is IConvertible <AvailableGameViewModel>);
        }
示例#3
0
        protected override object DropItem(object droppedItem, DropContext context)
        {
            if (droppedItem is AvailableGameViewModel)
            {
                droppedItem = new ArenaGameViewModel(droppedItem as AvailableGameViewModel, this);
            }

            return(base.DropItem(droppedItem, context));
        }
示例#4
0
        public bool CanDrop(IDragableSource source, DropContext context)
        {
            if (source == null)
            {
                return(false);
            }


            return(source.Items.All(droppedItem => CanDropItem(droppedItem, context)));
        }
示例#5
0
 protected override object DropItem(object droppedItem, DropContext context)
 {
     if (droppedItem is ILobbyItemSource)
     {
         return(base.DropItem(new LobbyItemViewModel(droppedItem as ILobbyItemSource), context));
     }
     else
     {
         return(base.DropItem(droppedItem, context));
     }
 }
示例#6
0
        protected override object DropItem(object droppedItem, DropContext context)
        {
            var convertible = droppedItem as IConvertible <AvailableGameViewModel>;

            if (convertible != null)
            {
                droppedItem = convertible.Convert();
            }

            return(base.DropItem(droppedItem, context));
        }
示例#7
0
        protected override bool CanDropItem(object droppedItem, DropContext context)
        {
            if (base.CanDropItem(droppedItem, context))
            {
                return(true);
            }

            if (droppedItem is ILobbyItemSource)
            {
                return(true);
            }

            return(false);
        }
示例#8
0
        public bool CanDrop(IDragableSource source, DropContext context)
        {
            if (source == null)
            {
                return(false);
            }

            if (!(context.Data is System.Collections.IList))
            {
                return(false);
            }

            return(source.Items.All(item => CanDropItem(item, context)));
        }
示例#9
0
        protected virtual bool CanDropItem(object droppedItem, DropContext context)
        {
            var convertible = droppedItem as IConvertible <TItem>;

            if (typeof(TItem) != droppedItem.GetType() && convertible == null)
            {
                return(false);
            }

            if (convertible != null)
            {
                return(!this.Contains(convertible.Convert()));
            }

            return(!this.Contains((TItem)droppedItem));
        }
示例#10
0
        protected override bool CanDropItem(object droppedItem, DropContext context)
        {
            if (base.CanDropItem(droppedItem, context))
            {
                return(true);
            }

            var lobbyItemSource = droppedItem as ILobbyItemSource;

            if (lobbyItemSource == null)
            {
                return(false);
            }

            return(!this.Any(item => item.Id == lobbyItemSource.Id));
        }
示例#11
0
        public DropResult Drop(IDragableSource source, DropContext context)
        {
            if (!CanDrop(source, context))
            {
                return(new DropResult());
            }


            var finalItems = new List <object>();

            foreach (var droppedItem in source.Items)
            {
                finalItems.Add(DropItem(droppedItem, context));
            }

            return(new DropResult(finalItems));
        }
示例#12
0
        public DropResult Drop(IDragableSource source, DropContext context)
        {
            if (!CanDrop(source, context))
            {
                return(new DropResult());
            }

            var resultItems = new List <object>();

            foreach (object item in source.Items)
            {
                var finalItem = DropItem(item, context);
                if (finalItem != null)
                {
                    resultItems.Add(finalItem);
                }
            }

            return(new DropResult(resultItems));
        }
示例#13
0
        protected virtual object DropItem(object droppedItem, DropContext context)
        {
            var convertible = droppedItem as IConvertible <TItem>;

            TItem item;

            if (convertible != null)
            {
                item = convertible.Convert();
            }
            else
            {
                item = (TItem)droppedItem;
            }

            if (!this.Contains(item))
            {
                this.Add(item);
            }

            return(item);
        }
示例#14
0
 bool IDropable.CanDrop(IDragableSource source, DropContext context)
 {
     return(Games.CanDrop(source, context));
 }
示例#15
0
 bool IDropable.CanDrop(IDragableSource source, DropContext context)
 {
     return(this.Items.CanDrop(source, context));
 }
示例#16
0
 protected virtual bool CanDropItem(object droppedItem, DropContext context)
 {
     return(this.GetType().Equals(droppedItem.GetType()));
 }
示例#17
0
 DropResult IDropable.Drop(IDragableSource source, DropContext context)
 {
     return(Games.Drop(source, context));
 }