Esempio n. 1
0
        public VM_EntityProperty_BlockName(Models.EntityPropertyConfig config, EntityInfo info) : base(config, info)
        {
            var br = _info as BlockInfo;

            Title = br.IsDynamicBlock ? "动态块":_config.Title;
            Value = _info.GetType().GetProperty(_config.ProperyName)?.GetValue(_info)?.ToString();
        }
Esempio n. 2
0
        public VM_EntityProperty(Models.EntityPropertyConfig config, EntityInfo info)
        {
            _config = config;
            _info   = info;
            Title   = _config.Title;
            var p = _info.GetType().GetProperty(_config.ProperyName);

            if (p != null)
            {
                var v = p.GetValue(_info);
                if (v != null)
                {
                    if (p.PropertyType == typeof(double) || p.PropertyType == typeof(double?))
                    {
                        Value = string.Format(_config.ValueFormat, (double)v * _config.ValueRatio);
                    }
                    else
                    {
                        Value = v.ToString();
                    }
                }
            }
        }