Example #1
0
        void RefreshObject(object o)
        {
            if (o == null)
            {
                return;
            }

            Type type = o.GetType();

            var propertys = type.GetProperties();

            this.PropertyItemSource.Clear();

            foreach (var item in propertys)
            {
                var from = ObjectPropertyFactory.Create(item, o);

                this.PropertyItemSource.Add(from);
            }
            //this.Items.Refresh();

            //this.ItemsSource = this.PropertyItemSource;

            this.Items.Clear();

            foreach (var item in this.PropertyItemSource)
            {
                this.Items.Add(item);
            }
        }
Example #2
0
        /// <summary> 验证实体模型是否可用 </summary>
        protected bool ModelState(object obj, out string message)
        {
            var result = ObjectPropertyFactory.ModelState(obj, out List <string> errors);

            message = errors.FirstOrDefault();

            return(result);
        }
        /// <summary> 验证实体模型是否可用 </summary>
        public bool ModelState(object obj, out string message)
        {
            var results = ObjectPropertyFactory.ModelState(obj);

            message = results.FirstOrDefault();

            return(results.Count == 0);
        }
Example #4
0
        void RefreshObject(object o)
        {
            Type type = o.GetType();

            var propertys = type.GetProperties();

            this.PropertyItemSource.Clear();

            foreach (var item in propertys)
            {
                var from = ObjectPropertyFactory.Create(item, o);

                this.PropertyItemSource.Add(from);
            }

            this.ItemsSource = this.PropertyItemSource;
        }
Example #5
0
 public bool ModelState(out List <string> errors)
 {
     return(ObjectPropertyFactory.ModelState(this.SelectObject, out errors));
 }