Skip to content

Commit feb4c8c

Browse files
committed
published WinForms and improved the publish batch file.
1 parent 1f9de6f commit feb4c8c

22 files changed

+188
-117
lines changed

Demo/App.config

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
23
<configuration>
3-
<startup>
4-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
5-
</startup>
4+
<startup>
5+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
6+
</startup>
67
<runtime>
78
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
89
<dependentAssembly>

Demo/Form1.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.ComponentModel;
42
using System.Data;
5-
using System.Drawing;
6-
using System.Linq;
7-
using System.Text;
8-
using System.Threading.Tasks;
93
using System.Windows.Forms;
10-
using OneTrueError.Client;
114

125
namespace Demo
136
{
@@ -28,4 +21,4 @@ private void SomeOperation()
2821
throw new DataException("Failed to save user");
2922
}
3023
}
31-
}
24+
}

Demo/Program.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
52
using System.Windows.Forms;
63
using OneTrueError.Client;
74

85
namespace Demo
96
{
10-
static class Program
7+
internal static class Program
118
{
129
/// <summary>
13-
/// The main entry point for the application.
10+
/// The main entry point for the application.
1411
/// </summary>
1512
[STAThread]
16-
static void Main()
13+
private static void Main()
1714
{
1815
var url = new Uri("http://localhost:50473/");
19-
OneTrue.Configuration.Credentials(url, "13d82df603a845c7a27164c4fec19dd6", "6f0a0a7fac6d42caa7cc47bb34a6520b");
16+
OneTrue.Configuration.Credentials(url, "13d82df603a845c7a27164c4fec19dd6",
17+
"6f0a0a7fac6d42caa7cc47bb34a6520b");
2018
OneTrue.Configuration.TakeScreenshotOfActiveFormOnly();
2119
OneTrue.Configuration.TakeScreenshots();
2220
OneTrue.Configuration.CatchWinFormsExceptions();
@@ -29,4 +27,4 @@ static void Main()
2927
Application.Run(new CreateUserForm());
3028
}
3129
}
32-
}
30+
}

Demo/Properties/AssemblyInfo.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
// General Information about an assembly is controlled through the following
65
// set of attributes. Change these attribute values to modify the information
76
// associated with an assembly.
7+
88
[assembly: AssemblyTitle("Demo")]
99
[assembly: AssemblyDescription("")]
1010
[assembly: AssemblyConfiguration("")]
@@ -17,9 +17,11 @@
1717
// Setting ComVisible to false makes the types in this assembly not visible
1818
// to COM components. If you need to access a type in this assembly from
1919
// COM, set the ComVisible attribute to true on that type.
20+
2021
[assembly: ComVisible(false)]
2122

2223
// The following GUID is for the ID of the typelib if this project is exposed to COM
24+
2325
[assembly: Guid("4c041172-985c-4d05-bcb7-0e3c706c3a1c")]
2426

2527
// Version information for an assembly consists of the following four values:
@@ -32,5 +34,6 @@
3234
// You can specify all the values or you can default the Build and Revision Numbers
3335
// by using the '*' as shown below:
3436
// [assembly: AssemblyVersion("1.0.*")]
37+
3538
[assembly: AssemblyVersion("1.0.0.0")]
36-
[assembly: AssemblyFileVersion("1.0.0.0")]
39+
[assembly: AssemblyFileVersion("1.0.0.0")]

Demo/Properties/Settings.settings

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version='1.0' encoding='utf-8'?>
2+
23
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
34
<Profiles>
45
<Profile Name="(Default)" />
56
</Profiles>
67
<Settings />
7-
</SettingsFile>
8+
</SettingsFile>

Demo/packages.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
23
<packages>
34
<package id="Newtonsoft.Json" version="8.0.1" targetFramework="net452" />
45
<package id="OneTrueError.Client" version="1.0.0-rc09" targetFramework="net452" />

client.aspnet/OneTrueError.Client.AspNet/OneTrueError.Client.aspnet.nuspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<version>1.0.0-rc02</version>
77
<authors>Gauffin Interactive AB</authors>
88
<owners>Gauffin Interactive AB</owners>
9-
<licenseUrl>http://github.com/gauffininteractive/onetrueerror.client/license.md</licenseUrl>
9+
<licenseUrl>https://github.com/gauffininteractive/onetrueerror.client/blob/master/LICENSE.md</licenseUrl>
1010
<projectUrl>http://onetrueerror.com</projectUrl>
1111
<iconUrl>http://onetrueerror.com/images/ote_50x50.png</iconUrl>
12-
<requireLicenseAcceptance>true</requireLicenseAcceptance>
12+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1313
<summary>
14-
ASP.NET integration library for OneTrueError. Will detect and upload all unhandled exceptions to OneTrueError.
14+
ASP.NET integration library for OneTrueError. Detects and uploads all unhandled exceptions to OneTrueError.
1515
</summary>
1616
<description>
1717
ASP.NET integration library for OneTrueError. Will detect and upload all unhandled exceptions to OneTrueError.

client.winforms/OneTrueError.Client.WinForms/ConfigExtensions.cs

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,22 @@
33
using OneTrueError.Client.Config;
44
using OneTrueError.Client.WinForms;
55
using OneTrueError.Client.WinForms.ContextProviders;
6+
67
// Keeps in the root namespace to get intelli sense
78

89
// ReSharper disable once CheckNamespace
10+
911
namespace OneTrueError.Client
1012
{
1113
/// <summary>
12-
/// Use <c>OneTrue.Configuration.CatchWinFormsExceptions()</c> to get started.
14+
/// Use <c>OneTrue.Configuration.CatchWinFormsExceptions()</c> to get started.
1315
/// </summary>
1416
public static class ConfigExtensions
1517
{
1618
/// <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.
3020
/// </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>
3222
public static void CatchWinFormsExceptions(this OneTrueConfiguration configurator)
3323
{
3424
if (configurator == null) throw new ArgumentNullException("configurator");
@@ -37,36 +27,25 @@ public static void CatchWinFormsExceptions(this OneTrueConfiguration configurato
3727
}
3828

3929
/// <summary>
40-
/// Take a screen shot of every form that is opened when an error happen.
30+
/// Catch all uncaught windows form exceptions.
4131
/// </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)
5635
{
5736
if (configurator == null) throw new ArgumentNullException("configurator");
5837
WinFormsErrorReporter.Activate();
59-
OneTrue.Configuration.ContextProviders.Add(new ScreenshotProvider());
38+
OneTrue.Configuration.ContextProviders.Add(new OpenFormsCollector());
6039
}
6140

6241
/// <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.
6443
/// </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>
6645
/// <param name="formFactory">Factory used to create the form.</param>
6746
/// <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>
7049
/// public partial class CustomReportDialog : Form
7150
/// {
7251
/// public CustomReportDialog()
@@ -102,22 +81,46 @@ public static void TakeScreenshotOfActiveFormOnly(this OneTrueConfiguration conf
10281
/// }
10382
/// }
10483
/// </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>
10988
/// // don't forget to set the error reporter first.
11089
///
11190
/// OneTrue.Configuration.CatchWinFormsExceptions();
11291
/// OneTrue.Configuration.SetErrorForm(context => new CustomReportDialog() { reportId = context.reportId });
11392
/// </code>
11493
/// </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)
11696
{
11797
if (configurator == null) throw new ArgumentNullException("configurator");
11898
if (formFactory == null) throw new ArgumentNullException("formFactory");
11999

120100
WinFormsErrorReporter.FormFactory = formFactory;
121101
}
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+
}
122125
}
123-
}
126+
}

client.winforms/OneTrueError.Client.WinForms/ContextProviders/ScreenshotProvider.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,26 @@ public class ScreenshotProvider : IContextInfoProvider
1616
/// "Screenshots"
1717
/// </summary>
1818
public const string NAME = "Screenshots";
19-
private bool _allForms;
2019

20+
private readonly bool _allForms;
21+
22+
/// <summary>
23+
/// Creates a new instance of "<see cref="ScreenshotProvider" />
24+
/// </summary>
25+
/// <param name="ofAllForms">if <c>true</c>: take a screenshot of all open forms; otherwise only of the active form.</param>
2126
public ScreenshotProvider(bool ofAllForms)
2227
{
2328
_allForms = ofAllForms;
2429
}
2530

31+
/// <summary>
32+
/// Creates a new instance of <see cref="ScreenshotProvider" />.
33+
/// </summary>
34+
/// <remarks>
35+
/// <para>
36+
/// Will only take a screenshot of the active form.
37+
/// </para>
38+
/// </remarks>
2639
public ScreenshotProvider()
2740
: this(false)
2841
{
@@ -50,12 +63,12 @@ public ContextCollectionDTO Collect(IErrorReporterContext context)
5063
var context2 = _allForms
5164
? shooter.CaptureAllOpenForms()
5265
: shooter.CaptureActiveForm();
53-
66+
5467
return context2;
5568
}
5669
catch (Exception ex)
5770
{
58-
return new ContextCollectionDTO("Screenshots", new Dictionary<string, string>()
71+
return new ContextCollectionDTO("Screenshots", new Dictionary<string, string>
5972
{
6073
{"Error", ex.ToString()},
6174
{"Thread", Thread.CurrentThread.ManagedThreadId + "[" + Thread.CurrentThread.Name + "]"}

client.winforms/OneTrueError.Client.WinForms/ErrorDescription.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ public ErrorDescription()
99
InitializeComponent();
1010
}
1111

12-
public string UserInfo { get { return feedback2.Text; } }
12+
public string UserInfo
13+
{
14+
get { return feedback2.Text; }
15+
}
1316
}
14-
}
17+
}

client.winforms/OneTrueError.Client.WinForms/FormScreenshooter.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ public void Capture(Form form, Stream destination)
4646
}
4747
}
4848

49+
/// <summary>
50+
/// Take a screenshot only of the active form
51+
/// </summary>
52+
/// <returns>collection where the screenshot it base64 encoded using the name of the form as property name</returns>
4953
public ContextCollectionDTO CaptureActiveForm()
5054
{
5155
var screenshots = new Dictionary<string, string>();

client.winforms/OneTrueError.Client.WinForms/NamespaceDoc.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ namespace OneTrueError.Client.WinForms
2020
/// <para>
2121
/// Additional configuration options:
2222
/// </para>
23-
/// <list type="bullet">
24-
/// <item><see cref="ConfigExtensions.TakeScreenshots" /></item>
25-
/// <item><see cref="ConfigExtensions.SetErrorForm" /></item>
26-
/// </list>
23+
/// <list type="bullet">
24+
/// <item>
25+
/// <see cref="ConfigExtensions.TakeScreenshots" />
26+
/// </item>
27+
/// <item>
28+
/// <see cref="ConfigExtensions.SetErrorForm" />
29+
/// </item>
30+
/// </list>
2731
/// </summary>
2832
[CompilerGenerated]
2933
internal class NamespaceDoc

client.winforms/OneTrueError.Client.WinForms/NotificationControl.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ public NotificationControl()
1010
InitializeComponent();
1111
}
1212

13-
private void NotificationControl_Load(object sender, EventArgs e)
13+
public string Email
1414
{
15-
15+
get { return tbEmail.Text; }
1616
}
1717

18-
public string Email { get { return tbEmail.Text; }}
18+
private void NotificationControl_Load(object sender, EventArgs e)
19+
{
20+
}
1921

2022
private void tbEmail_TextChanged(object sender, EventArgs e)
2123
{
22-
2324
}
2425
}
25-
}
26+
}

0 commit comments

Comments
 (0)