Skip to content

Commit 124434d

Browse files
committed
WinForms: Fixed a small issue regarding taking screenshot when the form was inactive.
1 parent fa12a86 commit 124434d

File tree

4 files changed

+107
-6
lines changed

4 files changed

+107
-6
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,4 @@ client/Help/*
239239
client.aspnet.mvc5/Help/*
240240
client.aspnet/Help/*
241241
client.log4net/Help/*
242+
client.winforms/Help/*

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

+7-3
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,16 @@ public ContextCollectionDTO CaptureActiveForm()
5656

5757
var ms = new MemoryStream();
5858

59-
if (Form.ActiveForm == null)
59+
var form = Form.ActiveForm ??
60+
(Application.OpenForms.Count > 0
61+
? Application.OpenForms[Application.OpenForms.Count - 1]
62+
: null);
63+
if (form == null)
6064
return null;
6165

62-
Capture(Form.ActiveForm, ms);
66+
Capture(form, ms);
6367
var str = Convert.ToBase64String(ms.GetBuffer(), 0, (int) ms.Length);
64-
var name = GetFormName(Form.ActiveForm);
68+
var name = GetFormName(form);
6569
screenshots.Add(name, str);
6670
return new ContextCollectionDTO(ScreenshotProvider.NAME, screenshots);
6771
}

client.winforms/OneTrueError.Client.WinForms/OneTrueError.Client.WinForms.nuspec

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<package>
44
<metadata>
55
<id>OneTrueError.Client.WinForms</id>
6-
<version>1.0.1</version>
6+
<version>1.0.3</version>
77
<authors>Gauffin Interactive AB</authors>
88
<owners>Gauffin Interactive AB</owners>
99
<licenseUrl>https://github.com/gauffininteractive/onetrueerror.client/blob/master/LICENSE.md</licenseUrl>
@@ -21,8 +21,8 @@
2121

2222
OneTrueError is an exception analysis service which makes it much easier to identify and correct unique errors.
2323
</description>
24-
<releaseNotes>Beta release.</releaseNotes>
25-
<copyright>Copyright 2016</copyright>
24+
<releaseNotes>Corrected an error when "TakeScreenshotOfActiveFormOnly()" is used and no form have focus.</releaseNotes>
25+
<copyright>Copyright 2016 Gauffin Interactive AB</copyright>
2626
<tags>exception error reporting analysis winforms threadexception</tags>
2727
<dependencies>
2828
<dependency id="OneTrueError.Client" version="1.0.0" />
+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<!-- The configuration and platform will be used to determine which assemblies to include from solution and
5+
project documentation sources -->
6+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8+
<SchemaVersion>2.0</SchemaVersion>
9+
<ProjectGuid>{39df618a-c937-4075-93b9-5667206a9714}</ProjectGuid>
10+
<SHFBSchemaVersion>2015.6.5.0</SHFBSchemaVersion>
11+
<!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual Studio adds them anyway -->
12+
<AssemblyName>Documentation</AssemblyName>
13+
<RootNamespace>Documentation</RootNamespace>
14+
<Name>Documentation</Name>
15+
<!-- SHFB properties -->
16+
<FrameworkVersion>.NET Framework 4.5</FrameworkVersion>
17+
<OutputPath>.\Help\</OutputPath>
18+
<HtmlHelpName>OneTrueError.Client.WinForms</HtmlHelpName>
19+
<Language>en-US</Language>
20+
<DocumentationSources>
21+
<DocumentationSource sourceFile="OneTrueError.Client.WinForms\OneTrueError.Client.WinForms.csproj" />
22+
</DocumentationSources>
23+
<SaveComponentCacheCapacity>100</SaveComponentCacheCapacity>
24+
<BuildAssemblerVerbosity>AllMessages</BuildAssemblerVerbosity>
25+
<HelpFileFormat>Website</HelpFileFormat>
26+
<IndentHtml>False</IndentHtml>
27+
<KeepLogFile>True</KeepLogFile>
28+
<DisableCodeBlockComponent>False</DisableCodeBlockComponent>
29+
<CleanIntermediates>True</CleanIntermediates>
30+
<HelpFileVersion>1.0.0.0</HelpFileVersion>
31+
<MaximumGroupParts>2</MaximumGroupParts>
32+
<NamespaceGrouping>False</NamespaceGrouping>
33+
<SyntaxFilters>C#, Visual Basic</SyntaxFilters>
34+
<SdkLinkTarget>Blank</SdkLinkTarget>
35+
<RootNamespaceContainer>False</RootNamespaceContainer>
36+
<PresentationStyle>VS2013</PresentationStyle>
37+
<Preliminary>False</Preliminary>
38+
<NamingMethod>MemberName</NamingMethod>
39+
<HelpTitle>OneTrueError WinForms client library</HelpTitle>
40+
<FeedbackEMailLinkText>support%40onetrueerror.com</FeedbackEMailLinkText>
41+
<FeedbackEMailAddress>support%40onetrueerror.com</FeedbackEMailAddress>
42+
<CopyrightText>&amp;amp%3bcopy%3b 2016 Gauffin Interactive AB</CopyrightText>
43+
<CopyrightHref>http://onetrueerror.com</CopyrightHref>
44+
<ContentPlacement>AboveNamespaces</ContentPlacement>
45+
<VisibleItems>InheritedMembers, Protected, ProtectedInternalAsProtected</VisibleItems>
46+
<ComponentConfigurations>
47+
<ComponentConfig id="Code Block Component" enabled="True" xmlns="">
48+
<component id="Code Block Component">
49+
<basePath value="{@HtmlEncProjectFolder}" />
50+
<outputPaths>{@HelpFormatOutputPaths}</outputPaths>
51+
<allowMissingSource value="false" />
52+
<removeRegionMarkers value="false" />
53+
<colorizer syntaxFile="{@SHFBFolder}PresentationStyles\Colorizer\highlight.xml" styleFile="{@SHFBFolder}PresentationStyles\Colorizer\highlight.xsl" stylesheet="{@SHFBFolder}PresentationStyles\Colorizer\highlight.css" scriptFile="{@SHFBFolder}PresentationStyles\Colorizer\highlight.js" disabled="{@DisableCodeBlockComponent}" language="cs" tabSize="0" numberLines="false" outlining="false" keepSeeTags="false" defaultTitle="true" />
54+
</component>
55+
</ComponentConfig>
56+
</ComponentConfigurations>
57+
<NamespaceSummaries>
58+
<NamespaceSummaryItem name="OneTrueError.Client" isDocumented="True" xmlns="">Welcome to the WinForms client library for OneTrueError</NamespaceSummaryItem>
59+
</NamespaceSummaries>
60+
</PropertyGroup>
61+
<!-- There are no properties for these groups. AnyCPU needs to appear in order for Visual Studio to perform
62+
the build. The others are optional common platform types that may appear. -->
63+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
64+
</PropertyGroup>
65+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
66+
</PropertyGroup>
67+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
68+
</PropertyGroup>
69+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
70+
</PropertyGroup>
71+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
72+
</PropertyGroup>
73+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
74+
</PropertyGroup>
75+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Win32' ">
76+
</PropertyGroup>
77+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Win32' ">
78+
</PropertyGroup>
79+
<!-- Import the SHFB build targets -->
80+
<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
81+
<!-- The pre-build and post-build event properties must appear *after* the targets file import in order to be
82+
evaluated correctly. -->
83+
<PropertyGroup>
84+
<PreBuildEvent>
85+
</PreBuildEvent>
86+
<PostBuildEvent>
87+
</PostBuildEvent>
88+
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
89+
</PropertyGroup>
90+
<ItemGroup>
91+
<ProjectReference Include="..\client\OneTrueError.Client\OneTrueError.Client.csproj">
92+
<Name>OneTrueError.Client</Name>
93+
<Project>{41E7B66F-91A4-4DB0-AE6F-6C8EC9740031}</Project>
94+
</ProjectReference>
95+
</ItemGroup>
96+
</Project>

0 commit comments

Comments
 (0)