public static void InitializeReport(Exception e, Assembly allembly) { ErrorReport report = new ErrorReport(e, allembly); report.MakeErrorReport(); #if Mobile try { MessageBox.Show(@"The application has unexpectantly crashed and will be closed. A Report has been generated and saved to:" + report.ReportDirectory); } catch { } //System.Diagnostics.Process.Start("\\Windows\\explorer.exe", report.ReportDirectory); #endif #if !Mobile ErrorDisplayWindow view = new ErrorDisplayWindow(report); //ErrorWindowLogic logic = new ErrorWindowLogic(view, e.Exception); view.ShowDialog(); #endif Application.Exit(); }
internal void Send(ErrorReport report) { //StringBuilder builder = new StringBuilder(); //string reportMessage = string.Format("{0}%20{1}", report.ExceptionInfo, report.Exception.ToString()); //builder.AppendFormat("mailto:{0}?subject={1}&body={2}", this.To, this.Subject, reportMessage); ////if(!string.IsNullOrEmpty(UseAttachment)) ////{ //// builder.AppendFormat("&attachment={0}", UseAttachment); ////} //builder.Replace(System.Environment.NewLine.ToString(), "%0A"); //builder.Replace(" ", "%20"); //builder.Replace("&", ""); //System.Diagnostics.Process.Start(builder.ToString()); SmtpClient client = new System.Net.Mail.SmtpClient(); using(MailMessage message = new MailMessage()) { client.Host = this.SmtpServer; client.Port = this.Port; client.EnableSsl = this.UseSsl; message.CC.Add(this.Cc); message.Bcc.Add(this.Bcc); message.Priority = this.Priority; message.To.Add(this.To); message.ReplyTo = new MailAddress(this.ReplyTo); message.From = new MailAddress(this.From, this.FromName); message.Subject = this.Subject; ////add report file? //if(!string.IsNullOrEmpty(this.UseAttachment)) //{ // message.Attachments.Add(new Attachment(this.UseAttachment)) //} message.Body = report.ToString(); client.Send(message); System.Diagnostics.Trace.TraceInformation("Submitted error report via email to: " + this.To); } }
public ErrorDisplayWindow(ErrorReport report) { Report = report; InitializeComponent(); this.linkLabel1.Text = Report.ReportDirectory; }
public ErrorWindowLogic(IErrorWindowView view, ErrorReport report) { _view = view; _view.Presenter = this; Report = report; }
public ErrorDisplayWindow(ErrorReport report) { Report = report; InitializeComponent(); this.linkLabel1.Text = Report.ReportDirectory; }
public ErrorWindowLogic(IErrorWindowView view, ErrorReport report) { _view = view; _view.Presenter = this; Report = report; }