private void UpdateUI(bool autoWeld = false) { historiesList.Items.Clear(); var db = new DataProcess(); if (autoWeld) { var list = db.AutoWeldHistoryList(); if (Histories == null) { Histories = new List <History>(); } else { Histories.Clear(); } list.ForEach((item) => { Histories.Add(item); }); Text = "控制记录"; } else { Histories = db.HistoryList(); Text = "焊接历史"; } Histories.ForEach((history) => { var name = history.Name.Trim(); var defaultName = autoWeld ? "(未命名控制记录)" : "(未命名焊接记录)"; historiesList.Items.Add(name.Length == 0 ? defaultName : name); }); ShowHistory(); }
private void UpdateUI(bool autoWeld = false) { historiesList.Items.Clear(); var db = new DataProcess(); if (autoWeld) { var list = db.AutoWeldHistoryList(); if (Histories == null) { Histories = new List<History>(); } else { Histories.Clear(); } list.ForEach((item) => { Histories.Add(item); }); Text = "控制记录"; } else { Histories = db.HistoryList(); Text = "焊接历史"; } Histories.ForEach((history) => { var name = history.Name.Trim(); var defaultName = autoWeld ? "(未命名控制记录)" : "(未命名焊接记录)"; historiesList.Items.Add(name.Length == 0 ? defaultName : name); }); ShowHistory(); }