internal void SetValue(IEnumerable <SceneElement> elements, bool value)
        {
            if (elements == null)
            {
                throw new ArgumentNullException("elements");
            }
            this.Restore(false);
            IProperty propertyKey = LayoutRoundingHelper.ResolveUseLayoutRoundingProperty((SceneNode)Enumerable.FirstOrDefault <SceneElement>(elements));

            if (propertyKey == null)
            {
                return;
            }
            this.storedValues = new Dictionary <SceneElement, bool?>();
            foreach (SceneElement element in elements)
            {
                IViewObject viewObject = element.ViewObject;
                if (element.IsViewObjectValid && !value.Equals(viewObject.GetValue(propertyKey)) && LayoutRoundingHelper.GetLayoutRoundingStatus(element) == LayoutRoundingStatus.On)
                {
                    this.storedValues[element] = !viewObject.IsSet(propertyKey) ? new bool?() : new bool?((bool)viewObject.GetValue(propertyKey));
                    viewObject.SetValue((ITypeResolver)element.ProjectContext, propertyKey, (object)(bool)(value ? true : false));
                    LayoutRoundingOverride.InvalidateMeasure(viewObject);
                }
            }
        }
Exemple #2
0
        private static Dictionary <IPropertyId, object> StoreProperties(IPlatform platform, IViewObject viewObject, IEnumerable <IPropertyId> properties)
        {
            Dictionary <IPropertyId, object> dictionary = new Dictionary <IPropertyId, object>();

            foreach (IPropertyId propertyId in properties)
            {
                IProperty propertyKey = platform.Metadata.ResolveProperty(propertyId);
                if (propertyKey != null && viewObject.IsSet(propertyKey))
                {
                    dictionary[(IPropertyId)propertyKey] = viewObject.GetValue(propertyKey);
                }
            }
            return(dictionary);
        }