// Token: 0x06003E37 RID: 15927 RVA: 0x0011D778 File Offset: 0x0011B978 internal static PropertyRecord[] GetPropertyRecordArray(DependencyObject d) { LocalValueEnumerator localValueEnumerator = d.GetLocalValueEnumerator(); PropertyRecord[] array = new PropertyRecord[localValueEnumerator.Count]; int num = 0; localValueEnumerator.Reset(); while (localValueEnumerator.MoveNext()) { LocalValueEntry localValueEntry = localValueEnumerator.Current; DependencyProperty property = localValueEntry.Property; if (!property.ReadOnly) { array[num].Property = property; array[num].Value = d.GetValue(property); num++; } } PropertyRecord[] array2; if (localValueEnumerator.Count != num) { array2 = new PropertyRecord[num]; for (int i = 0; i < num; i++) { array2[i] = array[i]; } } else { array2 = array; } return(array2); }
// Token: 0x06003E2B RID: 15915 RVA: 0x0011D5C0 File Offset: 0x0011B7C0 internal static void CreatePropertyUndoUnit(TextElement element, DependencyPropertyChangedEventArgs e) { TextContainer textContainer = element.TextContainer; UndoManager orClearUndoManager = TextTreeUndo.GetOrClearUndoManager(textContainer); if (orClearUndoManager == null) { return; } PropertyRecord propertyRecord = default(PropertyRecord); propertyRecord.Property = e.Property; propertyRecord.Value = ((e.OldValueSource == BaseValueSourceInternal.Local) ? e.OldValue : DependencyProperty.UnsetValue); orClearUndoManager.Add(new TextTreePropertyUndoUnit(textContainer, element.TextElementNode.GetSymbolOffset(textContainer.Generation) + 1, propertyRecord)); }
// Adds a TextTreePropertyUndoUnit to the open parent undo unit, if any. // Called by TextElement's property change listener. internal static void CreatePropertyUndoUnit(TextElement element, DependencyPropertyChangedEventArgs e) { UndoManager undoManager; PropertyRecord record; TextContainer textContainer = element.TextContainer; undoManager = GetOrClearUndoManager(textContainer); if (undoManager == null) return; record = new PropertyRecord(); record.Property = e.Property; record.Value = e.OldValueSource == BaseValueSourceInternal.Local ? e.OldValue : DependencyProperty.UnsetValue; undoManager.Add(new TextTreePropertyUndoUnit(textContainer, element.TextElementNode.GetSymbolOffset(textContainer.Generation) + 1, record)); }
// Adds a TextTreePropertyUndoUnit to the open parent undo unit, if any. // Called by TextElement's property change listener. internal static void CreatePropertyUndoUnit(TextElement element, DependencyPropertyChangedEventArgs e) { UndoManager undoManager; PropertyRecord record; TextContainer textContainer = element.TextContainer; undoManager = GetOrClearUndoManager(textContainer); if (undoManager == null) { return; } record = new PropertyRecord(); record.Property = e.Property; record.Value = e.OldValueSource == BaseValueSourceInternal.Local ? e.OldValue : DependencyProperty.UnsetValue; undoManager.Add(new TextTreePropertyUndoUnit(textContainer, element.TextElementNode.GetSymbolOffset(textContainer.Generation) + 1, record)); }
// Gets an array of PropertyRecords from a DependencyObject's LocalValueEnumerator. // The array is safe to cache, LocalValueEnumerators are not. internal static PropertyRecord[] GetPropertyRecordArray(DependencyObject d) { LocalValueEnumerator valuesEnumerator = d.GetLocalValueEnumerator(); PropertyRecord[] records = new PropertyRecord[valuesEnumerator.Count]; int count = 0; valuesEnumerator.Reset(); while (valuesEnumerator.MoveNext()) { DependencyProperty dp = valuesEnumerator.Current.Property; if (!dp.ReadOnly) { // LocalValueEntry.Value can be an Expression, which we can't duplicate when we // undo, so we copy over the current value from DependencyObject.GetValue instead. records[count].Property = dp; records[count].Value = d.GetValue(dp); count++; } } PropertyRecord[] trimmedResult; if (valuesEnumerator.Count != count) { trimmedResult = new PropertyRecord[count]; for (int i = 0; i < count; i++) { trimmedResult[i] = records[i]; } } else { trimmedResult = records; } return(trimmedResult); }
//------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors // Create a new undo unit instance. // symbolOffset is where property values will be set. internal TextTreePropertyUndoUnit(TextContainer tree, int symbolOffset, PropertyRecord propertyRecord) : base(tree, symbolOffset) { _propertyRecord = propertyRecord; }
// Converts array of PropertyRecords into a LocalValueEnumerator. // The array is safe to cache, LocalValueEnumerators are not. internal static LocalValueEnumerator ArrayToLocalValueEnumerator(PropertyRecord[] records) { DependencyObject obj; int i; obj = new DependencyObject(); for (i = 0; i < records.Length; i++) { obj.SetValue(records[i].Property, records[i].Value); } return obj.GetLocalValueEnumerator(); }
// Gets an array of PropertyRecords from a DependencyObject's LocalValueEnumerator. // The array is safe to cache, LocalValueEnumerators are not. internal static PropertyRecord[] GetPropertyRecordArray(DependencyObject d) { LocalValueEnumerator valuesEnumerator = d.GetLocalValueEnumerator(); PropertyRecord[] records = new PropertyRecord[valuesEnumerator.Count]; int count = 0; valuesEnumerator.Reset(); while (valuesEnumerator.MoveNext()) { DependencyProperty dp = valuesEnumerator.Current.Property; if (!dp.ReadOnly) { // LocalValueEntry.Value can be an Expression, which we can't duplicate when we // undo, so we copy over the current value from DependencyObject.GetValue instead. records[count].Property = dp; records[count].Value = d.GetValue(dp); count++; } } PropertyRecord[] trimmedResult; if(valuesEnumerator.Count != count) { trimmedResult = new PropertyRecord[count]; for(int i=0; i<count; i++) { trimmedResult[i] = records[i]; } } else { trimmedResult = records; } return trimmedResult; }
internal TableElementContentContainer(Table table, PropertyRecord []localValues, ContentContainer childContainer) : base(table.GetType(), localValues, table.Resources, childContainer) { _cpTable = table.TextContainer.Start.GetOffsetToPosition(table.ContentStart); _columns = SaveColumns(table); }
// Creates a new instance. // childContainer holds all content covered by this TextElement. internal ElementContentContainer(Type elementType, PropertyRecord[] localValues, ResourceDictionary resources, ContentContainer childContainer) { _elementType = elementType; _localValues = localValues; _childContainer = childContainer; _resources = resources; }