Example #1
0
        protected void OnControlDeleted(object sender, ControlGate gate)
        {
            Rectangle <int> oldArea = GetGateArea();

            DisconnectControl(gate);
            ControlsChanged(this, new ControlsChangedEventArgs(oldArea, GetGateArea()));
        }
Example #2
0
        public override Rectangle <int> GetGateArea()
        {
            ControlGate topControl = Controls.Min(), bottomControl = Controls.Max();
            int         top    = topControl != null ? (topControl.FirstRow < FirstRow ? topControl.FirstRow : FirstRow) : FirstRow;
            int         bottom = bottomControl != null ? (bottomControl.FirstRow > LastRow ? bottomControl.FirstRow : LastRow) : LastRow;

            return(new Rectangle <int>(Column, top, Column, bottom));
        }
Example #3
0
        public void OnDisconnectRequested(object sender, ControlGate gate)
        {
            Rectangle <int>    oldArea = GetGateArea();
            List <ControlGate> controlsToDisconnect =
                gate.FirstRow < FirstRow?
                Controls.Where(x => x.FirstRow <= gate.FirstRow).ToList() :
                    Controls.Where(x => x.FirstRow >= gate.FirstRow).ToList();

            DisconnectControl(controlsToDisconnect);
            ControlsChanged(this, new ControlsChangedEventArgs(oldArea, GetGateArea()));
        }
Example #4
0
 private void DisconnectControl(ControlGate control)
 {
     DetachControlGateEvents(control);
     Controls.Remove(control);
     control.Disconnect();
     if (Controls.Count > 0)
     {
         GateTransformation = Circuit.TransformationReg.Register(Model.Transformation, RelativeControlIndices());
     }
     else
     {
         GateTransformation = Model.Transformation;
     }
 }
Example #5
0
 protected void DetachControlGateEvents(ControlGate gate)
 {
     gate.DisconnectRequested -= OnDisconnectRequested;
     gate.ControlDeleted      -= OnControlDeleted;
 }