public static string GetChangeDescription(SILayout layout, ILayoutChange change) { string changeDesc; if (change is BatchChange batchChange) { changeDesc = GetBatchDescription(layout, batchChange); if (!string.IsNullOrEmpty(changeDesc)) { return(changeDesc); } } else if (change is PropertyChange propertyChange) { changeDesc = GetPropertyDescription(layout, propertyChange); if (!string.IsNullOrEmpty(changeDesc)) { return(changeDesc); } } else if (change is CollectionChange collection) { changeDesc = GetCollectionDescription(layout, collection); if (!string.IsNullOrEmpty(changeDesc)) { return(changeDesc); } } return("Unnamed Change"); }
internal void NotifyLayoutChanged(ILayoutChange change) { if (!(IsLoading || IsAssigningProperties)) { if (CurrentBatchChanges != null) { CurrentBatchChanges.Add(change); } else { OnLayoutChanged(new LayoutChangedEventArgs(change)); } } }
private void ApplyLayoutChange(ILayoutChange change, bool setNewValue) { if (change is PropertyChange propertyChange) { ApplyPropertyChange(propertyChange, setNewValue); } else if (change is CollectionChange collectionChange) { ApplyCollectionChange(collectionChange, setNewValue); } else if (change is BatchChange batchChange) { var allChanges = batchChange.LayoutChanges.ToList(); if (!setNewValue) { allChanges.Reverse(); } foreach (var changeInfo in allChanges) { ApplyLayoutChange(changeInfo, setNewValue); } } }
//public PropertyChange[] ChangedProperties => Change.GetChanges(); //public IEnumerable<LayoutComponent> ChangedComponents => ChangedProperties.Select(p => p.Component).Distinct(); public LayoutChangedEventArgs(ILayoutChange change) { Change = change; }
public void RedoChange(ILayoutChange change) { ApplyLayoutChange(change, true); }
public void UndoChange(ILayoutChange change) { ApplyLayoutChange(change, false); }
private string GetActionName(ILayoutChange action) { return(LayoutChangeTranslator.GetChangeDescription(CurrentLayoutDocument.Layout, action)); }