protected override void Modified(UndoRedoProperty property, object oldValue) { owner.OnListChanged( new ListChangedEventArgs2( ListChangedType.ItemChanged, index, property, oldValue)); }
/// <summary> /// Gets property owner. /// </summary> /// <param name="pd">Property descriptor.</param> /// <returns>Property owner instance.</returns> public virtual object GetPropertyOwner(PropertyDescriptor pd) { UndoRedoProperty property = pd as UndoRedoProperty; if (property != null) { return(Instance); } return(null); }
protected override void Modified(UndoRedoProperty property, object oldValue) { base.Modified(property, oldValue); EventHandler eventHandler = OnChanged; if (eventHandler != null) { eventHandler(this, EventArgs.Empty); } }
private static PropertyDescriptorCollection CreateProperties( PropertyDescriptorCollection collection) { int count = collection.Count; PropertyDescriptor[] items = new PropertyDescriptor[count]; for (int i = 0; i < count; i++) { items[i] = new UndoRedoProperty(collection[i]); } return(new PropertyDescriptorCollection(items, true)); }
/// <summary> /// Tests if two instances are equal. /// </summary> /// <param name="obj">Instance to compare with.</param> /// <returns>true if instances are equal, and false otherwise.</returns> public override bool Equals(object obj) { if (this == obj) { return(true); } UndoRedoProperty that = obj as UndoRedoProperty; if (that == null) { return(false); } return(parent.Equals(that.parent)); }
/// <summary> /// Creates an instance of the Action. /// </summary> /// <param name="owner">Owner type.</param> /// <param name="property">Property to change.</param> /// <param name="value">Value of the property.</param> public Action( UndoRedoWrapper owner, UndoRedoProperty property, object value) { if (owner == null) { throw new ArgumentNullException("owner"); } if (property == null) { throw new ArgumentNullException("property"); } this.owner = owner; this.property = property; this.value = value; }
/// <summary> /// Gets or sets property of the instance. /// Action is recorded in undo and redo manager. /// </summary> /// <param name="property">Property to get or set.</param> /// <returns>Property value.</returns> public object this[PropertyDescriptor property] { get { if (property == null) { throw new InvalidOperationException("property"); } UndoRedoProperty undoRedoProperty = property as UndoRedoProperty; if (undoRedoProperty != null) { return(undoRedoProperty.GetValue(this)); } else { return(property.GetValue(Instance)); } } set { if (property == null) { throw new InvalidOperationException("property"); } UndoRedoProperty undoRedoProperty = property as UndoRedoProperty; if (undoRedoProperty != null) { undoRedoProperty.SetValue(this, value); } else { property.SetValue(Instance, value); } } }
/// <summary> /// Occurs when propery has changed. /// </summary> /// <param name="property">Property that has changed.</param> /// <param name="oldValue">An old value of the property.</param> protected virtual void Modified(UndoRedoProperty property, object oldValue) { }
/// <summary> /// Create undo and redo property change action. /// </summary> /// <param name="property">Property to change.</param> /// <param name="value">Property value.</param> /// <returns>Instance of an action.</returns> public virtual IAction CreateAction( UndoRedoProperty property, object value) { return(new Action(this, property, value)); }
public MethodAction(UndoRedoWrapper owner, UndoRedoProperty property, object value) { this.owner = owner; this.property = property; this.value = value; }