private void SetPotentialErrorList(ParmWarper <Models.Feedback.OBDError[]> errors) { var items = errors.Parm.Select(m => { var item = new ListViewItem(m.Code); string content = FaultCodeDic.ContainsKey(m.Code) ? FaultCodeDic[m.Code] : "Unknow Error"; item.SubItems.Add(new ListViewItem.ListViewSubItem(item, content)); item.ToolTipText = content; return(item); }).ToArray(); lvPotential.Items.Clear(); lvPotential.Items.AddRange(items); btnRefresh.Enabled = true; }
private void SetErrorsList(ParmWarper <Models.Feedback.OBDError[]> errors) { //errors.Parm = new Models.Feedback.OBDError[]{ // new Models.Feedback.OBDError(){Code="P0010"}, // new Models.Feedback.OBDError(){Code="P2029"}, // new Models.Feedback.OBDError(){Code="U0022"}, // new Models.Feedback.OBDError(){Code="U0023"}, // new Models.Feedback.OBDError(){Code="U0024"}, // new Models.Feedback.OBDError(){Code="P2029"}, // new Models.Feedback.OBDError(){Code="U0021"}, // new Models.Feedback.OBDError(){Code="B0090"}, //}; var items = errors.Parm.Select(m => { var item = new ListViewItem(m.Code); string content = FaultCodeDic.ContainsKey(m.Code) ? FaultCodeDic[m.Code] : "Unknow Error"; item.SubItems.Add(new ListViewItem.ListViewSubItem(item, content)); item.ToolTipText = content; return(item); }).ToArray(); lvErrors.Items.Clear(); lvErrors.Items.AddRange(items); }