//-------------------------------------------------------------------------------------------------- #endregion #region Operands public bool AddOperand(IShapeOperand operandShape) { Operands.Add(operandShape); operandShape.AddDependent(this); RaisePropertyChanged("ChildCount"); Invalidate(); return(true); }
//-------------------------------------------------------------------------------------------------- public virtual bool ReplaceOperand(int operandIndex, IShapeOperand operandShape) { Debug.Assert(operandIndex < Operands.Count); Debug.Assert(operandShape != null); if (!CanReplaceOperand(operandIndex)) { return(false); } var oldOp = Operands[operandIndex]; oldOp?.RemoveDependent(this); Operands[operandIndex] = operandShape; operandShape.AddDependent(this); RaisePropertyChanged("ChildCount"); Invalidate(); return(true); }