11namespace Codebreaker . WinForms ;
22
3+ using Codebreaker . ViewModels . Contracts . Services ;
4+ using Codebreaker . ViewModels . Models ;
5+
36/// <summary>
47/// Main form for the Codebreaker game.
58/// </summary>
69public partial class MainForm : Form
710{
811 private readonly GamePageViewModel _viewModel ;
912 private readonly IInfoBarService _infoBarService ;
10-
13+
1114 // UI Controls
1215 private Panel _startGamePanel = default ! ;
1316 private TextBox _usernameTextBox = default ! ;
@@ -20,6 +23,7 @@ public partial class MainForm : Form
2023 private ListBox _movesListBox = default ! ;
2124 private Label _statusLabel = default ! ;
2225 private ProgressBar _progressBar = default ! ;
26+
2327 private TextBox _infoBarTextBox = default ! ;
2428
2529 public MainForm ( )
@@ -71,7 +75,6 @@ private void InitializeComponent()
7175 _movesListBox . DrawItem += MovesListBox_DrawItem ;
7276 _movesListBox . MeasureItem += MovesListBox_MeasureItem ;
7377 mainLayout . Controls . Add ( _movesListBox , 0 , 1 ) ;
74-
7578 // 4. Status panel
7679 var statusPanel = new Panel { Dock = DockStyle . Fill } ;
7780 _statusLabel = new Label
@@ -188,7 +191,7 @@ private void SetupDataBindings()
188191
189192 private void ViewModel_PropertyChanged ( object ? sender , PropertyChangedEventArgs e )
190193 {
191- this . Invoke ( ( ) =>
194+ Invoke ( ( ) =>
192195 {
193196 if ( e . PropertyName == nameof ( GamePageViewModel . GameStatus ) )
194197 {
@@ -214,7 +217,7 @@ private void ViewModel_PropertyChanged(object? sender, PropertyChangedEventArgs
214217
215218 private void Messages_CollectionChanged ( object ? sender , System . Collections . Specialized . NotifyCollectionChangedEventArgs e )
216219 {
217- this . Invoke ( ( ) =>
220+ Invoke ( ( ) =>
218221 {
219222 if ( e . NewItems != null )
220223 {
@@ -363,7 +366,7 @@ private void MovesListBox_DrawItem(object? sender, DrawItemEventArgs e)
363366 int spacing = 5 ;
364367
365368 // Draw guess pegs
366- for ( int i = 0 ; i < move . GuessPegs . Length ; i ++ )
369+ for ( int i = 0 ; i < move . GuessPegs . Count ; i ++ )
367370 {
368371 var colorName = move . GuessPegs [ i ] ;
369372 var color = Helpers . ColorHelper . GetColorFromName ( colorName ) ;
0 commit comments