Ejemplo n.º 1
0
        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");
        }
Ejemplo n.º 2
0
 internal void NotifyLayoutChanged(ILayoutChange change)
 {
     if (!(IsLoading || IsAssigningProperties))
     {
         if (CurrentBatchChanges != null)
         {
             CurrentBatchChanges.Add(change);
         }
         else
         {
             OnLayoutChanged(new LayoutChangedEventArgs(change));
         }
     }
 }
Ejemplo n.º 3
0
        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);
                }
            }
        }
Ejemplo n.º 4
0
        //public PropertyChange[] ChangedProperties => Change.GetChanges();

        //public IEnumerable<LayoutComponent> ChangedComponents => ChangedProperties.Select(p => p.Component).Distinct();

        public LayoutChangedEventArgs(ILayoutChange change)
        {
            Change = change;
        }
Ejemplo n.º 5
0
 public void RedoChange(ILayoutChange change)
 {
     ApplyLayoutChange(change, true);
 }
Ejemplo n.º 6
0
 public void UndoChange(ILayoutChange change)
 {
     ApplyLayoutChange(change, false);
 }
Ejemplo n.º 7
0
 private string GetActionName(ILayoutChange action)
 {
     return(LayoutChangeTranslator.GetChangeDescription(CurrentLayoutDocument.Layout, action));
 }