Esempio n. 1
0
        private void BtnAddAddr_Click(object sender, RoutedEventArgs e)
        {
            string addr = emailToAdd.Text;

            if (addr == "")
            {
                return;
            }
            var task = new Task(() =>
            {
                var service = NewEmailService();
                char valid  = service.ValidateEmailAddress(addr);
                if (valid == 'Y')
                {
                    this.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        EmailAddrs.Add(addr);
                        emailToAdd.Text = "";
                    }));
                }
                else
                {
                    MessageBox.Show("Invalid email address!");
                }
            });

            task.Start();
        }
Esempio n. 2
0
 private void BtnSend_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var  service = NewEmailService();
         char res     = service.SendEmailBatch(EmailAddrs.ToArray(), Payload);
         MessageBox.Show(res == 'Y' ? "发送成功。" : "发送失败。");
     }catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }