3
3
using OneTrueError . Client . Config ;
4
4
using OneTrueError . Client . WinForms ;
5
5
using OneTrueError . Client . WinForms . ContextProviders ;
6
+
6
7
// Keeps in the root namespace to get intelli sense
7
8
8
9
// ReSharper disable once CheckNamespace
10
+
9
11
namespace OneTrueError . Client
10
12
{
11
13
/// <summary>
12
- /// Use <c>OneTrue.Configuration.CatchWinFormsExceptions()</c> to get started.
14
+ /// Use <c>OneTrue.Configuration.CatchWinFormsExceptions()</c> to get started.
13
15
/// </summary>
14
16
public static class ConfigExtensions
15
17
{
16
18
/// <summary>
17
- /// Catch all uncaught windows form exceptions.
18
- /// </summary>
19
- /// <param name="configurator">OneTrueError configurator (accessed through <see cref="OneTrue.Configuration"/>).</param>
20
- [ Obsolete ( "Spelling error. Will be removed. Use OneTrue.Configuration.CatchWinFormsExceptions()" ) ]
21
- public static void CatchWinFormsExeptions ( this OneTrueConfiguration configurator )
22
- {
23
- if ( configurator == null ) throw new ArgumentNullException ( "configurator" ) ;
24
- WinFormsErrorReporter . Activate ( ) ;
25
- OneTrue . Configuration . ContextProviders . Add ( new OpenFormsCollector ( ) ) ;
26
- }
27
-
28
- /// <summary>
29
- /// Catch all uncaught windows form exceptions.
19
+ /// Catch all uncaught windows form exceptions.
30
20
/// </summary>
31
- /// <param name="configurator">OneTrueError configurator (accessed through <see cref="OneTrue.Configuration"/>).</param>
21
+ /// <param name="configurator">OneTrueError configurator (accessed through <see cref="OneTrue.Configuration" />).</param>
32
22
public static void CatchWinFormsExceptions ( this OneTrueConfiguration configurator )
33
23
{
34
24
if ( configurator == null ) throw new ArgumentNullException ( "configurator" ) ;
@@ -37,36 +27,25 @@ public static void CatchWinFormsExceptions(this OneTrueConfiguration configurato
37
27
}
38
28
39
29
/// <summary>
40
- /// Take a screen shot of every form that is opened when an error happen .
30
+ /// Catch all uncaught windows form exceptions .
41
31
/// </summary>
42
- /// <param name="configurator">OneTrueError configurator (accessed through <see cref="OneTrue.Configuration"/>).</param>
43
- public static void TakeScreenshots ( this OneTrueConfiguration configurator )
44
- {
45
- if ( configurator == null ) throw new ArgumentNullException ( "configurator" ) ;
46
- WinFormsErrorReporter . Activate ( ) ;
47
- OneTrue . Configuration . ContextProviders . Add ( new ScreenshotProvider ( true ) ) ;
48
- }
49
-
50
-
51
- /// <summary>
52
- /// Take a screen shot of every form that is opened when an error happen.
53
- /// </summary>
54
- /// <param name="configurator">OneTrueError configurator (accessed through <see cref="OneTrue.Configuration"/>).</param>
55
- public static void TakeScreenshotOfActiveFormOnly ( this OneTrueConfiguration configurator )
32
+ /// <param name="configurator">OneTrueError configurator (accessed through <see cref="OneTrue.Configuration" />).</param>
33
+ [ Obsolete ( "Spelling error. Will be removed. Use OneTrue.Configuration.CatchWinFormsExceptions()" ) ]
34
+ public static void CatchWinFormsExeptions ( this OneTrueConfiguration configurator )
56
35
{
57
36
if ( configurator == null ) throw new ArgumentNullException ( "configurator" ) ;
58
37
WinFormsErrorReporter . Activate ( ) ;
59
- OneTrue . Configuration . ContextProviders . Add ( new ScreenshotProvider ( ) ) ;
38
+ OneTrue . Configuration . ContextProviders . Add ( new OpenFormsCollector ( ) ) ;
60
39
}
61
40
62
41
/// <summary>
63
- /// Set a customized form which will be shown when OneTrueError detects an uncaught exception.
42
+ /// Set a customized form which will be shown when OneTrueError detects an uncaught exception.
64
43
/// </summary>
65
- /// <param name="configurator">OneTrueError configurator (accessed through <see cref="OneTrue.Configuration"/>)</param>
44
+ /// <param name="configurator">OneTrueError configurator (accessed through <see cref="OneTrue.Configuration" />)</param>
66
45
/// <param name="formFactory">Factory used to create the form.</param>
67
46
/// <example>
68
- /// <para>Start by creating your custom form. It should contain something like this:</para>
69
- /// <code>
47
+ /// <para>Start by creating your custom form. It should contain something like this:</para>
48
+ /// <code>
70
49
/// public partial class CustomReportDialog : Form
71
50
/// {
72
51
/// public CustomReportDialog()
@@ -102,22 +81,46 @@ public static void TakeScreenshotOfActiveFormOnly(this OneTrueConfiguration conf
102
81
/// }
103
82
/// }
104
83
/// </code>
105
- /// <para>
106
- /// Then configure OTE to use it:
107
- /// </para>
108
- /// <code>
84
+ /// <para>
85
+ /// Then configure OTE to use it:
86
+ /// </para>
87
+ /// <code>
109
88
/// // don't forget to set the error reporter first.
110
89
///
111
90
/// OneTrue.Configuration.CatchWinFormsExceptions();
112
91
/// OneTrue.Configuration.SetErrorForm(context => new CustomReportDialog() { reportId = context.reportId });
113
92
/// </code>
114
93
/// </example>
115
- public static void SetErrorForm ( this OneTrueConfiguration configurator , Func < FormFactoryContext , Form > formFactory )
94
+ public static void SetErrorForm ( this OneTrueConfiguration configurator ,
95
+ Func < FormFactoryContext , Form > formFactory )
116
96
{
117
97
if ( configurator == null ) throw new ArgumentNullException ( "configurator" ) ;
118
98
if ( formFactory == null ) throw new ArgumentNullException ( "formFactory" ) ;
119
99
120
100
WinFormsErrorReporter . FormFactory = formFactory ;
121
101
}
102
+
103
+
104
+ /// <summary>
105
+ /// Take a screen shot of every form that is opened when an error happen.
106
+ /// </summary>
107
+ /// <param name="configurator">OneTrueError configurator (accessed through <see cref="OneTrue.Configuration" />).</param>
108
+ public static void TakeScreenshotOfActiveFormOnly ( this OneTrueConfiguration configurator )
109
+ {
110
+ if ( configurator == null ) throw new ArgumentNullException ( "configurator" ) ;
111
+ WinFormsErrorReporter . Activate ( ) ;
112
+ OneTrue . Configuration . ContextProviders . Add ( new ScreenshotProvider ( ) ) ;
113
+ }
114
+
115
+ /// <summary>
116
+ /// Take a screen shot of every form that is opened when an error happen.
117
+ /// </summary>
118
+ /// <param name="configurator">OneTrueError configurator (accessed through <see cref="OneTrue.Configuration" />).</param>
119
+ public static void TakeScreenshots ( this OneTrueConfiguration configurator )
120
+ {
121
+ if ( configurator == null ) throw new ArgumentNullException ( "configurator" ) ;
122
+ WinFormsErrorReporter . Activate ( ) ;
123
+ OneTrue . Configuration . ContextProviders . Add ( new ScreenshotProvider ( true ) ) ;
124
+ }
122
125
}
123
- }
126
+ }
0 commit comments