Skip to content

Commit 2dc3696

Browse files
committed
Revert "Fix/p0.1 improvements (#57)"
This reverts commit 39d2e41.
1 parent 39d2e41 commit 2dc3696

15 files changed

+83
-1674
lines changed

InfoBox.sln

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InfoBoxCore.Designer", "Inf
1414
EndProject
1515
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InfoBoxCore.Designer.Tests", "InfoBoxCore.Designer.Tests\InfoBoxCore.Designer.Tests.csproj", "{A597A632-9151-4FB3-8696-8830D4B32170}"
1616
EndProject
17-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InfoBoxCore.Tests", "InfoBoxCore.Tests\InfoBoxCore.Tests.csproj", "{B8E7D4C3-6FA2-4A18-9C5E-1D2B8F3E9A7C}"
18-
EndProject
1917
Global
2018
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2119
Debug|Any CPU = Debug|Any CPU
@@ -42,10 +40,6 @@ Global
4240
{A597A632-9151-4FB3-8696-8830D4B32170}.Debug|Any CPU.Build.0 = Debug|Any CPU
4341
{A597A632-9151-4FB3-8696-8830D4B32170}.Release|Any CPU.ActiveCfg = Release|Any CPU
4442
{A597A632-9151-4FB3-8696-8830D4B32170}.Release|Any CPU.Build.0 = Release|Any CPU
45-
{B8E7D4C3-6FA2-4A18-9C5E-1D2B8F3E9A7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
46-
{B8E7D4C3-6FA2-4A18-9C5E-1D2B8F3E9A7C}.Debug|Any CPU.Build.0 = Debug|Any CPU
47-
{B8E7D4C3-6FA2-4A18-9C5E-1D2B8F3E9A7C}.Release|Any CPU.ActiveCfg = Release|Any CPU
48-
{B8E7D4C3-6FA2-4A18-9C5E-1D2B8F3E9A7C}.Release|Any CPU.Build.0 = Release|Any CPU
4943
EndGlobalSection
5044
GlobalSection(SolutionProperties) = preSolution
5145
HideSolutionNode = FALSE

InfoBox/Abstractions/ITextMeasurement.cs

Lines changed: 0 additions & 55 deletions
This file was deleted.

InfoBox/Form/InformationBoxForm.cs

Lines changed: 83 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,6 @@ internal partial class InformationBoxForm : Form
7979
/// </summary>
8080
private readonly Graphics measureGraphics;
8181

82-
/// <summary>
83-
/// Text measurement abstraction for testability (P0.2)
84-
/// </summary>
85-
private readonly Abstractions.ITextMeasurement textMeasurement;
86-
87-
/// <summary>
88-
/// Presenter containing testable business logic (P0.1)
89-
/// </summary>
90-
private Presentation.InformationBoxPresenter presenter;
91-
9282
/// <summary>
9383
/// Contains a reference to the active form
9484
/// </summary>
@@ -298,14 +288,11 @@ internal InformationBoxForm(string text,
298288
InformationBoxSound sound = InformationBoxSound.Default)
299289
{
300290
this.InitializeComponent();
301-
// [P0.2 COMPLETED] Text measurement abstraction implemented
302-
// See TESTABILITY_ROADMAP.md - ITextMeasurement enables headless testing
291+
// TODO: [P0.2] Replace CreateGraphics with ITextMeasurement interface injection
292+
// See TESTABILITY_ROADMAP.md - this prevents headless testing
303293
this.measureGraphics = CreateGraphics();
304294
this.measureGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
305295

306-
// Initialize text measurement abstraction (P0.2 - COMPLETED)
307-
this.textMeasurement = new Implementation.GraphicsTextMeasurement(this.measureGraphics);
308-
309296
// TODO: [P1.3] Replace SystemFonts with ISystemResources interface injection
310297
// See TESTABILITY_ROADMAP.md - this prevents testing without system fonts
311298
// Apply default font for message boxes
@@ -604,45 +591,6 @@ internal InformationBoxForm(string text, params object[] parameters)
604591

605592
#endregion Constructors
606593

607-
#region Presenter
608-
609-
/// <summary>
610-
/// Initializes the presenter with current form state.
611-
/// </summary>
612-
private void InitializePresenter()
613-
{
614-
var model = new Presentation.InformationBoxModel
615-
{
616-
Text = this.messageText.Text,
617-
Title = this.Text,
618-
Font = this.messageText.Font,
619-
Buttons = this.buttons,
620-
Icon = this.icon,
621-
CustomIcon = this.customIcon,
622-
DefaultButton = this.defaultButton,
623-
ButtonsLayout = this.buttonsLayout,
624-
AutoSizeMode = this.autoSizeMode,
625-
Position = this.position,
626-
CheckBox = this.checkBox,
627-
Style = this.style,
628-
AutoClose = this.autoClose,
629-
Design = this.design,
630-
FontParameters = this.fontParameters,
631-
TitleStyle = this.titleStyle,
632-
TitleIcon = this.titleIcon,
633-
ShowHelpButton = this.showHelpButton,
634-
HelpNavigator = this.helpNavigator,
635-
CustomButtons = new string[] { this.buttonUser1Text, this.buttonUser2Text, this.buttonUser3Text },
636-
WorkingArea = Screen.FromControl(this).WorkingArea,
637-
IconPanelWidth = IconPanelWidth,
638-
BorderPadding = BorderPadding
639-
};
640-
641-
this.presenter = new Presentation.InformationBoxPresenter(model, this.textMeasurement);
642-
}
643-
644-
#endregion Presenter
645-
646594
#region Show
647595

648596
/// <summary>
@@ -651,7 +599,6 @@ private void InitializePresenter()
651599
/// <returns>The result corresponding to the button clicked</returns>
652600
internal new InformationBoxResult Show()
653601
{
654-
this.InitializePresenter();
655602
this.SetCheckBox();
656603
this.SetButtons();
657604
this.SetFont();
@@ -1394,18 +1341,87 @@ private void SetText()
13941341
/// </summary>
13951342
private void SetButtons()
13961343
{
1397-
// P0.1: Now using presenter for button generation logic
1398-
// This provides testable business logic without WinForms dependencies
1399-
var customButtonTexts = new string[] { this.buttonUser1Text, this.buttonUser2Text, this.buttonUser3Text };
1400-
var buttonDefinitions = this.presenter.GetButtons(
1401-
customButtonTexts,
1402-
this.showHelpButton,
1403-
!String.IsNullOrEmpty(this.helpFile));
1404-
1405-
// Create WinForms buttons from definitions
1406-
foreach (var buttonDef in buttonDefinitions)
1407-
{
1408-
this.AddButton(buttonDef.Name, buttonDef.Text);
1344+
// TODO: [P0.1] Extract button generation logic to InformationBoxPresenter.GetButtons()
1345+
// See TESTABILITY_ROADMAP.md - this logic should return List<ButtonDefinition> without WinForms dependencies
1346+
// Abort button
1347+
if (this.buttons == InformationBoxButtons.AbortRetryIgnore)
1348+
{
1349+
this.AddButton("Abort", Resources.LabelAbort);
1350+
}
1351+
1352+
// Ok
1353+
if (this.buttons == InformationBoxButtons.OK ||
1354+
this.buttons == InformationBoxButtons.OKCancel ||
1355+
this.buttons == InformationBoxButtons.OKCancelUser1)
1356+
{
1357+
this.AddButton("OK", Resources.LabelOK);
1358+
}
1359+
1360+
// Yes
1361+
if (this.buttons == InformationBoxButtons.YesNo ||
1362+
this.buttons == InformationBoxButtons.YesNoCancel ||
1363+
this.buttons == InformationBoxButtons.YesNoUser1)
1364+
{
1365+
this.AddButton("Yes", Resources.LabelYes);
1366+
}
1367+
1368+
// Retry
1369+
if (this.buttons == InformationBoxButtons.AbortRetryIgnore ||
1370+
this.buttons == InformationBoxButtons.RetryCancel)
1371+
{
1372+
this.AddButton("Retry", Resources.LabelRetry);
1373+
}
1374+
1375+
// No
1376+
if (this.buttons == InformationBoxButtons.YesNo ||
1377+
this.buttons == InformationBoxButtons.YesNoCancel ||
1378+
this.buttons == InformationBoxButtons.YesNoUser1)
1379+
{
1380+
this.AddButton("No", Resources.LabelNo);
1381+
}
1382+
1383+
// Cancel
1384+
if (this.buttons == InformationBoxButtons.OKCancel ||
1385+
this.buttons == InformationBoxButtons.OKCancelUser1 ||
1386+
this.buttons == InformationBoxButtons.RetryCancel ||
1387+
this.buttons == InformationBoxButtons.YesNoCancel)
1388+
{
1389+
this.AddButton("Cancel", Resources.LabelCancel);
1390+
}
1391+
1392+
// Ignore
1393+
if (this.buttons == InformationBoxButtons.AbortRetryIgnore)
1394+
{
1395+
this.AddButton("Ignore", Resources.LabelIgnore);
1396+
}
1397+
1398+
// User1
1399+
if (this.buttons == InformationBoxButtons.OKCancelUser1 ||
1400+
this.buttons == InformationBoxButtons.User1User2User3 ||
1401+
this.buttons == InformationBoxButtons.User1User2 ||
1402+
this.buttons == InformationBoxButtons.YesNoUser1 ||
1403+
this.buttons == InformationBoxButtons.User1)
1404+
{
1405+
this.AddButton("User1", this.buttonUser1Text);
1406+
}
1407+
1408+
// User2
1409+
if (this.buttons == InformationBoxButtons.User1User2 ||
1410+
this.buttons == InformationBoxButtons.User1User2User3)
1411+
{
1412+
this.AddButton("User2", this.buttonUser2Text);
1413+
}
1414+
1415+
// User3
1416+
if (this.buttons == InformationBoxButtons.User1User2User3)
1417+
{
1418+
this.AddButton("User3", this.buttonUser3Text);
1419+
}
1420+
1421+
// Help button is displayed when asked or when a help file name exists
1422+
if (this.showHelpButton || !String.IsNullOrEmpty(this.helpFile))
1423+
{
1424+
this.AddButton("Help", Resources.LabelHelp);
14091425
}
14101426

14111427
this.SetButtonsSize();

InfoBox/Implementation/GraphicsTextMeasurement.cs

Lines changed: 0 additions & 85 deletions
This file was deleted.

InfoBox/InfoBox.csproj

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@
112112
<PackageReference Include="System.Resources.Extensions" Version="10.0.2" PrivateAssets="none" />
113113
</ItemGroup>
114114
<ItemGroup>
115-
<Compile Include="Abstractions\ITextMeasurement.cs" />
116115
<Compile Include="AsyncResultCallback.cs" />
117116
<Compile Include="Context\InformationBoxScope.cs" />
118117
<Compile Include="Context\InformationBoxScopeBehavior.cs" />
@@ -157,7 +156,6 @@
157156
<Compile Include="Form\InformationBoxForm.Designer.cs">
158157
<DependentUpon>InformationBoxForm.cs</DependentUpon>
159158
</Compile>
160-
<Compile Include="Implementation\GraphicsTextMeasurement.cs" />
161159
<Compile Include="InformationBox.cs" />
162160
<Compile Include="Enums\AutoCloseDefinedParameters.cs" />
163161
<Compile Include="Internals\IconHelper.cs" />
@@ -166,11 +164,6 @@
166164
<Compile Include="Parameters\DesignParameters.cs" />
167165
<Compile Include="Parameters\FontParameters.cs" />
168166
<Compile Include="Parameters\InformationBoxTitleIcon.cs" />
169-
<Compile Include="Presentation\AutoCloseState.cs" />
170-
<Compile Include="Presentation\ButtonDefinition.cs" />
171-
<Compile Include="Presentation\InformationBoxModel.cs" />
172-
<Compile Include="Presentation\InformationBoxPresenter.cs" />
173-
<Compile Include="Presentation\LayoutCalculation.cs" />
174167
<Compile Include="Properties\AssemblyInfo.cs" />
175168
<Compile Include="Properties\Resources.Designer.cs">
176169
<AutoGen>True</AutoGen>

0 commit comments

Comments
 (0)