Update library and fixes
This commit is contained in:
parent
1db874ce77
commit
d73389d791
7 changed files with 50 additions and 14 deletions
|
|
@ -148,6 +148,7 @@ namespace ImageCatalog_2
|
|||
{
|
||||
_uiEnabled = value;
|
||||
NotifyPropertyChanged();
|
||||
NotifyPropertyChanged(nameof(UiDisabled));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@
|
|||
<ProjectReference Include="..\MaddoShared\MaddoShared.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.7" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.7" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.7" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.2" />
|
||||
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
|
|
|
|||
|
|
@ -132,6 +132,16 @@ public partial class MainForm
|
|||
ComboBox5.SelectedItem = Model.LogoVerticalPosition;
|
||||
}
|
||||
|
||||
private void RefreshComboBoxSelections()
|
||||
{
|
||||
// Update ComboBox selections to reflect loaded Model values
|
||||
ComboBox1.SelectedItem = Model.VerticalPosition;
|
||||
ComboBox2.SelectedItem = Model.HorizontalAlignment;
|
||||
ComboBox3.SelectedItem = Model.FontName;
|
||||
ComboBox4.SelectedItem = Model.LogoHorizontalPosition;
|
||||
ComboBox5.SelectedItem = Model.LogoVerticalPosition;
|
||||
}
|
||||
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
|
@ -281,6 +291,9 @@ public partial class MainForm
|
|||
|
||||
await Model.LoadSettingsFromFileAsync(openDialog.FileName);
|
||||
|
||||
// Refresh ComboBox selections to reflect loaded settings
|
||||
RefreshComboBoxSelections();
|
||||
|
||||
// Update logo preview if logo file exists
|
||||
if (File.Exists(Model.LogoFile))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,6 +58,15 @@ namespace ImageCatalog_2.Services
|
|||
if (prop.PropertyType == typeof(string))
|
||||
{
|
||||
value = _parametriSetup.LeggiParametroString(prop.Name);
|
||||
// Don't update if empty string and current value is not empty
|
||||
if (string.IsNullOrEmpty((string)value))
|
||||
{
|
||||
var currentValue = prop.GetValue(settings) as string;
|
||||
if (!string.IsNullOrEmpty(currentValue))
|
||||
{
|
||||
continue; // Skip if no value in settings but there's a default
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (prop.PropertyType == typeof(bool))
|
||||
{
|
||||
|
|
@ -78,9 +87,10 @@ namespace ImageCatalog_2.Services
|
|||
|
||||
prop.SetValue(settings, value);
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Skip properties that can't be loaded
|
||||
System.Diagnostics.Debug.WriteLine($"Failed to load property {prop.Name}: {ex.Message}");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue