예제 #1
0
 public void SetCtls(BaseStatusEntity entity)
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new Action(() => {
             SetCtls(entity);
         }));
         return;
     }
     txt_open.Clear();
     txt_open.Text = string.Format("燃料类型:{0}\r\n介质类型:{1}\r\n运行状态:{2}\r\n设定状态:{3}\r\n当前时间:{4:yy-MM-dd HH:mm:ss}",
                                   entity.TheFuelType, entity.TheMediumType, entity.TheRunStatus, entity.TheSettingStutus, entity.Now);
 }
예제 #2
0
        public void SetCtls(BaseStatusEntity entity)
        {
            if (InvokeRequired)
            {
                this.Invoke(new Action(() =>
                {
                    SetCtls(entity);
                }));
                return;
            }
            LV_Base.Items.Clear();
            var properties = entity.GetType().GetProperties();

            foreach (var p in properties)
            {
                var attr = Attribute.GetCustomAttribute(p, typeof(DescriptionAttribute));
                if (null != attr)
                {
                    var desc = (DescriptionAttribute)attr;
                    LV_Base.Items.Add(new ListViewItem(new string[] { desc.Name, string.Format("{0}", p.GetValue(entity)) }));
                }
            }
        }