protected virtual void OnSend(SendResultEventArgs e) { EventHandler <SendResultEventArgs> handler = SendResult; if (handler != null) { handler(this, e);//触发回调函数 } }
//private void BindData() //{ // if (chkContact.Checked) // dataGridView1.DataSource = datas.Where(a => string.IsNullOrEmpty(a.联系时间)); // else // dataGridView1.DataSource = datas; // dataGridView1.Refresh(); //} private void F_SendResult(object sender, SendResultEventArgs e) { this.Invoke(new Action(() => { label1.Text = e.ToString(); progressBar1.Maximum = e.totalCount; progressBar1.Value = e.current; button1.Enabled = e.isok; groupBox1.Enabled = e.isok; if (e.data != null) { //datas.Add(e.data); //if (dataGridView1.DataSource == null) //{ // dataGridView1.DataSource = datas; //} //else //{ // dataGridView1.DataSource = datas; // dataGridView1.Refresh(); //} string[] row = { e.data.ShopID, e.data.店铺名称, e.data.等级, e.data.商品数量.ToString(), e.data.销量.ToString(), e.data.是否在线, e.data.联系时间, e.data.店铺地址, e.data.旺旺名称, e.data.旺旺地址 }; dataGridView1.Rows.Add(row); //var i = dataGridView1.Rows.Add(); //dataGridView1.Rows[i].Cells[col商品数量.Name].Value = e.data.商品数量.ToString(); //dataGridView1.Rows[i].Cells[colShopID.Name].Value = e.data.ShopID; //dataGridView1.Rows[i].Cells[col店铺名称.Name].Value = e.data.店铺名称; //dataGridView1.Rows[i].Cells[col店铺地址.Name].Value = e.data.店铺地址; //dataGridView1.Rows[i].Cells[col旺旺名称.Name].Value = e.data.旺旺名称; //dataGridView1.Rows[i].Cells[col旺旺地址.Name].Value = e.data.旺旺地址; //dataGridView1.Rows[i].Cells[col是否在线.Name].Value = e.data.是否在线; //dataGridView1.Rows[i].Cells[col等级.Name].Value = e.data.等级; //dataGridView1.Rows[i].Cells[col联系时间.Name].Value = e.data.联系时间; //dataGridView1.Rows[i].Cells[col销量.Name].Value = e.data.销量.ToString(); } })); }