Example #1
0
        private void DragDropHelper_ItemDropped(object sender, GatesWpf.DragDrop.DragDropEventArgs e)
        {
            if (e.DropTarget.IsDescendantOf(gateCanvas) && this.IsActive)
            {
                Gate newgate = null;

                newgate = ((Gate)e.Content).CreateUserInstance();

                gateCanvas.AddGate(newgate, new GateLocation(gateCanvas.GetNearestSnapTo(gateCanvas.TranslateScrolledPoint(e.Position))));



                gateCanvas.UpdateLayout();
                gateCanvas.UpdateWireConnections();

                UndoRedo.AddGate ag = new GatesWpf.UndoRedo.AddGate(gateCanvas, newgate);

                if (gateCanvas.UndoProvider != null)
                {
                    gateCanvas.UndoProvider.Add(ag);
                }
            }
        }
Example #2
0
        private void DragDropHelper_ItemDropped(object sender, GatesWpf.DragDrop.DragDropEventArgs e)
        {
            if (e.DropTarget.IsDescendantOf(gateCanvas) && this.IsActive)
            {
                

                Gate newgate = null;

                newgate = ((Gate)e.Content).CreateUserInstance();

                
                gateCanvas.AddGate(newgate, new GateLocation(gateCanvas.GetNearestSnapTo(gateCanvas.TranslateScrolledPoint(e.Position))));
                gateCanvas.UpdateLayout();

                UndoRedo.AddGate ag = new GatesWpf.UndoRedo.AddGate(gateCanvas, newgate);
                if (gateCanvas.UndoProvider != null)
                    gateCanvas.UndoProvider.Add(ag);
                
            }
        }