예제 #1
0
        static void InitializeExceptionHandler(UnhandledExceptionDlg exDlg)
        {
            exDlg.UserPrefChecked = false;

            // Add handling of OnShowErrorReport.
            // If you skip this then link to report details won't be showing.
            exDlg.OnShowErrorReportClick += delegate(object sender, SendExceptionClickEventArgs ar)
            {
                MessageBox.Show("[Message]\r\n" + ar.UnhandledException.Message + "\r\n\r\n"
                     + "[Version]\r\n" + Application.ProductVersion + "\r\n\r\n"
                     + "[WinVer]\r\n" + Environment.OSVersion.VersionString + "\r\n\r\n"
                     + "[Platform]\r\n" + Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE") + "\r\n\r\n"
                     + "[StackTrace]\r\n" + PathScrubber.Scrub(ar.UnhandledException.ToString()) + "\r\n\r\n");
            };

            // Add handling of OnCopytoClipbooard
            // if you skip, the button is disabled
            exDlg.OnCopyToClipboardClick += delegate(object sender, SendExceptionClickEventArgs ar)
            {
                try
                {
                    // TUT: needs to be STA apt. thread for accessing clipboard
                    System.Threading.Thread clipThread = new System.Threading.Thread(delegate()
                    {
                        String body = Localizer.GetString("ErrorDescription");
                        body += "\r\n\r\n[Description]\r\n\r\n\r\n\r\n";
                        body += "[Message]\r\n" + ar.UnhandledException.Message + "\r\n\r\n";
                        body += "[Version]\r\n" + Application.ProductVersion + "\r\n\r\n";
                        body += "[WinVer]\r\n" + Environment.OSVersion.VersionString + "\r\n\r\n";
                        body += "[Platform]\r\n" + Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE") + "\r\n\r\n";
                        body += "[StackTrace]\r\n" + PathScrubber.Scrub(ar.UnhandledException.ToString()) + "\r\n\r\n";

                        Clipboard.SetText(body);
                    });
                    clipThread.SetApartmentState(System.Threading.ApartmentState.STA);
                    clipThread.Start();
                }
                catch (Exception)
                {
                    // Ignore
                }
            };

            // Implement your sending protocol here. You can use any information from System.Exception
            exDlg.OnSendExceptionClick += delegate(object sender, SendExceptionClickEventArgs ar)
            {
                // User clicked on "Send Error Report" button:
                if (ar.SendExceptionDetails)
                {
                    String body = Localizer.GetString("ErrorDescription");
                    body += "\r\n\r\n[Description]\r\n\r\n\r\n\r\n";
                    body += "[Message]\r\n" + ar.UnhandledException.Message + "\r\n\r\n";
                    body += "[Version]\r\n" + Application.ProductVersion + "\r\n\r\n";
                    body += "[WinVer]\r\n" + Environment.OSVersion.VersionString + "\r\n\r\n";
                    body += "[Platform]\r\n" + Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE") + "\r\n\r\n";
                    body += "[StackTrace]\r\n" + PathScrubber.Scrub(ar.UnhandledException.ToString()) + "\r\n\r\n";

                    MapiMailMessage message = new MapiMailMessage(@"inSSIDer 2 Error Report", body);
                    message.Recipients.Add("*****@*****.**");
                    message.ShowDialog(true);
                }

                Application.Exit();
            };
        }
예제 #2
0
 /// <summary>
 /// Adds a new recipient with the specified address, display name and recipient type to this collection.
 /// </summary>
 public void Add(string address, string displayName, MapiMailMessage.RecipientType recipientType)
 {
     this.Add(new Recipient(address, displayName, recipientType));
 }
예제 #3
0
 /// <summary>
 /// Creates a new recipient with the specified address, display name and recipient type.
 /// </summary>
 public Recipient(string address, string displayName, MapiMailMessage.RecipientType recipientType)
 {
     Address = address;
     DisplayName = displayName;
     RecipientType = recipientType;
 }
예제 #4
0
 /// <summary>
 /// Adds a new recipient with the specified address and recipient type to this collection.
 /// </summary>
 public void Add(string address, MapiMailMessage.RecipientType recipientType)
 {
     this.Add(new Recipient(address, recipientType));
 }
예제 #5
0
 /// <summary>
 /// Creates a new recipient with the specified address and recipient type.
 /// </summary>
 public Recipient(string address, MapiMailMessage.RecipientType recipientType)
 {
     Address = address;
     RecipientType = recipientType;
 }