コード例 #1
0
        private void DeserializeComplexNode(IDeserializerNode node, Reader reader)
        {
            if (TryDeserializeAsReference(node, reader))
            {
                return;
            }

            var jobj = reader.Token as JObject;

            if (jobj == null)
            {
                throw new PomonaSerializationException(
                          "Trying to deserialize to complex type, expected a JSON object type but got " + reader.Token.Type);
            }

            SetNodeValueType(node, jobj);

            if (node.Operation == DeserializerNodeOperation.Default)
            {
                node.Operation = node.Value == null ? DeserializerNodeOperation.Post : DeserializerNodeOperation.Patch;
            }

            var propertyValueSource = new PropertyValueSource(jobj, node, this);

            propertyValueSource.Deserialize();
        }
コード例 #2
0
        public void SetValueSource(PropertyInfo propertyInfo, PropertyValueSource source)
        {
            if (propertyInfo == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(propertyInfo));
            }

            _sources[propertyInfo] = source;
        }
コード例 #3
0
        public void SetValueSource(PropertyInfo propertyInfo, PropertyValueSource source)
        {
            if (propertyInfo == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(propertyInfo));
            }

            _sources[propertyInfo] = source;
        }
コード例 #4
0
        public void SetValue(ITrackValueSource target, Object value, PropertyValueSource source)
        {
            if (target == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(target));
            }

            Setter(target, value);
            SetValueSource(target, source);
        }
コード例 #5
0
        public void SetValue(ITrackValueSource target, Object value, PropertyValueSource source)
        {
            if (target == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(target));
            }

            Setter(target, value);
            SetValueSource(target, source);
        }
コード例 #6
0
        public PropertyValueSource GetValueSource(PropertyInfo propertyInfo)
        {
            if (propertyInfo == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(propertyInfo));
            }

            PropertyValueSource result = null;

            _sources.TryGetValue(propertyInfo, out result);
            return(result);
        }
コード例 #7
0
 private void SetValueSource(ITrackValueSource target, PropertyValueSource source)
 {
     target.SetValueSource(PropertyInfo, source);
 }
コード例 #8
0
            // Clear value-related things that this class caches
            public void ClearValueRelatedCacheItems() 
            {
                _subProperties = null;
                _collection = null;
                _standardValues = null;
                _standardValuesExclusive = null;
                _converter = null;
                _commonValueType = null;
                _source = null;
                _isReadOnly = null;
                _valueSerializer = null;

                ClearSubValueRelatedCacheItems();

                _parent.OnPropertyChanged("StandardValues");
                _parent.OnPropertyChanged("StandardValuesExclusive");
                _parent.OnPropertyChanged("Converter");
                _parent.OnPropertyChanged("CommonValueType");
                _parent.OnPropertyChanged("IsReadOnly");

                // The following properties are only exposed by ModelPropertyEntry, not PropertyEntry.
                // People should bind to these properties through the PropertyValue.
                // However, if they ---- up in Xaml, the binding will still work and if that happens
                // we should try to update them when things change.
                _parent.OnPropertyChanged("SubProperties");
                _parent.OnPropertyChanged("Collection");
                _parent.OnPropertyChanged("Source");
            }
コード例 #9
0
 public void SetValueSource(PropertyInfo propertyInfo, PropertyValueSource source)
 {
     _tracker.SetValueSource(propertyInfo, source);
 }
 public RunSharpBasedSecondsParameter(PropertyValueSource <int> prop)
 {
     _prop = prop;
 }
コード例 #11
0
ファイル: Parameter.cs プロジェクト: NaseUkolyCZ/HarshPoint
 public void SetValue(ITrackValueSource target, Object value, PropertyValueSource source)
     => PropertyAccessor.SetValue(target, value, source);
コード例 #12
0
 public void SetValue(ITrackValueSource target, Object value, PropertyValueSource source)
 => PropertyAccessor.SetValue(target, value, source);
コード例 #13
0
        // <summary>
        // Returns the property source based on the following heuristic (in line with
        // Blend's behavior):
        //
        // Xaml                                    Source
        // -------------------------------------------------------------------
        // "123"                                   Local
        // "{Binding}"                             DataBound
        // not specified (default value)           Default
        // not specified (inherited value)         Inherited
        // not specified (from style)              Inherited
        // "{DynamicResource ...}"                 LocalDynamicResource
        // "{StaticResource ...}"                  LocalStaticResource
        // "{x:Static ...}"                        SystemResource
        // "{TemplateBinding ...}"                 TemplateBinding
        // "{CustomMarkup ...}"                    CustomMarkupExtension
        //
        // </summary>
        // <param name="property">Property to examine</param>
        // <returns>Source of the specified property, if any</returns>
        public static PropertyValueSource GetPropertySource(ModelProperty property)
        {
            if (property == null)
            {
                return(null);
            }

            ModelItem           valueItem = property.Value;
            PropertyValueSource source    = null;

            // Binding or any other known markup extension?
            if (valueItem != null)
            {
                Type valueType = valueItem.ItemType;

                if (IsStaticExtension(valueType))
                {
                    source = DependencyPropertyValueSource.SystemResource;
                }
                else if (typeof(StaticResourceExtension).IsAssignableFrom(valueType))
                {
                    source = DependencyPropertyValueSource.LocalStaticResource;
                }
                else if (typeof(DynamicResourceExtension).IsAssignableFrom(valueType))
                {
                    source = DependencyPropertyValueSource.LocalDynamicResource;
                }
                else if (typeof(TemplateBindingExtension).IsAssignableFrom(valueType))
                {
                    source = DependencyPropertyValueSource.TemplateBinding;
                }
                else if (typeof(Binding).IsAssignableFrom(valueType))
                {
                    source = DependencyPropertyValueSource.DataBound;
                }
                else if (typeof(MarkupExtension).IsAssignableFrom(valueType))
                {
                    source = DependencyPropertyValueSource.CustomMarkupExtension;
                }
            }

            // If not, is this a local, inherited, or default value?
            if (source == null)
            {
                if (property.IsSet)
                {
                    source = DependencyPropertyValueSource.Local;
                }
                else
                {
                    object value = property.ComputedValue;

                    if (object.Equals(value, property.DefaultValue))
                    {
                        source = DependencyPropertyValueSource.DefaultValue;
                    }
                    else if (valueItem != null && valueItem.Source != property)
                    {
                        source = DependencyPropertyValueSource.Inherited;
                    }
                }
            }

            return(source);
        }
 public RunSharpBasedParameter(PropertyValueSource <T> prop)
 {
     _prop = prop;
 }
コード例 #15
0
 void ITrackValueSource.SetValueSource(PropertyInfo property, PropertyValueSource source)
 => ValueSourceTracker.SetValueSource(property, source);
コード例 #16
0
 private void SetValueSource(ITrackValueSource target, PropertyValueSource source)
 {
     target.SetValueSource(PropertyInfo, source);
 }
コード例 #17
0
 public void SetValueSource(PropertyInfo propertyInfo, PropertyValueSource source)
 {
     _tracker.SetValueSource(propertyInfo, source);
 }