public void SetCtls(AOEntity entity) { if (InvokeRequired) { this.Invoke(new Action(() => { SetCtls(entity); })); return; } LV_AO.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; if (Convert.ToBoolean(p.GetValue(entity))) { LV_AO.Items.Add(new ListViewItem(new string[] { desc.Name, string.Format("{0}{1}", p.GetValue(entity), desc.Unit) })); } } } }
public void SetCtls(AOEntity entity) { throw new NotImplementedException(); }