예제 #1
0
        private void btnEliminaNonPresenti_Click(object sender, EventArgs e)
        {
            var destinatari            = AppSvc.GetDestinatariDelRecipienteCorrente();
            List <MailToSend> toRemove = new List <MailToSend>();

            foreach (var mailToSend in _elencoMailInInvio)
            {
                if (!destinatari.Any(x => x.Address?.ToLower() == mailToSend.Address?.ToLower()))
                {
                    toRemove.Add(mailToSend);
                }
            }

            foreach (var m in toRemove)
            {
                AppRepo.RemoveMailOfJob(m.Id);
                _elencoMailInInvio.Remove(m);
            }

            dataGridView1.DataSource = null;
            dataGridView1.DataSource = _elencoMailInInvio;
            //dataGridView1.Refresh();
        }