Refactor thumbnail options to enum and ComboBox UI

Replaced multiple mutually-exclusive boolean properties for thumbnail text options with a single enum (`ThumbnailOption`) in the data model. Updated WinForms UI to use a ComboBox instead of radio buttons for selecting thumbnail mode. Adjusted designer, mapping profile, settings DTO, and settings service for enum support and backward compatibility. Simplified thumbnail generation logic and improved maintainability by ensuring only one mode can be selected at a time.
This commit is contained in:
MaddoScientisto 2026-02-16 19:55:37 +01:00
commit d13ec8abdf
7 changed files with 214 additions and 289 deletions

View file

@ -14,7 +14,7 @@ namespace ImageCatalog
// Form overrides dispose to clean up the component list.
[DebuggerNonUserCode()]
protected override void Dispose(bool disposing)
{
{
try
{
if (disposing && components is object)
@ -138,12 +138,6 @@ namespace ImageCatalog
GroupBox1 = new GroupBox();
Label46 = new Label();
TextBox33 = new TextBox();
Panel2 = new Panel();
RadioButton3 = new RadioButton();
RadioButton7 = new RadioButton();
RadioButton4 = new RadioButton();
RadioButton6 = new RadioButton();
RadioButton5 = new RadioButton();
Label5 = new Label();
TextBox5 = new TextBox();
Label6 = new Label();
@ -151,8 +145,11 @@ namespace ImageCatalog
Label3 = new Label();
TextBox3 = new TextBox();
CheckBox1 = new CheckBox();
comboThumbnailOption = new ComboBox();
TabPage4 = new TabPage();
GroupBox6 = new GroupBox();
chkUseTransparentColor = new CheckBox();
btnSetTransparency = new Button();
_PictureBox1 = new PictureBox();
ComboBox5 = new ComboBox();
ComboBox4 = new ComboBox();
@ -169,6 +166,7 @@ namespace ImageCatalog
_Button4 = new Button();
TextBox10 = new TextBox();
Label29 = new Label();
PictureBox3 = new PictureBox();
versionLabel = new Label();
_Button7 = new Button();
_Button5 = new Button();
@ -181,10 +179,8 @@ namespace ImageCatalog
_btnCreaCatalogoAsync = new Button();
timer1 = new System.Windows.Forms.Timer(components);
dataModelBindingSource1 = new BindingSource(components);
PictureBox3 = new PictureBox();
colorDialog1 = new ColorDialog();
btnSetTransparency = new Button();
chkUseTransparentColor = new CheckBox();
label16 = new Label();
((System.ComponentModel.ISupportInitialize)bindingSource1).BeginInit();
((System.ComponentModel.ISupportInitialize)dataModelBindingSource).BeginInit();
TabControl1.SuspendLayout();
@ -207,12 +203,11 @@ namespace ImageCatalog
TabPage1.SuspendLayout();
Panel1.SuspendLayout();
GroupBox1.SuspendLayout();
Panel2.SuspendLayout();
TabPage4.SuspendLayout();
GroupBox6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)_PictureBox1).BeginInit();
((System.ComponentModel.ISupportInitialize)dataModelBindingSource1).BeginInit();
((System.ComponentModel.ISupportInitialize)PictureBox3).BeginInit();
((System.ComponentModel.ISupportInitialize)dataModelBindingSource1).BeginInit();
SuspendLayout();
//
// ProgressBar1
@ -1323,9 +1318,9 @@ namespace ImageCatalog
//
// GroupBox1
//
GroupBox1.Controls.Add(label16);
GroupBox1.Controls.Add(Label46);
GroupBox1.Controls.Add(TextBox33);
GroupBox1.Controls.Add(Panel2);
GroupBox1.Controls.Add(Label5);
GroupBox1.Controls.Add(TextBox5);
GroupBox1.Controls.Add(Label6);
@ -1333,6 +1328,7 @@ namespace ImageCatalog
GroupBox1.Controls.Add(Label3);
GroupBox1.Controls.Add(TextBox3);
GroupBox1.Controls.Add(CheckBox1);
GroupBox1.Controls.Add(comboThumbnailOption);
GroupBox1.ForeColor = Color.FromArgb(0, 0, 192);
GroupBox1.Location = new Point(12, 12);
GroupBox1.Margin = new Padding(6, 8, 6, 8);
@ -1362,84 +1358,6 @@ namespace ImageCatalog
TextBox33.Size = new Size(196, 35);
TextBox33.TabIndex = 20;
//
// Panel2
//
Panel2.Controls.Add(RadioButton3);
Panel2.Controls.Add(RadioButton7);
Panel2.Controls.Add(RadioButton4);
Panel2.Controls.Add(RadioButton6);
Panel2.Controls.Add(RadioButton5);
Panel2.Location = new Point(113, 262);
Panel2.Margin = new Padding(6, 8, 6, 8);
Panel2.Name = "Panel2";
Panel2.Size = new Size(470, 207);
Panel2.TabIndex = 19;
//
// RadioButton3
//
RadioButton3.AutoSize = true;
RadioButton3.DataBindings.Add(new Binding("Checked", bindingSource1, "AddTextToThumbnails", true, DataSourceUpdateMode.OnPropertyChanged));
RadioButton3.Location = new Point(30, 38);
RadioButton3.Margin = new Padding(6, 8, 6, 8);
RadioButton3.Name = "RadioButton3";
RadioButton3.Size = new Size(186, 34);
RadioButton3.TabIndex = 14;
RadioButton3.TabStop = true;
RadioButton3.Text = "Aggiungi Scritta";
RadioButton3.UseVisualStyleBackColor = true;
//
// RadioButton7
//
RadioButton7.AutoSize = true;
RadioButton7.DataBindings.Add(new Binding("Checked", bindingSource1, "AddNumberAndTimeToThumbnails", true, DataSourceUpdateMode.OnPropertyChanged));
RadioButton7.Location = new Point(258, 93);
RadioButton7.Margin = new Padding(6, 8, 6, 8);
RadioButton7.Name = "RadioButton7";
RadioButton7.Size = new Size(184, 34);
RadioButton7.TabIndex = 18;
RadioButton7.TabStop = true;
RadioButton7.Text = "numero+tempo";
RadioButton7.UseVisualStyleBackColor = true;
//
// RadioButton4
//
RadioButton4.AutoSize = true;
RadioButton4.DataBindings.Add(new Binding("Checked", bindingSource1, "AddTimeToThumbnails", true, DataSourceUpdateMode.OnPropertyChanged));
RadioButton4.Location = new Point(30, 93);
RadioButton4.Margin = new Padding(6, 8, 6, 8);
RadioButton4.Name = "RadioButton4";
RadioButton4.Size = new Size(182, 34);
RadioButton4.TabIndex = 15;
RadioButton4.TabStop = true;
RadioButton4.Text = "Aggiungi orario";
RadioButton4.UseVisualStyleBackColor = true;
//
// RadioButton6
//
RadioButton6.AutoSize = true;
RadioButton6.DataBindings.Add(new Binding("Checked", bindingSource1, "ShowPhotoNumber", true, DataSourceUpdateMode.OnPropertyChanged));
RadioButton6.Location = new Point(258, 38);
RadioButton6.Margin = new Padding(6, 8, 6, 8);
RadioButton6.Name = "RadioButton6";
RadioButton6.Size = new Size(158, 34);
RadioButton6.TabIndex = 17;
RadioButton6.TabStop = true;
RadioButton6.Text = "Numero foto";
RadioButton6.UseVisualStyleBackColor = true;
//
// RadioButton5
//
RadioButton5.AutoSize = true;
RadioButton5.DataBindings.Add(new Binding("Checked", bindingSource1, "AddRaceTimeToThumbnails", true, DataSourceUpdateMode.OnPropertyChanged));
RadioButton5.Location = new Point(30, 150);
RadioButton5.Margin = new Padding(6, 8, 6, 8);
RadioButton5.Name = "RadioButton5";
RadioButton5.Size = new Size(149, 34);
RadioButton5.TabIndex = 16;
RadioButton5.TabStop = true;
RadioButton5.Text = "Tempo Gara";
RadioButton5.UseVisualStyleBackColor = true;
//
// Label5
//
Label5.AutoSize = true;
@ -1514,6 +1432,15 @@ namespace ImageCatalog
CheckBox1.TabIndex = 5;
CheckBox1.Text = "Crea miniature";
//
// comboThumbnailOption
//
comboThumbnailOption.DropDownStyle = ComboBoxStyle.DropDownList;
comboThumbnailOption.Location = new Point(204, 262);
comboThumbnailOption.Margin = new Padding(6, 8, 6, 8);
comboThumbnailOption.Name = "comboThumbnailOption";
comboThumbnailOption.Size = new Size(470, 38);
comboThumbnailOption.TabIndex = 18;
//
// TabPage4
//
TabPage4.Controls.Add(GroupBox6);
@ -1557,6 +1484,25 @@ namespace ImageCatalog
GroupBox6.TabStop = false;
GroupBox6.Text = "Logo";
//
// chkUseTransparentColor
//
chkUseTransparentColor.AutoSize = true;
chkUseTransparentColor.Location = new Point(39, 461);
chkUseTransparentColor.Name = "chkUseTransparentColor";
chkUseTransparentColor.Size = new Size(210, 34);
chkUseTransparentColor.TabIndex = 46;
chkUseTransparentColor.Text = "Colore trasparente";
chkUseTransparentColor.UseVisualStyleBackColor = true;
//
// btnSetTransparency
//
btnSetTransparency.Location = new Point(288, 455);
btnSetTransparency.Name = "btnSetTransparency";
btnSetTransparency.Size = new Size(131, 40);
btnSetTransparency.TabIndex = 45;
btnSetTransparency.Text = "Imposta";
btnSetTransparency.UseVisualStyleBackColor = true;
//
// _PictureBox1
//
_PictureBox1.Cursor = Cursors.Cross;
@ -1729,6 +1675,17 @@ namespace ImageCatalog
Label29.Text = "Posizione orizzontale";
Label29.TextAlign = ContentAlignment.MiddleLeft;
//
// PictureBox3
//
PictureBox3.BorderStyle = BorderStyle.FixedSingle;
PictureBox3.Location = new Point(432, 442);
PictureBox3.Margin = new Padding(6, 8, 6, 8);
PictureBox3.Name = "PictureBox3";
PictureBox3.Size = new Size(45, 53);
PictureBox3.TabIndex = 44;
PictureBox3.TabStop = false;
PictureBox3.Visible = false;
//
// versionLabel
//
versionLabel.DataBindings.Add(new Binding("Text", bindingSource1, "AppVersion", true));
@ -1844,35 +1801,14 @@ namespace ImageCatalog
//
dataModelBindingSource1.DataSource = typeof(ImageCatalog_2.DataModel);
//
// PictureBox3
// label16
//
PictureBox3.BorderStyle = BorderStyle.FixedSingle;
PictureBox3.Location = new Point(432, 442);
PictureBox3.Margin = new Padding(6, 8, 6, 8);
PictureBox3.Name = "PictureBox3";
PictureBox3.Size = new Size(45, 53);
PictureBox3.TabIndex = 44;
PictureBox3.TabStop = false;
PictureBox3.Visible = false;
//
// btnSetTransparency
//
btnSetTransparency.Location = new Point(288, 455);
btnSetTransparency.Name = "btnSetTransparency";
btnSetTransparency.Size = new Size(131, 40);
btnSetTransparency.TabIndex = 45;
btnSetTransparency.Text = "Imposta";
btnSetTransparency.UseVisualStyleBackColor = true;
//
// chkUseTransparentColor
//
chkUseTransparentColor.AutoSize = true;
chkUseTransparentColor.Location = new Point(39, 461);
chkUseTransparentColor.Name = "chkUseTransparentColor";
chkUseTransparentColor.Size = new Size(210, 34);
chkUseTransparentColor.TabIndex = 46;
chkUseTransparentColor.Text = "Colore trasparente";
chkUseTransparentColor.UseVisualStyleBackColor = true;
label16.AutoSize = true;
label16.Location = new Point(39, 262);
label16.Name = "label16";
label16.Size = new Size(156, 30);
label16.TabIndex = 22;
label16.Text = "Testo Miniature";
//
// MainForm
//
@ -1933,14 +1869,12 @@ namespace ImageCatalog
Panel1.PerformLayout();
GroupBox1.ResumeLayout(false);
GroupBox1.PerformLayout();
Panel2.ResumeLayout(false);
Panel2.PerformLayout();
TabPage4.ResumeLayout(false);
GroupBox6.ResumeLayout(false);
GroupBox6.PerformLayout();
((System.ComponentModel.ISupportInitialize)_PictureBox1).EndInit();
((System.ComponentModel.ISupportInitialize)dataModelBindingSource1).EndInit();
((System.ComponentModel.ISupportInitialize)PictureBox3).EndInit();
((System.ComponentModel.ISupportInitialize)dataModelBindingSource1).EndInit();
ResumeLayout(false);
PerformLayout();
}
@ -2126,12 +2060,7 @@ namespace ImageCatalog
internal GroupBox GroupBox1;
internal Label Label46;
internal TextBox TextBox33;
internal Panel Panel2;
internal RadioButton RadioButton3;
internal RadioButton RadioButton7;
internal RadioButton RadioButton4;
internal RadioButton RadioButton6;
internal RadioButton RadioButton5;
private ComboBox comboThumbnailOption;
internal Label Label5;
internal TextBox TextBox5;
internal Label Label6;
@ -2295,6 +2224,7 @@ namespace ImageCatalog
private ColorDialog colorDialog1;
private Button btnSetTransparency;
private CheckBox chkUseTransparentColor;
private Label label16;
internal Button btnCreaCatalogoAsync
{