public void IsLinked(Edge sender, Point Begin, Point End) { Region reg = this.Region.Clone(); reg.Translate(Location.X, Location.Y); if (reg.IsVisible(Begin)) { sender.Link((IVariable)this); } else if (reg.IsVisible(End)) { if (!VariableList.Contains(sender)) { VariableList.Add(sender); sender.Link((ICalculate)this); } } else if (VariableList.Contains(sender)) { ICalculate Calculate = ((ICalculate)this); Calculate.RemoveVariable(sender); sender.Unlink(Calculate); } else if (!reg.IsVisible(Begin) && sender.Variable == this) { sender.Unlink((IVariable)this); } }
public void IsLinked(Edge sender, Point Begin, Point End) { Region reg = this.Region.Clone(); reg.Translate(Location.X, Location.Y); if (reg.IsVisible(End) && sender.Variable != this) { MessageBox.Show("The end of the edge can not be connected to the Leaf!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (reg.IsVisible(Begin) && sender.Variable != this) { sender.Link((IVariable)this); } else if (!reg.IsVisible(Begin) && sender.Variable == this) { sender.Unlink((IVariable)this); } }