Exemple #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);
        }
Exemple #2
0
        protected override bool CanDropItem(object droppedItem, DropContext context)
        {
            if (base.CanDropItem(droppedItem, context))
            {
                return(true);
            }

            return(droppedItem is IConvertible <AvailableGameViewModel>);
        }
Exemple #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));
        }
Exemple #4
0
        public bool CanDrop(IDragableSource source, DropContext context)
        {
            if (source == null)
            {
                return(false);
            }


            return(source.Items.All(droppedItem => CanDropItem(droppedItem, context)));
        }
Exemple #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));
     }
 }
Exemple #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));
        }
Exemple #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);
        }
Exemple #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)));
        }
Exemple #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));
        }
Exemple #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));
        }
Exemple #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));
        }
Exemple #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));
        }
Exemple #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);
        }
Exemple #14
0
 bool IDropable.CanDrop(IDragableSource source, DropContext context)
 {
     return(Games.CanDrop(source, context));
 }
Exemple #15
0
 bool IDropable.CanDrop(IDragableSource source, DropContext context)
 {
     return(this.Items.CanDrop(source, context));
 }
Exemple #16
0
 protected virtual bool CanDropItem(object droppedItem, DropContext context)
 {
     return(this.GetType().Equals(droppedItem.GetType()));
 }
Exemple #17
0
 DropResult IDropable.Drop(IDragableSource source, DropContext context)
 {
     return(Games.Drop(source, context));
 }