public static void ShowLastWin32ErrorIfNotSuccess() { int error_code = Marshal.GetLastWin32Error(); if (error_code != 0) { ErrorBox.Show(new Win32Exception(error_code)); } }
private void MailSentChanged(object sender, SentChangedEventArgs e) { if (e.Sent) { InfoBox.Show(Str_SentSuccessful, Str_ErrorReportHasBeenSent); } else { ErrorBox.Show(Str_SentFailed, new NotDetailedException(e.Exception.Message)); } }
public static void EmailSentChanged(SentChangedEventArgs e) { if (e == null) { throw new ArgumentNullException("e"); } if (!e.Sent) { ErrorBox.Show("E-mail sent error", new ExceptionDetails(e.Exception).Details); } else { InfoBox.Show("E-mail succesfully sent", "E-mail sent was succesfully to target e-mail address"); } }
private void btn_SendToClipboard_Click(object sender, EventArgs e) { try { /*Thread.CurrentThread.SetApartmentState(ApartmentState.STA); * Clipboard.SetText(rtb_Message.Text);*/ rtb_Message.SelectAll(); rtb_Message.Focus(); SendKeys.Send("^(C)"); //rtb_Message.Select(0, 0); } catch (Exception ex) { ErrorBox.Show(ex); } }
private void btn_Send_Click(object sender, EventArgs e) { try { if (tb_SMTP_Server.Text == String.Empty) { throw new Exception(Str_SMTPServerNotSet); } SendMail mailer; if (SendErrorReport.SmtpServer == null) { if (!chk_Authentication.Checked) { mailer = new SendMail(tb_SMTP_Server.Text, chk_SSL.Checked, (int)nud_Port.Value); } else { mailer = new SendMail(tb_SMTP_Server.Text, chk_SSL.Checked, (int)nud_Port.Value, tb_Username.Text, tb_Password.Text); } mailer.ForceSmtpAuthentication = chk_ForceAuthentication.Checked; mailer.SmtpAuthentication = (SmtpAuthentication)cb_ForceAuthentication.SelectedIndex; mailer.SentChanged += MailSentChanged; mailer.Send(tb_From.Text, tb_To.Text, tb_Title.Text, rtb_Message.Text); } else { mailer = new SendMail(SendErrorReport.SmtpServer); mailer.Send(tb_From.Text, tb_To.Text, tb_Title.Text, rtb_Message.Text); } } catch (Exception ex) { ErrorBox.Show(Str_SentFailed, new NotDetailedException(ex.Message)); } }
public static void ShowLastWin32Error() { ErrorBox.Show(new Win32Exception(Marshal.GetLastWin32Error())); }