private void ButtonSendImmediately_Click(object sender, RoutedEventArgs e) { if (BodyTextEmpty()) { MessageBox.Show("Mail body empty", "Error", MessageBoxButton.OK, MessageBoxImage.Error); tabControl.SelectedItem = tabItemMailEditor; return; } string login = comboBoxSenderSelect.Text; string password = comboBoxSenderSelect.SelectedValue.ToString(); if (string.IsNullOrEmpty(login)) { MessageBox.Show("Enter sender login", "Invalid input", MessageBoxButton.OK, MessageBoxImage.Information); return; } if (string.IsNullOrEmpty(password)) { MessageBox.Show("Enter sender password", "Invalid input", MessageBoxButton.OK, MessageBoxImage.Information); return; } EmailSendServiceClass emailSender = new EmailSendServiceClass(login, password); emailSender.SendMails((IQueryable <Email>)dataGridEmails.ItemsSource); }
private void Timer_Tick(object sender, EventArgs e) { if (dateTimeSend.ToShortTimeString() == DateTime.Now.ToShortTimeString()) { emailSender.SendMails(emails); timer.Stop(); MessageBox.Show("Mails sent", "Success", MessageBoxButton.OK, MessageBoxImage.Information); } }