/// <summary> /// Method for remove the selected mail message. /// </summary> public void DeleteAllMessages() { Facade facade = Facade.GetInstance(); DataGridViewRowCollection rows = this.dataGridView.Rows; for (int i = rows.Count - 1; i >= 0; i--) { MailMessage mailMessage = (MailMessage)rows[i].DataBoundItem; facade.DeleteMessage(mailMessage, Constants.Inbox); this.dataGridView.Rows.Remove(rows[i]); } }
/// <summary> /// Method for remove the selected mail message. /// </summary> public void DeleteSelectedMessage() { Facade facade = Facade.GetInstance(); string mailbox = MainForm.GetInstance().GetSelectedMailbox(); DataGridViewSelectedRowCollection rows = this.dataGridView.SelectedRows; for (int i = rows.Count - 1; i >= 0; i--) { MailMessage mailMessage = (MailMessage)rows[i].DataBoundItem; facade.DeleteMessage(mailMessage, mailbox); this.dataGridView.Rows.Remove(rows[i]); } this.Refresh(); }