Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -287,3 +287,4 @@ __pycache__/
*.btm.cs
*.odx.cs
*.xsd.cs
/.claude
14 changes: 11 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@ InformationBox is a Windows Forms library providing a customizable alternative t

## Build Commands

**IMPORTANT:** Always use the full MSBuild path when building this project. MSBuild is located at:
`P:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin\msbuild.exe`

Since the solution targets both .NET Framework 4.8 and .NET Core, use MSBuild instead of dotnet:

```bash
# Build all projects
dotnet build InfoBox.sln
"P:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin\msbuild.exe" InfoBox.sln

# Build with specific configuration
"P:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin\msbuild.exe" InfoBox.sln /p:Configuration=Release

# Build specific framework
dotnet build InfoBoxCore/InfoBoxCore.csproj -f net10.0-windows
# Rebuild all (clean + build)
"P:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin\msbuild.exe" InfoBox.sln /t:Rebuild

# Run tests
dotnet test
Expand Down
18 changes: 12 additions & 6 deletions InfoBox.Designer/InformationBoxDesigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -479,16 +479,22 @@ private AutoCloseParameters GetAutoClose()

if (this.rdbAutoCloseButton.Checked && this.ddlAutoCloseButton.SelectedIndex != -1)
{
return new AutoCloseParameters(
Convert.ToInt32(this.nudAutoCloseSeconds.Value),
(InformationBoxDefaultButton)Enum.Parse(typeof(InformationBoxDefaultButton), this.ddlAutoCloseButton.SelectedItem.ToString()));
if (Enum.TryParse<InformationBoxDefaultButton>(this.ddlAutoCloseButton.SelectedItem.ToString(), out var buttonResult))
{
return new AutoCloseParameters(
Convert.ToInt32(this.nudAutoCloseSeconds.Value),
buttonResult);
}
}

if (this.rdbAutoCloseResult.Checked && this.ddlAutoCloseResult.SelectedIndex != -1)
{
return new AutoCloseParameters(
Convert.ToInt32(this.nudAutoCloseSeconds.Value),
(InformationBoxResult)Enum.Parse(typeof(InformationBoxResult), this.ddlAutoCloseResult.SelectedItem.ToString()));
if (Enum.TryParse<InformationBoxResult>(this.ddlAutoCloseResult.SelectedItem.ToString(), out var resultValue))
{
return new AutoCloseParameters(
Convert.ToInt32(this.nudAutoCloseSeconds.Value),
resultValue);
}
}

return new AutoCloseParameters(Convert.ToInt32(this.nudAutoCloseSeconds.Value));
Expand Down
2 changes: 1 addition & 1 deletion InfoBox.Designer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Johann Blais")]
[assembly: AssemblyProduct("InformationBox Designer")]
[assembly: AssemblyCopyright("Copyright © Johann Blais 2007-2013")]
[assembly: AssemblyCopyright("Copyright © Johann Blais 2007-2026")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down
4 changes: 2 additions & 2 deletions InfoBox.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32819.101
# Visual Studio Version 18
VisualStudioVersion = 18.2.11408.102 d18.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{11BF73EF-1C37-4B34-BB1B-E378D733E8DC}"
EndProject
Expand Down
9 changes: 6 additions & 3 deletions InfoBox/InfoBox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<!-- Required for non-string resources when building with .NET SDK 9+ -->
<GenerateResourceUsePreserializedResources>false</GenerateResourceUsePreserializedResources>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -81,7 +83,7 @@
<CodeContractsUseBaseLine>False</CodeContractsUseBaseLine>
<CodeContractsRunInBackground>True</CodeContractsRunInBackground>
<CodeContractsShowSquigglies>True</CodeContractsShowSquigglies>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
Expand All @@ -101,12 +103,13 @@
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.102" PrivateAssets="all" />
<PackageReference Include="Nuget.CommandLine">
<Version>6.3.4</Version>
<Version>7.0.1</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.Resources.Extensions" Version="10.0.2" PrivateAssets="none" />
</ItemGroup>
<ItemGroup>
<Compile Include="AsyncResultCallback.cs" />
Expand Down
26 changes: 13 additions & 13 deletions InfoBox/InfoBox.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ Stop wasting time developing your own custom MessageBox, everything you need is
- Removed support for .NET 6.0 (Windows)
- Added support for .NET 10.0 (Windows)
</releaseNotes>
<copyright>Copyright 2025</copyright>
<copyright>Copyright 2026</copyright>
<language>en-US</language>
<tags>MessageBox Winforms</tags>
<repository type="git" url="https://github.com/JohannBlais/InformationBox"></repository>
<dependencies>
<group targetFramework="net8.0-windows11.0" />
<group targetFramework="net9.0-windows11.0" />
<group targetFramework="net10.0-windows11.0" />
<group targetFramework="net8.0-windows7.0" />
<group targetFramework="net9.0-windows7.0" />
<group targetFramework="net10.0-windows7.0" />
<group targetFramework="net48" />
</dependencies>
<readme>README.md</readme>
Expand All @@ -36,15 +36,15 @@ Stop wasting time developing your own custom MessageBox, everything you need is
<file src="bin\Release\InfoBox.dll" target="lib\net48\" />
<file src="bin\Release\InfoBox.pdb" target="lib\net48\" />
<file src="bin\Release\**\InfoBox.resources.dll" target="lib\net48\" />
<file src="..\InfoBoxCore\bin\Release\net8.0-windows\InfoBox.dll" target="lib\net8.0-windows11.0\" />
<file src="..\InfoBoxCore\bin\Release\net8.0-windows\InfoBox.pdb" target="lib\net8.0-windows11.0\" />
<file src="..\InfoBoxCore\bin\Release\net8.0-windows\**\InfoBox.resources.dll" target="lib\net8.0-windows11.0\" />
<file src="..\InfoBoxCore\bin\Release\net9.0-windows\InfoBox.dll" target="lib\net9.0-windows11.0\" />
<file src="..\InfoBoxCore\bin\Release\net9.0-windows\InfoBox.pdb" target="lib\net9.0-windows11.0\" />
<file src="..\InfoBoxCore\bin\Release\net9.0-windows\**\InfoBox.resources.dll" target="lib\net9.0-windows11.0\" />
<file src="..\InfoBoxCore\bin\Release\net10.0-windows\InfoBox.dll" target="lib\net10.0-windows11.0\" />
<file src="..\InfoBoxCore\bin\Release\net10.0-windows\InfoBox.pdb" target="lib\net10.0-windows11.0\" />
<file src="..\InfoBoxCore\bin\Release\net10.0-windows\**\InfoBox.resources.dll" target="lib\net10.0-windows11.0\" />
<file src="..\InfoBoxCore\bin\Release\net8.0-windows\InfoBox.dll" target="lib\net8.0-windows7.0\" />
<file src="..\InfoBoxCore\bin\Release\net8.0-windows\InfoBox.pdb" target="lib\net8.0-windows7.0\" />
<file src="..\InfoBoxCore\bin\Release\net8.0-windows\**\InfoBox.resources.dll" target="lib\net8.0-windows7.0\" />
<file src="..\InfoBoxCore\bin\Release\net9.0-windows\InfoBox.dll" target="lib\net9.0-windows7.0\" />
<file src="..\InfoBoxCore\bin\Release\net9.0-windows\InfoBox.pdb" target="lib\net9.0-windows7.0\" />
<file src="..\InfoBoxCore\bin\Release\net9.0-windows\**\InfoBox.resources.dll" target="lib\net9.0-windows7.0\" />
<file src="..\InfoBoxCore\bin\Release\net10.0-windows\InfoBox.dll" target="lib\net10.0-windows7.0\" />
<file src="..\InfoBoxCore\bin\Release\net10.0-windows\InfoBox.pdb" target="lib\net10.0-windows7.0\" />
<file src="..\InfoBoxCore\bin\Release\net10.0-windows\**\InfoBox.resources.dll" target="lib\net10.0-windows7.0\" />
<file src="..\README.md" target="\"/>
<file src="..\Logo.png" target="images\" />
</files>
Expand Down
24 changes: 21 additions & 3 deletions InfoBox/Internals/MessageBoxEnumConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,47 @@ internal static class MessageBoxEnumConverter
/// </summary>
/// <param name="value">The value.</param>
/// <returns>The converted value</returns>
/// <exception cref="ArgumentException">Thrown when conversion fails.</exception>
internal static InformationBoxButtons Parse(MessageBoxButtons value)
{
return (InformationBoxButtons)Enum.Parse(typeof(InformationBoxButtons), value.ToString());
if (Enum.TryParse<InformationBoxButtons>(value.ToString(), out var result))
{
return result;
}

throw new ArgumentException($"Cannot convert '{value}' to InformationBoxButtons", nameof(value));
}

/// <summary>
/// Parses the specified MessageBoxIcon value.
/// </summary>
/// <param name="value">The value.</param>
/// <returns>The converted value</returns>
/// <exception cref="ArgumentException">Thrown when conversion fails.</exception>
internal static InformationBoxIcon Parse(MessageBoxIcon value)
{
return (InformationBoxIcon)Enum.Parse(typeof(InformationBoxIcon), value.ToString());
if (Enum.TryParse<InformationBoxIcon>(value.ToString(), out var result))
{
return result;
}

throw new ArgumentException($"Cannot convert '{value}' to InformationBoxIcon", nameof(value));
}

/// <summary>
/// Parses the specified MessageBoxDefaultButton value.
/// </summary>
/// <param name="value">The value.</param>
/// <returns>The converted value</returns>
/// <exception cref="ArgumentException">Thrown when conversion fails.</exception>
internal static InformationBoxDefaultButton Parse(MessageBoxDefaultButton value)
{
return (InformationBoxDefaultButton)Enum.Parse(typeof(InformationBoxDefaultButton), value.ToString());
if (Enum.TryParse<InformationBoxDefaultButton>(value.ToString(), out var result))
{
return result;
}

throw new ArgumentException($"Cannot convert '{value}' to InformationBoxDefaultButton", nameof(value));
}
}
}
2 changes: 1 addition & 1 deletion InfoBox/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Johann Blais")]
[assembly: AssemblyProduct("InformationBox")]
[assembly: AssemblyCopyright("Copyright © Johann Blais 2007-2022")]
[assembly: AssemblyCopyright("Copyright © Johann Blais 2007-2026")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void Test0001()
order: InformationBoxOrder.Default,
sound: InformationBoxSound.Default);

Assert.IsTrue(CompileCode(code).Success);
Assert.That(CompileCode(code).Success);
}

[Test]
Expand Down Expand Up @@ -113,7 +113,7 @@ public void Test0002()
order: InformationBoxOrder.Default,
sound: InformationBoxSound.Default);

Assert.IsTrue(CompileCode(code).Success);
Assert.That(CompileCode(code).Success);
}

[Test]
Expand Down Expand Up @@ -148,7 +148,7 @@ public void Test0003()
order: InformationBoxOrder.Default,
sound: InformationBoxSound.Default);

Assert.IsTrue(CompileCode(code).Success);
Assert.That(CompileCode(code).Success);
}

[Test]
Expand Down Expand Up @@ -183,7 +183,7 @@ public void Test0004()
order: InformationBoxOrder.Default,
sound: InformationBoxSound.Default);

Assert.IsTrue(CompileCode(code).Success);
Assert.That(CompileCode(code).Success);
}

[Test]
Expand Down Expand Up @@ -218,7 +218,7 @@ public void Test0005()
order: InformationBoxOrder.Default,
sound: InformationBoxSound.Default);

Assert.IsTrue(CompileCode(code).Success);
Assert.That(CompileCode(code).Success);
}

private EmitResult CompileCode(string sourceCode)
Expand Down
14 changes: 9 additions & 5 deletions InfoBoxCore.Designer.Tests/InfoBoxCore.Designer.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
<PropertyGroup>
<TargetFramework>net10.0-windows7.0</TargetFramework>
<IsPackable>false</IsPackable>
<Authors>Johann Blais</Authors>
<Company>Johann Blais</Company>
<Product>InformationBox Designer Tests</Product>
<Copyright>Copyright © Johann Blais 2007-2026</Copyright>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.3.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="5.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" />
<PackageReference Include="NUnit" Version="4.4.0" />
<PackageReference Include="NUnit3TestAdapter" Version="6.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
21 changes: 21 additions & 0 deletions InfoBoxCore.Designer/InfoBoxCore.Designer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<RootNamespace>InfoBox.Designer</RootNamespace>
<AssemblyName>InfoBox.Designer</AssemblyName>
<Authors>Johann Blais</Authors>
<Company>Johann Blais</Company>
<Product>InformationBox Designer</Product>
<Copyright>Copyright © Johann Blais 2007-2026</Copyright>
<NeutralLanguage>en</NeutralLanguage>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net10.0-windows|AnyCPU'">
<WarningLevel>8</WarningLevel>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net10.0-windows|AnyCPU'">
<WarningLevel>8</WarningLevel>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net9.0-windows|AnyCPU'">
<WarningLevel>8</WarningLevel>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net9.0-windows|AnyCPU'">
<WarningLevel>8</WarningLevel>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion InfoBoxCore/InfoBoxCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.102" PrivateAssets="All" />
</ItemGroup>
</Project>
Loading