/// <summary> /// Returns the value of an enum or boolean. /// </summary> /// <param name="index">Index of the node.</param> /// <param name="propertyName">Name of the property to read.</param> /// <param name="minValue">Minimum valid value for this property upon return.</param> /// <param name="maxValue">Maximum valid value for this property upon return.</param> public virtual int GetDiscreteValue(IReadOnlyIndex index, string propertyName, out int minValue, out int maxValue) { Debug.Assert(Contains(index)); IReadOnlyNodeState State = StateTable[index]; Debug.Assert(State.ValuePropertyTypeTable.ContainsKey(propertyName)); Debug.Assert(State.ValuePropertyTypeTable[propertyName] == Constants.ValuePropertyType.Boolean || State.ValuePropertyTypeTable[propertyName] == Constants.ValuePropertyType.Enum); return(NodeTreeHelper.GetEnumValueAndRange(State.Node, propertyName, out minValue, out maxValue)); }
/// <summary> /// Replaces the selection with the content of the clipboard. /// </summary> /// <param name="isChanged">True if something was replaced or added.</param> public override void Paste(out bool isChanged) { isChanged = false; if (ClipboardHelper.TryReadInt(out int NewValue) && NewValue >= 0) { int OldValue = NodeTreeHelper.GetEnumValueAndRange(StateView.State.Node, PropertyName, out int Min, out int Max); if (OldValue != NewValue && NewValue >= Min && NewValue <= Max) { FocusController Controller = StateView.ControllerView.Controller; Controller.ChangeDiscreteValue(StateView.State.ParentIndex, PropertyName, NewValue); isChanged = true; } } }