public PropertyState HasValue(ReferenceStep referenceStep) { PropertyReference propertyReference1 = new PropertyReference(referenceStep); object second = null; PropertyState propertyState1 = PropertyState.Unset; bool flag = false; SceneNode[] selectedNodes = this.designerContext.SelectionManager.SelectedNodes; if (selectedNodes != null && selectedNodes.Length > 0) { foreach (SceneNode node in selectedNodes) { PropertyReference propertyReference2 = this.FilterProperty(node, propertyReference1); if (propertyReference2 != null) { PropertyState propertyState2 = node.IsSet(propertyReference2); object computedValue = node.GetComputedValue(propertyReference2); if (!flag) { second = this.CopyIfFreezable(computedValue); propertyState1 = propertyState2; flag = true; } else { if (propertyState2 != propertyState1) { propertyState1 = PropertyState.Mixed; break; } if (!PropertyUtilities.Compare(computedValue, second, node.ViewModel.DefaultView)) { object obj = MixedProperty.Mixed; propertyState1 = PropertyState.Mixed; break; } } } } } if (!flag) { propertyState1 = this.designerContext.AmbientPropertyManager.GetAmbientValue(propertyReference1) == DependencyProperty.UnsetValue ? PropertyState.Unset : PropertyState.Set; } return(propertyState1); }
public object GetValue(PropertyReference propertyReference, PropertyReference.GetValueFlags flags) { object second = null; bool flag = false; SceneNode[] selectedNodes = this.designerContext.SelectionManager.SelectedNodes; if (selectedNodes != null && selectedNodes.Length > 0) { foreach (SceneNode node in selectedNodes) { PropertyReference propertyReference1 = this.FilterProperty(node, propertyReference); if (propertyReference1 != null) { object obj = (flags & PropertyReference.GetValueFlags.Computed) == PropertyReference.GetValueFlags.Local ? node.GetLocalValue(propertyReference1) : node.GetComputedValue(propertyReference1); if (!flag) { second = this.CopyIfFreezable(obj); flag = true; } else if (!PropertyUtilities.Compare(obj, second, node.ViewModel.DefaultView)) { second = MixedProperty.Mixed; break; } } } } if (!flag) { if (this.designerContext.AmbientPropertyManager.IsAmbientProperty(propertyReference)) { second = this.designerContext.AmbientPropertyManager.GetAmbientValue(propertyReference); } else { ReferenceStep referenceStep = propertyReference[propertyReference.Count - 1]; second = referenceStep.GetDefaultValue(referenceStep.TargetType); } } return(second); }
private static bool CompareFreezables(Freezable firstFreezable, Freezable secondFreezable, int depth) { if (firstFreezable == null && secondFreezable == null) { return(true); } if (firstFreezable == null || secondFreezable == null || firstFreezable.GetType() != secondFreezable.GetType()) { return(false); } IEnumerator enumerator1 = (IEnumerator)firstFreezable.GetLocalValueEnumerator(); IEnumerator enumerator2 = (IEnumerator)secondFreezable.GetLocalValueEnumerator(); while (enumerator1.MoveNext()) { if (!enumerator2.MoveNext() || !PropertyUtilities.Compare(enumerator1.Current, enumerator2.Current, depth + 1)) { return(false); } } return(!enumerator2.MoveNext()); }
public static bool Compare(object first, object second, SceneView view) { if (first == null && second == null) { return(true); } if (first == null || second == null || first.GetType() != second.GetType()) { return(false); } if (first.Equals(second)) { return(true); } if (PropertyUtilities.AreEasingFunctions(first, second, view)) { return(PropertyUtilities.CompareEasingFunctions(first, second, view)); } first = view.ConvertToWpfValue(first); second = view.ConvertToWpfValue(second); return(PropertyUtilities.Compare(first, second, 0)); }