@@ -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 ( ) ;
0 commit comments