private static DialogResult Show(ErrorBox eb) { System.Diagnostics.Debug.WriteLine(eb.Text); System.Diagnostics.Debug.WriteLine(eb.rtb_Message.Text); if (eb.parent != null) { eb.Left = eb.parent.Left + (eb.parent.Width / 2) - (eb.Width / 2); eb.Top = eb.parent.Top + (eb.parent.Height / 2) - (eb.Height / 2); } else { eb.StartPosition = FormStartPosition.CenterScreen; } Console.Beep(440, 200); try { return(eb.ShowDialog()); } catch { return(DialogResult.None); } }
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())); }