public ExceptionReportingForm(UnhandledExceptionHandler unhandledExceptionHandler,
            ReportExceptionEventArgs reportExceptionEventArgs) : this() {
            var newHeight = Height;

            this.reportExceptionEventArgs = reportExceptionEventArgs;
            this.unhandledExceptionHandler = unhandledExceptionHandler;
            errorMessage.Text = reportExceptionEventArgs.Exception.Message;

            newHeight += errorMessage.Height - FontHeight;

            if (!reportExceptionEventArgs.ShowContinueCheckbox) {
                continueCheckBox.Visible = false;
                newHeight -= continueCheckBox.Height;
            }

            if (newHeight > Height)
                Height = newHeight;

            if (reportExceptionEventArgs.CanDebug) {
                unhandledExceptionHandler.DebuggerLaunched += OnDebuggerLaunched;
                debug.Visible = true;
                poweredBy.Visible = false;
            }

            if (!reportExceptionEventArgs.CanSendReport) {
                sendReport.Enabled = false;
                if (dontSendReport.CanFocus)
                    dontSendReport.Focus();
            }

            email.Text = RegistryHelper.TryReadHKLMRegistryString("Email");

            unhandledExceptionHandler.SendingReportFeedback += OnFeedback;
        }
 public static void RegisterUnhandledExceptionHandler(UnhandledExceptionHandler h)
 {
     unhandledExceptionHandler = h;
 }
 public static void RegisterUnhandledExceptionHandler(UnhandledExceptionHandler h)
 {
     ExcelIntegration.RegisterUnhandledExceptionHandler(h);
 }
		static extern UnhandledExceptionHandler SetUnhandledExceptionFilter(UnhandledExceptionHandler lpTopLevelExceptionFilter);
        public ExceptionReportingForm(UnhandledExceptionHandler unhandledExceptionHandler, ReportExceptionEventArgs reportExceptionEventArgs)
            : this()
        {
            int newHeight = Height;

            this.reportExceptionEventArgs = reportExceptionEventArgs;
            this.unhandledExceptionHandler = unhandledExceptionHandler;
            this.errorMessage.Text = reportExceptionEventArgs.Exception.Message;

            foreach (var key in reportExceptionEventArgs.Exception.Data.Keys)
                reportExceptionEventArgs.AddCustomProperty(string.Format("Data [{0}]", key.ToString()), reportExceptionEventArgs.Exception.Data[key].ToString());

            newHeight += (this.errorMessage.Height - FontHeight);

            if (!reportExceptionEventArgs.CanContinue)
            {
                this.continueCheckBox.Visible = false;
                newHeight -= (this.continueCheckBox.Height);
            }

            if (newHeight > Height) Height = newHeight;

            if (reportExceptionEventArgs.CanDebug)
            {
                unhandledExceptionHandler.DebuggerLaunched += new EventHandler(OnDebuggerLaunched);
                debug.Visible = true;
                poweredBy.Visible = false;
            }

            if (!reportExceptionEventArgs.CanSendReport)
            {
                sendReport.Enabled = false;
                if (dontSendReport.CanFocus) dontSendReport.Focus();
            }

            this.email.Text = RegistryHelper.ReadHKLMRegistryString("Email");

            unhandledExceptionHandler.SendingReportFeedback += new SendingReportFeedbackEventHandler(OnFeedback);

            // GFH
            //if (WebProxy.Credentials != null)
            unhandledExceptionHandler.SetProxy(WebProxy);

            string reportedExceptions = RegistryHelper.ReadHKLMRegistryString("ReportedExceptions");
            string currentVersion;

            try
            {
                currentVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

                if (!reportedExceptions.StartsWith(currentVersion))
                    reportedExceptions = currentVersion + ":";
            }
            catch
            {
                currentVersion = "";
            }
            string newHashCode = GetExceptionHashCode(reportExceptionEventArgs.Exception).ToString();

            if (reportedExceptions.Contains(newHashCode))
            {
                labelRequiredInfo.Visible = false;
                dontSendReport.Enabled = true;
                cancelSending.Enabled = true;
                saveAsFile.Enabled = true;
            }
            else
            {
                labelRequiredInfo.Visible = true;
                dontSendReport.Enabled = false;
                cancelSending.Enabled = false;
                saveAsFile.Enabled = false;
                RegistryHelper.SaveHKLMRegistryString("ReportedExceptions", reportedExceptions + "," + newHashCode);
            }
        }