public virtual void OnDrop(DragEventArgs args)
 {
     if (Dropped != null)
     {
         Dropped(args);
     }
 }
Beispiel #2
0
        public static Limaki.View.DragDrop.DragEventArgs ToXwt(this System.Windows.Forms.DragEventArgs args, System.Windows.Forms.Control control)
        {
            var pt     = control.PointToClient(new System.Drawing.Point(args.X, args.Y));
            var result = new Limaki.View.DragDrop.DragEventArgs(pt.ToXwt(), new SwfTransferDataStore(args.Data), args.Effect.ToXwt())
            {
            };

            return(result);
        }
Beispiel #3
0
 public void OnDrop(DragEventArgs e)
 {
 }
        public override void Dropped(DragEventArgs e)
        {
            var pt     = Camera.ToSource(e.Position);
            var scene  = this.Scene;
            var target = scene.Hovered ?? HitTestFocused(e.Position);

            IVisual item = null;

            if (Dragging && Dropping)
            {
                // the current Drop has started in this instance
                // so we make a link
                if (target != null && Source != target)
                {
                    SceneExtensions.CreateEdge(scene, Source, target);
                }
                e.Success = true;
                return;
            }

            if (InprocDragDrop.Dragging)
            {
                var source = InprocDragDrop.Data as GraphCursor <IVisual, IVisualEdge>;
                if (source != null && source.Cursor != target)
                {
                    item = Mesh.LookUp(source.Graph, scene.Graph, source.Cursor);
                    if (item == null)
                    {
                        //TODO: error here
                        //return;
                    }
                }
            }

            if (item == null)
            {
                item = DragDropViz.VisualOfTransferData(scene.Graph, e.Data);
                if (item != null)
                {
                    item.Location = pt;
                }
            }

            if (item != null)
            {
                SceneExtensions.AddItem(scene, item, Layout, pt);
                if (target != null && !scene.Graph.Edges(target).Any(edge => edge.Leaf == item || edge.Root == item))
                {
                    SceneExtensions.CreateEdge(scene, target, item);
                }
            }
            else
            {
                // no known type found to import
                string dt = "not found:\t";
            }

            InprocDragDrop.Data     = null;
            InprocDragDrop.Dragging = false;
            Dragging = false;
        }