Add new tab views for image catalog functionality
- Implement GeneralTabView for source and destination path settings, options, processing parameters, and image library selection. - Create LogoTabView for logo selection, preview, and positioning options. - Add PhotoTabView for photo dimensions and JPEG quality settings. - Introduce RaceUploadTabView for race setup and processed photo upload functionality, including API integration. - Develop TextTabView for horizontal and vertical text settings, font options, and race time configuration. - Implement ThumbnailsTabView for thumbnail creation options and settings.
This commit is contained in:
parent
6cf0c029fc
commit
90fb03bf0c
18 changed files with 1322 additions and 1008 deletions
62
imagecatalog/AvaloniaViews/LogoTabView.axaml.cs
Normal file
62
imagecatalog/AvaloniaViews/LogoTabView.axaml.cs
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Media.Imaging;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
|
||||
namespace ImageCatalog_2.AvaloniaViews;
|
||||
|
||||
public partial class LogoTabView : Avalonia.Controls.UserControl
|
||||
{
|
||||
public LogoTabView()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContextChanged += OnDataContextChanged;
|
||||
}
|
||||
|
||||
private void OnDataContextChanged(object? sender, System.EventArgs e)
|
||||
{
|
||||
if (sender is not LogoTabView)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (DataContext is DataModel model)
|
||||
{
|
||||
model.PropertyChanged -= ModelOnPropertyChanged;
|
||||
model.PropertyChanged += ModelOnPropertyChanged;
|
||||
UpdateLogoPreview(model.LogoFile);
|
||||
}
|
||||
}
|
||||
|
||||
private void ModelOnPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(DataModel.LogoFile) && sender is DataModel model)
|
||||
{
|
||||
UpdateLogoPreview(model.LogoFile);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateLogoPreview(string? path)
|
||||
{
|
||||
var preview = this.FindControl<Avalonia.Controls.Image>("LogoPreview");
|
||||
if (preview is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(path) || !File.Exists(path))
|
||||
{
|
||||
preview.Source = null;
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
preview.Source = new Avalonia.Media.Imaging.Bitmap(path);
|
||||
}
|
||||
catch
|
||||
{
|
||||
preview.Source = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue