Exemplo n.º 1
0
        private void SaveAsFile()
        {
            SaveFileDialog saveReportDialog = new SaveFileDialog();

            saveReportDialog.DefaultExt = "saencryptedreport";

            saveReportDialog.Filter = "SmartAssembly Exception Report|*.saencryptedreport|All files|*.*";
            saveReportDialog.Title  = "Save an Exception Report";

            if (saveReportDialog.ShowDialog(this) != DialogResult.Cancel)
            {
                if (reportExceptionEventArgs.SaveEncryptedReport(saveReportDialog.FileName))
                {
                    if (MessageBox.Show(string.Format("Please email this Exception Report file to [email protected]\n\nCreate email now?", UnhandledExceptionHandler.CompanyName), UnhandledExceptionHandler.ApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        string args = @"mailto:[email protected]?subject=Visual NHibernate Error&body=I have attached the error file.";

                        try { System.Diagnostics.Process.Start(args); }
                        catch
                        {
                            //Do nothing
                        }
                    }
                    Close();
                }
                else
                {
                    MessageBox.Show("Failed to save the report.", UnhandledExceptionHandler.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        void saveAsFile_Click(object sender, EventArgs e)
        {
            var saveReportDialog = new SaveFileDialog();

            saveReportDialog.DefaultExt = "saencryptedreport";

            saveReportDialog.Filter = "SmartAssembly Exception Report|*.saencryptedreport|All files|*.*";
            saveReportDialog.Title  = "Save an Exception Report";

            if (saveReportDialog.ShowDialog(this) != DialogResult.Cancel)
            {
                if (reportExceptionEventArgs.SaveEncryptedReport(saveReportDialog.FileName))
                {
                    MessageBox.Show(
                        $"Please send the Exception Report to {UnhandledExceptionHandler.CompanyName} Support Team.",
                        UnhandledExceptionHandler.ApplicationName,
                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Close();
                }
                else
                {
                    MessageBox.Show("Failed to save the report.", UnhandledExceptionHandler.ApplicationName,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 3
0
        private void OnSaveReport(object server, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Title = Localization.SaveReportButton;
            // WARNING: To open the encrypted report with SA, the file must have a .saencryptedreport extension.
            sfd.DefaultExt = "saencryptedreport";
            sfd.Filter     = "SmartAssembly Encrypted Exception Report|*.saencryptedreport";

            if (sfd.ShowDialog() == DialogResult.OK)
            {
                reportExceptionEventArgs.SaveEncryptedReport(sfd.FileName);
                Close();
            }
        }
        private void saveAsFile_Click(object sender, System.EventArgs e)
        {
            SaveFileDialog saveReportDialog = new SaveFileDialog();

            saveReportDialog.Title = "Save an Exception Report";
            // WARNING: To open the encrypted report with SA, the file must have a .saencryptedreport extension.
            saveReportDialog.DefaultExt = "saencryptedreport";
            saveReportDialog.Filter     = "SmartAssembly Encrypted Exception Report|*.saencryptedreport";

            if (saveReportDialog.ShowDialog(this) != DialogResult.Cancel)
            {
                if (reportExceptionEventArgs.SaveEncryptedReport(saveReportDialog.FileName))
                {
                    MessageBox.Show("Please send the exception report to Red Gate Support at [email protected]", UnhandledExceptionHandler.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Close();
                }
                else
                {
                    MessageBox.Show("Failed to save the report.", UnhandledExceptionHandler.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 5
0
        public bool SendReportViaEmail(ReportExceptionEventArgs reportExceptionEventArgs)
        {
            try
            {
                if (SendingReportViaEmailFeedback != null)
                {
                    SendingReportViaEmailFeedback(this, new SendingReportViaEmailFeedbackEventArgs(SendingReportViaEmailStep.PreparingReport));
                }

                // WARNING: To open the encrypted report with SA, the file must have a .saencryptedreport extension.
                string tempFileName = Path.GetTempPath() + Guid.NewGuid().ToString("N") + ".saencryptedreport";

                if (reportExceptionEventArgs.SaveEncryptedReport(tempFileName))
                {
                    if (SendingReportViaEmailFeedback != null)
                    {
                        SendingReportViaEmailFeedback(this, new SendingReportViaEmailFeedbackEventArgs(SendingReportViaEmailStep.Transfering));
                    }

                    bool transferingFailed = false;

                    try
                    {
                        SendEmail(tempFileName);
                    }
                    catch (Exception exception)
                    {
                        if (SendingReportViaEmailFeedback != null)
                        {
                            SendingReportViaEmailFeedback(this, new SendingReportViaEmailFeedbackEventArgs(SendingReportViaEmailStep.Transfering, exception.Message));
                        }
                        transferingFailed = true;
                    }

                    try
                    {
                        File.Delete(tempFileName);
                    }
                    catch
                    {
                    }

                    if (transferingFailed)
                    {
                        return(false);
                    }
                    else
                    {
                        if (SendingReportViaEmailFeedback != null)
                        {
                            SendingReportViaEmailFeedback(this, new SendingReportViaEmailFeedbackEventArgs(SendingReportViaEmailStep.Finished));
                        }
                        return(true);
                    }
                }
                else
                {
                    if (SendingReportViaEmailFeedback != null)
                    {
                        SendingReportViaEmailFeedback(this, new SendingReportViaEmailFeedbackEventArgs(SendingReportViaEmailStep.PreparingReport, "Cannot create temp file."));
                    }
                    return(false);
                }
            }
            catch (ThreadAbortException)
            {
                return(false);
            }
            catch (Exception fatalException)
            {
                MessageBox.Show(fatalException.ToString(), string.Format(Localization.FatalError, ApplicationName), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }