private void BindData() { long totals = 0; string strStatus = this.toolStripComboBox1.Text.Trim(); ThreadPool.QueueUserWorkItem(new WaitCallback((o) => { switch (type) { case 1: Where where = null; switch (strStatus) { case "等待发送": where = new Where().And("LastSendStatus", 0, Operator.Equal); break; case "发送成功": where = new Where().And("LastSendStatus", 1, Operator.Equal); break; case "发送失败": where = new Where().And("LastSendStatus", 2, Operator.Equal); break; default: where = null; break; } IList<EmailList> emailList = EmailListHelper.SelectPageList(page, pageSize, out totals, "", where); pages = (int)(totals / pageSize + (totals % pageSize == 0 ? 0 : 1)); EmailListobj obj1 = new EmailListobj(); obj1.list = emailList; obj1.page = page; obj1.pages = pages; obj1.totals = totals; this.Invoke(new CallFormInThread(loadData), obj1); break; case 2: IList<SmtpList> smtpList = SmtpListHelper.SelectPageList(page, pageSize, out totals); pages = (int)(totals / pageSize + (totals % pageSize == 0 ? 0 : 1)); SmtpListobj obj2 = new SmtpListobj(); obj2.list = smtpList; obj2.page = page; obj2.pages = pages; obj2.totals = totals; this.Invoke(new CallFormInThread(loadData), obj2); break; case 3: IList<IpHistory> ipList = IpHistoryHelper.SelectPageList(page, pageSize, out totals); pages = (int)(totals / pageSize + (totals % pageSize == 0 ? 0 : 1)); IpHistoryobj obj3 = new IpHistoryobj(); obj3.list = ipList; obj3.page = page; obj3.pages = pages; obj3.totals = totals; this.Invoke(new CallFormInThread(loadData), obj3); break; } }), null); }
private void BindData() { long totals = 0; listView1.View = View.Details; listView1.Columns.Clear(); listView1.Items.Clear(); listView1.BeginUpdate(); Where where = null; ThreadPool.QueueUserWorkItem(new WaitCallback((o) => { IList<EmailList> emailList = EmailListHelper.SelectPageList(page, pageSize, out totals, "", where); pages = (int)(totals / pageSize + (totals % pageSize == 0 ? 0 : 1)); EmailListobj obj1 = new EmailListobj(); obj1.list = emailList; obj1.page = page; obj1.pages = pages; obj1.totals = totals; this.Invoke(new CallFormInThread(loadData), obj1); }), null); }