Ejemplo n.º 1
0
        void mail_SendResult(object sender, SendResultEventArgs e)
        {
            if (e.Message == "全部发送完成")
            {
                thm.CallBackThread();
            }

            this.Invoke(new Action(() =>
            {
                DataGridViewRow row = null;
                foreach (DataGridViewRow r in dataGridView1.Rows)
                {
                    if (r.Cells[colSendMail.Name].Value.ToString() == e.Mail)
                    {
                        row = r;
                        break;
                    }
                }

                if (row == null)
                {
                    return;
                }

                row.Cells[colPress.Name].Value   = string.Format("{0}/{1}", e.Count, row.Cells[colToCount.Name].Value);
                row.Cells[colMessage.Name].Value = string.Format("{0}{1}{2}", row.Cells[colMessage.Name].Value, Environment.NewLine, e.Message);

                if (e.Message == "全部发送完成" && thm.num == 0)
                {
                    btnSend.Enabled = true;
                    btnSend.Text    = "发送邮件";
                }
            }));
        }
Ejemplo n.º 2
0
        protected virtual void OnSend(SendResultEventArgs e)
        {
            EventHandler <SendResultEventArgs> handler = SendResult;

            if (handler != null)
            {
                handler(this, e);//触发回调函数
            }
        }