コード例 #1
0
        public static void CheckForPreviousException()
        {
            try
            {
                var contents = LittleWatsonLog.ReadLog();
                if (contents != null && !LittleWatsonLog.IsExceptionIgnored(contents))
                {
                    if (MessageBox.Show(
                            "An error occurred the last time you ran this application. Would you like to send an email to report it? (If you do, you won't be asked again for this type of error)",
                            "Report error?",
                            MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                    {
                        LittleWatsonLog.IgnoreException(contents);

                        var email = new EmailComposeTask
                        {
                            To      = reportTo,
                            Subject = string.Format("{0} {1}.{2} Error Report", title, major, minor),
                            Body    = contents
                        };

                        LittleWatsonLog.DeleteLog(); // line added 1/15/2011
                        email.Show();
                    }
                }
            }
            catch (Exception)
            {
                // Gotta catch em all!
            }
            finally
            {
                LittleWatsonLog.DeleteLog();
            }
        }
コード例 #2
0
 public static void ReportException(Exception ex, string extra)
 {
     LittleWatsonLog.ReportException(ex, extra);
 }