コード例 #1
0
		public ExceptionReportView(ExceptionReportInfo reportInfo)
		{
			InitializeComponent();

			_presenter = new ExceptionReportPresenter(this, reportInfo)
			             {
			             	Clipboard = new WpfClipboard()
			             };
		}
コード例 #2
0
        /// <summary>
        /// Initialise the ExceptionReporter
        /// <remarks>readConfig() should be called (explicitly) if you need to override default config settings</remarks>
        /// </summary>
        public ExceptionReporter()
        {
            var callingAssembly = Assembly.GetCallingAssembly();

            _reportInfo = new ExceptionReportInfo
                              {
                                  AppAssembly = callingAssembly
                              };

            _viewResolver = new ViewResolver(callingAssembly);
            _internalExceptionView = ViewFactory.Create<IInternalExceptionView>(_viewResolver);
        }
コード例 #3
0
        public ExceptionReportView(ExceptionReportInfo reportInfo)
        {
            ShowFullDetail = true;
            InitializeComponent();

            _presenter = new ExceptionReportPresenter(this, reportInfo)
                             {
                                 Clipboard = new WinFormsClipboard()
                             };

            WireUpEvents();
            PopulateTabs();
            PopulateReportInfo(reportInfo);
        }
コード例 #4
0
		/// <summary>
		/// Initialises some ExceptionReportInfo properties related to the application/system
		/// </summary>
		/// <param name="reportInfo">an ExceptionReportInfo, can be pre-populated with config
		/// however 'base' properties such as MachineName</param>
		public ExceptionReportGenerator(ExceptionReportInfo reportInfo)
		{
			if (reportInfo == null)
				throw new ExceptionReportGeneratorException("reportInfo cannot be null");

			_reportInfo = reportInfo;

			_reportInfo.ExceptionDate = DateTime.UtcNow;
			_reportInfo.UserName = Environment.UserName;
			_reportInfo.MachineName = Environment.MachineName;
            _reportInfo.RegionInfo = Application.CurrentCulture.DisplayName;

            // TODO Application is WPF/WinForm specific, replace
            _reportInfo.AppName = string.IsNullOrEmpty(_reportInfo.AppName) ? Application.ProductName : _reportInfo.AppName;
            _reportInfo.AppVersion = string.IsNullOrEmpty(_reportInfo.AppVersion) ? Application.ProductVersion : _reportInfo.AppVersion;

            if (_reportInfo.AppAssembly == null)
			    _reportInfo.AppAssembly = Assembly.GetEntryAssembly() ?? Assembly.GetCallingAssembly();
		}
コード例 #5
0
        public static void ApplicationThreadException(object sender, ThreadExceptionEventArgs e)
        {
            ExceptionReporter er = new ExceptionReporter();

            ExceptionReporting.Core.ExceptionReportInfo conf = er.Config;

            Dictionary <string, string> rs = Options.ReportSettings;

            conf.AppName     = rs["appName"];
            conf.CompanyName = rs["companyName"];

            conf.MailMethod      = ExceptionReportInfo.EmailMethod.SMTP;
            conf.ContactEmail    = rs["contactEmail"];
            conf.SmtpFromAddress = rs["reportFromAddress"];
            conf.SmtpServer      = rs["reportSmtpServer"];

            /*
             *
             *
             * conf.SmtpUsername = Options.ReportSmtpUsername;
             * conf.SmtpPassword = Options.ReportSmtpPassword;
             */

            conf.ShowLessMoreDetailButton = true;
            conf.ShowFullDetail           = false;

            er.Show(e.Exception);

            if (Options.CloseOnException)
            {
                Application.Exit();
            }
            else
            {
                // we presumably set this to false because it was something
                // we threw ourselves - set it back to true for future
                // unexpected exceptions
                Options.CloseOnException = true;
            }
        }
コード例 #6
0
        /// <summary>
        /// Initialises some ExceptionReportInfo properties related to the application/system
        /// </summary>
        /// <param name="reportInfo">an ExceptionReportInfo, can be pre-populated with config
        /// however 'base' properties such as MachineName</param>
        public ExceptionReportGenerator(ExceptionReportInfo reportInfo)
        {
            if (reportInfo == null)
            {
                throw new ExceptionReportGeneratorException("reportInfo cannot be null");
            }

            _reportInfo = reportInfo;

            _reportInfo.ExceptionDate = DateTime.UtcNow;
            _reportInfo.UserName      = Environment.UserName;
            _reportInfo.MachineName   = Environment.MachineName;
            _reportInfo.RegionInfo    = Application.CurrentCulture.DisplayName;

            // TODO Application is WPF/WinForm specific, replace
            _reportInfo.AppName    = string.IsNullOrEmpty(_reportInfo.AppName) ? Application.ProductName : _reportInfo.AppName;
            _reportInfo.AppVersion = string.IsNullOrEmpty(_reportInfo.AppVersion) ? Application.ProductVersion : _reportInfo.AppVersion;

            if (_reportInfo.AppAssembly == null)
            {
                _reportInfo.AppAssembly = Assembly.GetEntryAssembly() ?? Assembly.GetCallingAssembly();
            }
        }
コード例 #7
0
 public ExceptionReportBuilder(ExceptionReportInfo reportInfo, IEnumerable <SysInfoResult> sysInfoResults)
     : this(reportInfo)
 {
     _sysInfoResults = sysInfoResults;
 }
コード例 #8
0
 private ExceptionReportBuilder(ExceptionReportInfo reportInfo)
 {
     _reportInfo = reportInfo;
 }
コード例 #9
0
 public ExceptionReportBuilder(ExceptionReportInfo reportInfo)
 {
     _reportInfo = reportInfo;
 }
コード例 #10
0
 /// <summary>
 /// constructor
 /// </summary>
 public ExceptionReportPresenter(IExceptionReportView view, ExceptionReportInfo info)
 {
     _view = view;
     ReportInfo = info;
     _reportGenerator = new ExceptionReportGenerator(ReportInfo);
 }
コード例 #11
0
ファイル: ConfigReader.cs プロジェクト: TimVelo/StackBuilder
		/// <param name="reportInfo">the ExceptionReportInfo object to fill with configuration information</param>
        public ConfigReader(ExceptionReportInfo reportInfo)
        {
            _info = reportInfo;
        }
コード例 #12
0
ファイル: CrashReporter.cs プロジェクト: applejian/cyberduck
        /// <summary>
        /// 
        /// </summary>
        /// <param name="e"></param>
        /// <returns>Crash report as string</returns>
        public void Write(Exception e)
        {
            ExceptionReportInfo info = new ExceptionReportInfo {MainException = e};
            ExceptionReportGenerator reportGenerator = new ExceptionReportGenerator(info);
            ExceptionReport report = reportGenerator.CreateExceptionReport();

            string crashDir = Path.Combine(Preferences.instance().getProperty("application.support.path"),
                                           "CrashReporter");
            Directory.CreateDirectory(crashDir);
            using (StreamWriter outfile = new StreamWriter(Path.Combine(crashDir, DateTime.Now.Ticks + ".txt")))
            {
                outfile.Write(report.ToString());
            }
            TaskDialog prompt = new TaskDialog();
            DialogResult result = prompt.ShowCommandBox(Locale.localizedString("Do you want to report the last crash?", "Crash"),
                                                        Locale.localizedString("Do you want to report the last crash?", "Crash"),
                                                        Locale.localizedString(
                                                            "The application %@ has recently crashed. To help improve it, you can send the crash log to the author.", "Crash").Replace("%@", Preferences.instance().getProperty("application.name")),
                                                        String.Format("{0}|{1}",
                                                                      Locale.localizedString("Send", "Crash"),
                                                                      Locale.localizedString("Don't Send", "Crash")),
                                                        false, SysIcons.Error);
            if (DialogResult.OK == result)
            {
                if (0 == prompt.CommandButtonResult)
                {
                    Post(report.ToString());
                }
            }
        }
コード例 #13
0
        private void PopulateReportInfo(ExceptionReportInfo reportInfo)
        {
            urlEmail.Text = reportInfo.ContactEmail;
            txtFax.Text = reportInfo.Fax;
            lblContactMessageTop.Text = reportInfo.ContactMessageTop;
            txtPhone.Text = reportInfo.Phone;
            urlWeb.Text = reportInfo.WebUrl;
            lblExplanation.Text = reportInfo.UserExplanationLabel;
            ShowFullDetail = reportInfo.ShowFullDetail;
            ToggleShowFullDetail();
            btnDetailToggle.Visible = reportInfo.ShowLessMoreDetailButton;

            //TODO: show all exception messages
            txtExceptionMessageLarge.Text = 
                txtExceptionMessage.Text =
                !string.IsNullOrEmpty(reportInfo.CustomMessage) ? reportInfo.CustomMessage : reportInfo.Exceptions[0].Message;
            
            txtExceptionMessageLarge2.Text = txtExceptionMessageLarge.Text;

            txtDate.Text = reportInfo.ExceptionDate.ToShortDateString();
            txtTime.Text = reportInfo.ExceptionDate.ToShortTimeString();
            txtUserName.Text = reportInfo.UserName;
            txtMachine.Text = reportInfo.MachineName;
            txtRegion.Text = reportInfo.RegionInfo;
            txtApplicationName.Text = reportInfo.AppName;
            txtVersion.Text = reportInfo.AppVersion;

            btnClose.FlatStyle =
                btnDetailToggle.FlatStyle =
                btnCopy.FlatStyle =
                btnEmail.FlatStyle =
                btnSave.FlatStyle = (reportInfo.ShowFlatButtons ? FlatStyle.Flat : FlatStyle.Standard);

            listviewAssemblies.BackColor =
                txtFax.BackColor =
                txtMachine.BackColor =
                txtPhone.BackColor =
                txtRegion.BackColor =
                txtTime.BackColor =
                txtTime.BackColor =
                txtUserName.BackColor =
                txtVersion.BackColor =
                txtApplicationName.BackColor =
                txtDate.BackColor =
                txtExceptionMessageLarge.BackColor =
                txtExceptionMessage.BackColor = reportInfo.BackgroundColor;

            if (!reportInfo.ShowButtonIcons)
            {
                RemoveButtonIcons();
            }

            Text = reportInfo.TitleText;
            txtUserExplanation.Font = new Font(txtUserExplanation.Font.FontFamily, reportInfo.UserExplanationFontSize);
            lblContactCompany.Text = string.Format("If this problem persists, please contact {0} support.", reportInfo.CompanyName);
            btnSimpleEmail.Text = string.Format("E-mail {0}", reportInfo.CompanyName);

            if (reportInfo.TakeScreenshot)
            {
                reportInfo.ScreenshotImage = ScreenshotTaker.TakeScreenShot();
            }
        }
コード例 #14
0
		public ExceptionReportBuilder(ExceptionReportInfo reportInfo, IEnumerable<SysInfoResult> sysInfoResults)
			: this(reportInfo)
		{
			_sysInfoResults = sysInfoResults;
		}
コード例 #15
0
		public ExceptionReportBuilder(ExceptionReportInfo reportInfo)
		{
			_reportInfo = reportInfo;
		}
コード例 #16
0
ファイル: MailSender.cs プロジェクト: TimVelo/StackBuilder
 internal MailSender(ExceptionReportInfo reportInfo)
 {
     _reportInfo = reportInfo;
 }