Ejemplo n.º 1
0
        public virtual void CopyFrom(BindableObject other)
        {
            if (null == other)
            {
                return;
            }

            Type type1 = this.GetType();

            BindableProperty.GetBindablePropertysOfType(type1, out var nameToBindableProperty1);

            Type type2 = other.GetType();

            BindableProperty.GetBindablePropertysOfType(type2, out var nameToBindableProperty2);

            if (null != nameToBindableProperty1)
            {
                foreach (KeyValuePair <string, BindableProperty> keyValuePair in nameToBindableProperty1)
                {
                    nameToBindableProperty2.TryGetValue(keyValuePair.Key, out var bindableProperty);

                    if (null != bindableProperty && (ChangedPropertiesSet.Contains(bindableProperty) || other.ChangedPropertiesSet.Contains(bindableProperty)))
                    {
                        object value = other.GetValue(bindableProperty);

                        if (null != value)
                        {
                            InternalSetValue(keyValuePair.Value, value);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public virtual void CopyFrom(BindableObject other)
        {
            if (null == other)
            {
                return;
            }

            Type type1 = this.GetType();

            BindableProperty.GetBindablePropertysOfType(type1, out var nameToBindableProperty1);

            Type type2 = other.GetType();

            BindableProperty.GetBindablePropertysOfType(type2, out var nameToBindableProperty2);

            if (null != nameToBindableProperty1)
            {
                foreach (KeyValuePair <string, BindableProperty> keyValuePair in nameToBindableProperty1)
                {
                    nameToBindableProperty2.TryGetValue(keyValuePair.Key, out var bindableProperty);

                    if (null != bindableProperty)
                    {
                        object value = other.GetValue(bindableProperty);

                        if (AllowNullCopy || null != value)
                        {
                            SetValue(keyValuePair.Value, value);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public virtual void CopyFrom(BindableObject that)
        {
            if (null != that)
            {
                Dictionary <string, BindableProperty> nameToBindableProperty1;
                Type type1 = this.GetType();
                BindableProperty.GetBindablePropertysOfType(type1, out nameToBindableProperty1);

                Dictionary <string, BindableProperty> nameToBindableProperty2;
                Type type2 = that.GetType();
                BindableProperty.GetBindablePropertysOfType(type2, out nameToBindableProperty2);

                if (null != nameToBindableProperty1)
                {
                    foreach (KeyValuePair <string, BindableProperty> keyValuePair in nameToBindableProperty1)
                    {
                        BindableProperty bindableProperty;
                        nameToBindableProperty2.TryGetValue(keyValuePair.Key, out bindableProperty);

                        if (null != bindableProperty)
                        {
                            object value = that.GetValue(bindableProperty);

                            if (null != value)
                            {
                                SetValue(keyValuePair.Value, value);
                            }
                        }
                    }
                }
            }
        }