Skip to content

Commit e6a0e50

Browse files
committed
#35 fix button text in case of 'More Detail' mode and 'WebService' SendMethod
simplify demo dialog options #36 make Less Detail mode the default
1 parent 65ea995 commit e6a0e50

File tree

4 files changed

+46
-49
lines changed

4 files changed

+46
-49
lines changed

src/Demos/WinForms/DemoAppView.cs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public DemoAppView()
1212
InitializeComponent();
1313

1414
urlDefault.Click += Show_Default_Report;
15-
urlHideDetail.Click += Show_MoreLessDetailsView_Click;
1615
urlSendEmail.Click += Send_Report;
1716
urlSilentReport.Click += Send_Silent_Report;
1817
}
@@ -22,11 +21,6 @@ static void Show_Default_Report(object sender, EventArgs e)
2221
ThrowAndShowExceptionReporter();
2322
}
2423

25-
static void Show_MoreLessDetailsView_Click(object sender, EventArgs e)
26-
{
27-
ThrowAndShowExceptionReporter(detailView:true);
28-
}
29-
3024
void Send_Silent_Report(object sender, EventArgs e)
3125
{
3226
try
@@ -115,14 +109,13 @@ static void ThrowAndShowExceptionReporter(bool detailView = false)
115109
er.Config.SendMethod = ReportSendMethod.SimpleMAPI;
116110
er.Config.EmailReportAddress = "[email protected]";
117111
er.Config.CompanyName = "Acme"; // this goes alongside email button text
118-
119-
if (detailView)
120-
{
121-
er.Config.ShowFullDetail = false;
122-
er.Config.ShowLessMoreDetailButton = true;
123-
// er.Config.ShowEmailButton = false; // just for testing that removing email button works
124-
// er.Config.TemplateFormat = TemplateFormat.Markdown;
125-
}
112+
er.Config.TitleText = "Acme Error Report";
113+
114+
// er.Config.ShowFullDetail = false;
115+
er.Config.ShowLessDetailButton = true;
116+
// er.Config.ShowEmailButton = false; // just for testing that removing email button works
117+
// er.Config.TemplateFormat = TemplateFormat.Markdown;
118+
126119
er.Show(exception);
127120
}
128121
}

src/Demos/WinForms/DemoAppView.designer.cs

Lines changed: 25 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ExceptionReporter/ExceptionReportInfo.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,15 +277,21 @@ public string AttachmentFilename
277277

278278
/// <summary>
279279
/// Show the button that gives user the option to switch between "Less Detail/More Detail"
280+
/// NB the
280281
/// </summary>
281-
public bool ShowLessMoreDetailButton { get; set; }
282+
public bool ShowLessDetailButton { get; set; }
282283

283-
public bool ShowFullDetail { get; set; } = true;
284+
/// <summary>
285+
/// Show the tabbed ("More Detailed") view to user straight away
286+
/// The purpose of the non-tabbed ("Less Details") view was to avoid scaring users, so the full detaild view is
287+
/// best reserved for advanced or technical users
288+
/// </summary>
289+
public bool ShowFullDetail { get; set; }
284290

285291
/// <summary>
286292
/// Whether to show relevant icons on the buttons
287293
/// </summary>
288-
public bool ShowButtonIcons { get; set; } = true;
294+
public bool ShowButtonIcons { get; set; }
289295

290296
/// <summary>
291297
/// Format of the final report (string) - Defaults to TemplateFormat.Text

src/ExceptionReporter/MVP/Views/ExceptionReportView.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Linq;
55
using System.Reflection;
66
using System.Windows.Forms;
7+
using ExceptionReporting.Core;
78
using ExceptionReporting.MVP.Presenters;
89
using ExceptionReporting.SystemInfo;
910
using ExceptionReporting.Templates;
@@ -38,7 +39,7 @@ private void PopulateReportInfo(ExceptionReportInfo reportInfo)
3839
lblExplanation.Text = reportInfo.UserExplanationLabel;
3940
ShowFullDetail = reportInfo.ShowFullDetail;
4041
ToggleShowFullDetail();
41-
btnDetailToggle.Visible = reportInfo.ShowLessMoreDetailButton;
42+
btnDetailToggle.Visible = reportInfo.ShowLessDetailButton;
4243

4344
//TODO: show all exception messages
4445
txtExceptionMessageLarge.Text =
@@ -82,9 +83,10 @@ private void PopulateReportInfo(ExceptionReportInfo reportInfo)
8283
Text = reportInfo.TitleText;
8384
txtUserExplanation.Font = new Font(txtUserExplanation.Font.FontFamily, reportInfo.UserExplanationFontSize);
8485
lblContactCompany.Text = string.Format("If this problem persists, please contact {0} support.", reportInfo.CompanyName);
85-
btnSimpleEmail.Text = string.Format("{0} {1}",
86+
btnSimpleEmail.Text = btnEmail.Text =
87+
string.Format("{0} {1}",
8688
reportInfo.SendMethod == ReportSendMethod.WebService ? "Send" : "Email",
87-
reportInfo.SendMethod == ReportSendMethod.WebService ? "to " + reportInfo.CompanyName : reportInfo.CompanyName);
89+
reportInfo.SendMethod == ReportSendMethod.WebService && !reportInfo.CompanyName.IsEmpty() ? "to " + reportInfo.CompanyName : reportInfo.CompanyName);
8890
}
8991

9092
private void RemoveEmailButton()

0 commit comments

Comments
 (0)