public PropertyDictionaryChangeUndoUnit(DocumentCompositeNode node, IProperty propertyKey, SourceContextContainer <DocumentNode> oldValue, SourceContextContainer <DocumentNode> newValue) { this.node = node; this.propertyKey = propertyKey; this.oldValue = oldValue; this.newValue = newValue; }
private void Toggle() { this.node.ApplyPropertyChange(this.propertyKey, this.oldValue, this.newValue); SourceContextContainer <DocumentNode> contextContainer = this.oldValue; this.oldValue = this.newValue; this.newValue = contextContainer; }
public override UndoUnitMergeResult Merge(IUndoUnit otherUnit, out IUndoUnit mergedUnit) { mergedUnit = (IUndoUnit)null; SceneXamlDocument.PropertyDictionaryChangeUndoUnit dictionaryChangeUndoUnit = otherUnit as SceneXamlDocument.PropertyDictionaryChangeUndoUnit; if (dictionaryChangeUndoUnit == null || dictionaryChangeUndoUnit.node != this.node || dictionaryChangeUndoUnit.propertyKey != this.propertyKey) { return(UndoUnitMergeResult.CouldNotMerge); } if (SourceContextContainer <DocumentNode> .ContentReferenceEquals(dictionaryChangeUndoUnit.oldValue, this.newValue)) { return(UndoUnitMergeResult.MergedIntoNothing); } mergedUnit = (IUndoUnit) new SceneXamlDocument.PropertyDictionaryChangeUndoUnit(this.node, this.propertyKey, dictionaryChangeUndoUnit.oldValue, this.newValue); return(UndoUnitMergeResult.MergedIntoOneUnit); }
public override void ApplyPropertyChange(DocumentCompositeNode node, IProperty propertyKey, SourceContextContainer <DocumentNode> oldValue, SourceContextContainer <DocumentNode> newValue) { if (this.undoService != null) { this.undoService.Add((IUndoUnit) new SceneXamlDocument.PropertyDictionaryChangeUndoUnit(node, propertyKey, oldValue, newValue)); } else { base.ApplyPropertyChange(node, propertyKey, oldValue, newValue); } }