private void Send(string message) { var task = Task.Factory.StartNew(status => { MailHelper mail = new MailHelper(); mail.SendMailToAdminWithError(Caption, message); }, "SendMail").ContinueWith((t) => { if (t.Exception != null) log.LogMessage(t.Exception); }); task.Wait(); }
//------------------------------------------------------------------------- private void SendMailAsync(string message, string email, List<string> attachments, string caption = "") { System.Threading.Tasks.Task.Factory.StartNew(status => { MailHelper mail = new MailHelper(); mail.Attachments = attachments; if (caption == "") { if (sendToSupport) { mail.SendMailToSupport(message, email); } else { mail.SendMailToSupport(message, email, "Report test page"); } } else { mail.SendMailToSupport(message, email, caption); } }, attachments.First()).ContinueWith((t) => Completed(t)); }
//------------------------------------------------------------------------- private void SendMail(string caption = null) { Task.Factory.StartNew(status => { MailHelper mail = new MailHelper(); mail.SendMail(caption); }, "SendMail").ContinueWith((t) => Completed(t)); }