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:
parent
6a5173a20d
commit
214e540170
4 changed files with 229 additions and 16 deletions
|
|
@ -836,8 +836,22 @@ namespace ImageCatalog_2
|
|||
get => _showPhotoNumber;
|
||||
set
|
||||
{
|
||||
if (_showPhotoNumber == value) return;
|
||||
_showPhotoNumber = value;
|
||||
if (value)
|
||||
{
|
||||
// ensure mutually exclusive choices
|
||||
_addTimeToThumbnails = false;
|
||||
_addTextToThumbnails = false;
|
||||
_addNumberAndTimeToThumbnails = false;
|
||||
_addRaceTimeToThumbnails = false;
|
||||
NotifyPropertyChanged(nameof(AddTimeToThumbnails));
|
||||
NotifyPropertyChanged(nameof(AddTextToThumbnails));
|
||||
NotifyPropertyChanged(nameof(AddNumberAndTimeToThumbnails));
|
||||
NotifyPropertyChanged(nameof(AddRaceTimeToThumbnails));
|
||||
}
|
||||
NotifyPropertyChanged();
|
||||
NotifyPropertyChanged(nameof(ThumbnailMode));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -949,7 +963,20 @@ namespace ImageCatalog_2
|
|||
get => _addTimeToThumbnails;
|
||||
set
|
||||
{
|
||||
if (_addTimeToThumbnails == value) return;
|
||||
_addTimeToThumbnails = value;
|
||||
if (value)
|
||||
{
|
||||
// ensure mutually exclusive choices
|
||||
_addTextToThumbnails = false;
|
||||
_showPhotoNumber = false;
|
||||
_addNumberAndTimeToThumbnails = false;
|
||||
_addRaceTimeToThumbnails = false;
|
||||
NotifyPropertyChanged(nameof(AddTextToThumbnails));
|
||||
NotifyPropertyChanged(nameof(ShowPhotoNumber));
|
||||
NotifyPropertyChanged(nameof(AddNumberAndTimeToThumbnails));
|
||||
NotifyPropertyChanged(nameof(AddRaceTimeToThumbnails));
|
||||
}
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
|
@ -1004,7 +1031,20 @@ namespace ImageCatalog_2
|
|||
get => _addTextToThumbnails;
|
||||
set
|
||||
{
|
||||
if (_addTextToThumbnails == value) return;
|
||||
_addTextToThumbnails = value;
|
||||
if (value)
|
||||
{
|
||||
// ensure mutually exclusive choices
|
||||
_addTimeToThumbnails = false;
|
||||
_showPhotoNumber = false;
|
||||
_addNumberAndTimeToThumbnails = false;
|
||||
_addRaceTimeToThumbnails = false;
|
||||
NotifyPropertyChanged(nameof(AddTimeToThumbnails));
|
||||
NotifyPropertyChanged(nameof(ShowPhotoNumber));
|
||||
NotifyPropertyChanged(nameof(AddNumberAndTimeToThumbnails));
|
||||
NotifyPropertyChanged(nameof(AddRaceTimeToThumbnails));
|
||||
}
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
|
@ -1015,7 +1055,20 @@ namespace ImageCatalog_2
|
|||
get => _addRaceTimeToThumbnails;
|
||||
set
|
||||
{
|
||||
if (_addRaceTimeToThumbnails == value) return;
|
||||
_addRaceTimeToThumbnails = value;
|
||||
if (value)
|
||||
{
|
||||
// ensure mutually exclusive choices
|
||||
_addTimeToThumbnails = false;
|
||||
_addTextToThumbnails = false;
|
||||
_showPhotoNumber = false;
|
||||
_addNumberAndTimeToThumbnails = false;
|
||||
NotifyPropertyChanged(nameof(AddTimeToThumbnails));
|
||||
NotifyPropertyChanged(nameof(AddTextToThumbnails));
|
||||
NotifyPropertyChanged(nameof(ShowPhotoNumber));
|
||||
NotifyPropertyChanged(nameof(AddNumberAndTimeToThumbnails));
|
||||
}
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
|
@ -1026,11 +1079,79 @@ namespace ImageCatalog_2
|
|||
get => _addNumberAndTimeToThumbnails;
|
||||
set
|
||||
{
|
||||
if (_addNumberAndTimeToThumbnails == value) return;
|
||||
_addNumberAndTimeToThumbnails = value;
|
||||
if (value)
|
||||
{
|
||||
// ensure mutually exclusive choices
|
||||
_addTimeToThumbnails = false;
|
||||
_addTextToThumbnails = false;
|
||||
_showPhotoNumber = false;
|
||||
_addRaceTimeToThumbnails = false;
|
||||
NotifyPropertyChanged(nameof(AddTimeToThumbnails));
|
||||
NotifyPropertyChanged(nameof(AddTextToThumbnails));
|
||||
NotifyPropertyChanged(nameof(ShowPhotoNumber));
|
||||
NotifyPropertyChanged(nameof(AddRaceTimeToThumbnails));
|
||||
}
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
// Single authoritative thumbnail mode string to avoid conflicting bindings
|
||||
// Possible values: "None", "Text", "Time", "Number", "NumberAndTime", "RaceTime"
|
||||
public string ThumbnailMode
|
||||
{
|
||||
get
|
||||
{
|
||||
if (AddTextToThumbnails) return "Text";
|
||||
if (AddTimeToThumbnails) return "Time";
|
||||
if (ShowPhotoNumber) return "Number";
|
||||
if (AddNumberAndTimeToThumbnails) return "NumberAndTime";
|
||||
if (AddRaceTimeToThumbnails) return "RaceTime";
|
||||
return "None";
|
||||
}
|
||||
set
|
||||
{
|
||||
var current = ThumbnailMode;
|
||||
if (string.Equals(current, value, StringComparison.OrdinalIgnoreCase)) return;
|
||||
|
||||
// Set the boolean flags via their public setters so mutual-exclusion logic runs
|
||||
switch ((value ?? string.Empty).ToLowerInvariant())
|
||||
{
|
||||
case "text":
|
||||
AddTextToThumbnails = true;
|
||||
break;
|
||||
case "time":
|
||||
AddTimeToThumbnails = true;
|
||||
break;
|
||||
case "number":
|
||||
ShowPhotoNumber = true;
|
||||
break;
|
||||
case "numberandtime":
|
||||
AddNumberAndTimeToThumbnails = true;
|
||||
break;
|
||||
case "racetime":
|
||||
AddRaceTimeToThumbnails = true;
|
||||
break;
|
||||
default:
|
||||
// clear all
|
||||
_addTimeToThumbnails = false;
|
||||
_addTextToThumbnails = false;
|
||||
_showPhotoNumber = false;
|
||||
_addRaceTimeToThumbnails = false;
|
||||
_addNumberAndTimeToThumbnails = false;
|
||||
NotifyPropertyChanged(nameof(AddTimeToThumbnails));
|
||||
NotifyPropertyChanged(nameof(AddTextToThumbnails));
|
||||
NotifyPropertyChanged(nameof(ShowPhotoNumber));
|
||||
NotifyPropertyChanged(nameof(AddRaceTimeToThumbnails));
|
||||
NotifyPropertyChanged(nameof(AddNumberAndTimeToThumbnails));
|
||||
break;
|
||||
}
|
||||
|
||||
NotifyPropertyChanged(nameof(ThumbnailMode));
|
||||
}
|
||||
}
|
||||
|
||||
// Image processing progress and status
|
||||
private string _processingStatus = "";
|
||||
public string ProcessingStatus
|
||||
|
|
@ -1132,6 +1253,24 @@ namespace ImageCatalog_2
|
|||
|
||||
// Update PicSettings from DataModel using AutoMapper
|
||||
_mapper.Map(this, _picSettings);
|
||||
// Explicitly ensure thumbnail-related flags are applied to PicSettings
|
||||
// because AutoMapper may not map differently-named properties.
|
||||
try
|
||||
{
|
||||
_picSettings.AggiungiScritteMiniature = this.AddTextToThumbnails;
|
||||
_picSettings.UsaOrarioMiniatura = this.AddTimeToThumbnails;
|
||||
_picSettings.AggNumTempMin = this.AddNumberAndTimeToThumbnails;
|
||||
_picSettings.AggTempoGaraMin = this.AddRaceTimeToThumbnails;
|
||||
_picSettings.CreaMiniature = this.CreateThumbnails;
|
||||
_picSettings.LarghezzaSmall = this.ThumbnailWidth;
|
||||
_picSettings.AltezzaSmall = this.ThumbnailHeight;
|
||||
_picSettings.DimMin = this.FontSizeThumbnail;
|
||||
_picSettings.JpegQualityMin = this.JpegQualityThumbnail;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Best-effort; do not fail processing on mapping issues
|
||||
}
|
||||
|
||||
var imageCreationOptions = new ImageCreationStuff.Options
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue