Mutually exclusive thumbnail mode selection in UI

Implement mutually exclusive logic for thumbnail display modes in DataModel and MainForm. Add ThumbnailMode property for authoritative state. Replace radio button bindings with event handlers. Synchronize UI with model changes. Explicitly map thumbnail flags to PicSettings. Force WinForms startup, disabling WPF branch.
This commit is contained in:
MaddoScientisto 2026-02-16 18:58:15 +01:00
commit 214e540170
4 changed files with 229 additions and 16 deletions

View file

@ -83,6 +83,55 @@ public partial class MainForm
// Watch for model changes so we can reflect external updates
Model.PropertyChanged += Model_PropertyChanged;
// Fix thumbnail radio buttons: clear designer bindings to avoid binding vs click conflicts
RadioButton3.DataBindings.Clear();
RadioButton4.DataBindings.Clear();
RadioButton5.DataBindings.Clear();
RadioButton6.DataBindings.Clear();
RadioButton7.DataBindings.Clear();
// Initialize radio state from model (thumbnail options)
try
{
_suppressRadioUpdates = true;
RadioButton3.Checked = Model.AddTextToThumbnails;
RadioButton4.Checked = Model.AddTimeToThumbnails;
RadioButton6.Checked = Model.ShowPhotoNumber;
RadioButton7.Checked = Model.AddNumberAndTimeToThumbnails;
RadioButton5.Checked = Model.AddRaceTimeToThumbnails;
}
finally
{
_suppressRadioUpdates = false;
}
// Use CheckedChanged handlers to set the authoritative ThumbnailMode on the model
RadioButton3.CheckedChanged += (s, ev) =>
{
if (_suppressRadioUpdates) return;
if (RadioButton3.Checked) Model.ThumbnailMode = "Text";
};
RadioButton4.CheckedChanged += (s, ev) =>
{
if (_suppressRadioUpdates) return;
if (RadioButton4.Checked) Model.ThumbnailMode = "Time";
};
RadioButton6.CheckedChanged += (s, ev) =>
{
if (_suppressRadioUpdates) return;
if (RadioButton6.Checked) Model.ThumbnailMode = "Number";
};
RadioButton7.CheckedChanged += (s, ev) =>
{
if (_suppressRadioUpdates) return;
if (RadioButton7.Checked) Model.ThumbnailMode = "NumberAndTime";
};
RadioButton5.CheckedChanged += (s, ev) =>
{
if (_suppressRadioUpdates) return;
if (RadioButton5.Checked) Model.ThumbnailMode = "RaceTime";
};
// Save user preferences on form close instead of immediately when dialogs are used
this.FormClosing += MainForm_FormClosing;
@ -135,6 +184,29 @@ public partial class MainForm
_suppressRadioUpdates = false;
}
}
// Thumbnail mode changes - reflect back to radio buttons
if (e.PropertyName == nameof(Model.ThumbnailMode) ||
e.PropertyName == nameof(Model.AddTextToThumbnails) ||
e.PropertyName == nameof(Model.AddTimeToThumbnails) ||
e.PropertyName == nameof(Model.ShowPhotoNumber) ||
e.PropertyName == nameof(Model.AddNumberAndTimeToThumbnails) ||
e.PropertyName == nameof(Model.AddRaceTimeToThumbnails))
{
try
{
_suppressRadioUpdates = true;
RadioButton3.Checked = Model.AddTextToThumbnails;
RadioButton4.Checked = Model.AddTimeToThumbnails;
RadioButton6.Checked = Model.ShowPhotoNumber;
RadioButton7.Checked = Model.AddNumberAndTimeToThumbnails;
RadioButton5.Checked = Model.AddRaceTimeToThumbnails;
}
finally
{
_suppressRadioUpdates = false;
}
}
}
protected void BindControls()