private void runToolBtn_Click(object sender, EventArgs e) { IfParseMail pMail = null; mailDataTable = DefineTable(); if (origDataTable != null && origDataTable.Rows.Count > 0) { Int64 i = 1; foreach (DataRow dr in origDataTable.Rows) { string htmlBody = (string)dr[1]; string stringSendTime = (string)dr[2]; DateTime sendTime = DateTime.ParseExact(stringSendTime, "yyyy-MM-dd HH:mm", null); DataRow dataRow = mailDataTable.NewRow(); pMail = getMailParser(htmlBody, sendTime); if (pMail == null) { continue; } object[] row = pMail.Parse((string)dr[0], htmlBody); if (string.IsNullOrEmpty((string)row[5])) continue; row[0] = i; row[11] = stringSendTime; row[12] = pMail.getType(); dataRow.ItemArray = row; mailDataTable.Rows.Add(dataRow); i++; } } this.saveToolBtn.Enabled = true; this.saveToolStripMenuItem.Enabled = true; if (mailForm == null) { mailForm = new MailForm(); mailForm.MdiParent = this; mailForm.WindowState = FormWindowState.Maximized; mailForm.FormClosed += new FormClosedEventHandler(mailForm_FormClosed); mailForm.setDataGrigViewContext(mailDataTable); mailForm.Show(); } else { mailForm.setDataGrigViewContext(mailDataTable); mailForm.Activate(); mailForm.WindowState = FormWindowState.Maximized; mailForm.Focus(); } }
void mailForm_FormClosed(object sender, FormClosedEventArgs e) { mailForm.Dispose(); mailForm = null; }