示例#1
0
        /// <summary>
        /// Occurs when an object is dragged over the item's bounds.
        /// </summary>
        /// <param name="e"></param>
        internal bool OnDragOver(Handlers.ItemDragEventArgs e)
        {
            bool result = false;

            if (dragDropHandler != null)
            {
                result |= dragDropHandler.OnDragOver(this, e);
            }
            if (DragOver != null)
            {
                DragOver(this, e);
            }
            return(result);
        }
        /// <summary>
        /// Gets the loc state from the given drag/drop event args.
        /// </summary>
        private static ILocState GetLoc(ItemDragEventArgs e)
        {
            var container = e.Data.GetData(typeof(EntityStateContainer)) as EntityStateContainer;

            if (container != null)
            {
                var locState = container.State as ILocState;
                if ((locState != null) && (locState.CurrentBlock.Actual == null))
                {
                    return(null);
                }
                return(locState);
            }
            return(null);
        }
        /// <summary>
        /// Perform drop.
        /// </summary>
        public override bool OnDragDrop(VCItem sender, ItemDragEventArgs e)
        {
            var loc = GetLoc(e);

            if (loc != null)
            {
                var blockItem = sender as BlockItem;
                if (blockItem != null)
                {
                    var blockState = blockItem.State;
                    // Are there possible sequences?
                    if (TargetBlockRouteSelector.FindRouteSequences(loc.CurrentBlock.Actual, loc.CurrentBlockEnterSide.Actual, blockState).Any())
                    {
                        loc.RouteSelector = new TargetBlockRouteSelector(blockState);
                        return(true);
                    }
                }
            }
            return(base.OnDragDrop(sender, e));
        }
示例#4
0
 /// <summary>
 /// Default ctor
 /// </summary>
 /// <param name="button"></param>
 /// <param name="clicks"></param>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="delta"></param>
 public ItemDragEventArgs(ItemDragEventArgs source, int x, int y)
     :
     base(source.Data, source.KeyState, x, y, source.AllowedEffect, source.Effect)
 {
     this.controlEventArgs = source.controlEventArgs;
 }