コード例 #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));
 }