public void Restore(bool forceClearPropertyInspector)
        {
            if (this.storedValues == null)
            {
                return;
            }
            IProperty propertyKey = LayoutRoundingHelper.ResolveUseLayoutRoundingProperty((SceneNode)Enumerable.FirstOrDefault <SceneElement>((IEnumerable <SceneElement>) this.storedValues.Keys));

            if (propertyKey != null)
            {
                foreach (KeyValuePair <SceneElement, bool?> keyValuePair in this.storedValues)
                {
                    IViewObject viewObject = keyValuePair.Key.ViewObject;
                    if (keyValuePair.Key.IsViewObjectValid)
                    {
                        bool?nullable = keyValuePair.Value;
                        if (nullable.HasValue)
                        {
                            viewObject.SetValue((ITypeResolver)keyValuePair.Key.ProjectContext, propertyKey, (object)(bool)(nullable.Value ? true : false));
                        }
                        else
                        {
                            viewObject.ClearValue(propertyKey);
                            if (forceClearPropertyInspector)
                            {
                                LayoutRoundingOverride.ForceClearPropertyInspector((IPropertyId)propertyKey, keyValuePair.Key);
                            }
                        }
                        LayoutRoundingOverride.InvalidateMeasure(viewObject);
                    }
                }
            }
            this.storedValues = (Dictionary <SceneElement, bool?>)null;
        }
Esempio n. 2
0
 private static void RestoreProperties(ITypeResolver typeResolver, IViewObject viewObject, IEnumerable <IPropertyId> storedProperties, Dictionary <IPropertyId, object> values)
 {
     foreach (IPropertyId propertyId in storedProperties)
     {
         IProperty propertyKey = typeResolver.ResolveProperty(propertyId);
         if (propertyKey != null)
         {
             object obj;
             if (values.TryGetValue((IPropertyId)propertyKey, out obj))
             {
                 viewObject.SetValue(typeResolver, propertyKey, obj);
             }
             else
             {
                 viewObject.ClearValue(propertyKey);
             }
         }
     }
 }