public void TextractorFunDealItem(int index, string[] Item, bool isExist) { if (isExist == true) {//表项已存在,更新 TextractorFunListView.BeginInvoke(new Action(() => { TextractorFunListView.BeginUpdate(); })); TextractorFunListView.BeginInvoke(new Action(() => { TextractorFunListView.Items[index].SubItems[3].Text = Item[3]; })); TextractorFunListView.BeginInvoke(new Action(() => { TextractorFunListView.EndUpdate(); })); } else { //缺失texthook.dll时有时会抛出异常。尚未成功捕捉到异常 //try //{ //TextractorFunListView.BeginInvoke(new Action(() => { TextractorFunListView.BeginUpdate(); })); //} //catch (Exception ex) //{ // MessageBox.Show("未找到texthook.dll,请检查应用完整性。"); // return; //} TextractorFunListView.BeginInvoke(new Action(() => { TextractorFunListView.BeginUpdate(); })); ListViewItem lvi = new ListViewItem(); lvi.Text = Item[0]; lvi.SubItems.Add(Item[1]); lvi.SubItems.Add(Item[2] + Item[4]); lvi.SubItems.Add(Item[3]); TextractorFunListView.BeginInvoke(new Action(() => { TextractorFunListView.Items.Insert(index, lvi); })); TextractorFunListView.BeginInvoke(new Action(() => { TextractorFunListView.EndUpdate(); })); } }
public void TextractorFunDealItem(int index, string[] Item, bool isExist) { if (isExist == true) {//表项已存在,更新 TextractorFunListView.BeginInvoke(new Action(() => { TextractorFunListView.BeginUpdate(); })); TextractorFunListView.BeginInvoke(new Action(() => { TextractorFunListView.Items[index].SubItems[3].Text = Item[3]; })); TextractorFunListView.BeginInvoke(new Action(() => { TextractorFunListView.EndUpdate(); })); } else { TextractorFunListView.BeginInvoke(new Action(() => { TextractorFunListView.BeginUpdate(); })); ListViewItem lvi = new ListViewItem(); lvi.Text = Item[0]; lvi.SubItems.Add(Item[1]); lvi.SubItems.Add(Item[2] + Item[4]); lvi.SubItems.Add(Item[3]); TextractorFunListView.BeginInvoke(new Action(() => { TextractorFunListView.Items.Insert(index, lvi); })); TextractorFunListView.BeginInvoke(new Action(() => { TextractorFunListView.EndUpdate(); })); } }