This commit is contained in:
parent
ddf47ad51b
commit
d76e133f18
31 changed files with 236 additions and 2592 deletions
|
|
@ -6,12 +6,8 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
#if WINDOWS
|
||||
using System.Drawing.Text;
|
||||
#endif
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
|
|
@ -23,6 +19,7 @@ using AutoMapper;
|
|||
using MaddoShared;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.ObjectModel;
|
||||
using SixLabors.Fonts;
|
||||
|
||||
namespace ImageCatalog_2
|
||||
{
|
||||
|
|
@ -561,16 +558,19 @@ namespace ImageCatalog_2
|
|||
|
||||
private List<string> LoadAvailableFonts()
|
||||
{
|
||||
#if WINDOWS
|
||||
var fonts = new List<string>();
|
||||
using (var installedFonts = new InstalledFontCollection())
|
||||
try
|
||||
{
|
||||
fonts.AddRange(installedFonts.Families.Select(f => f.Name));
|
||||
return SystemFonts.Collection.Families
|
||||
.Select(f => f.Name)
|
||||
.Where(name => !string.IsNullOrWhiteSpace(name))
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.OrderBy(name => name, StringComparer.CurrentCultureIgnoreCase)
|
||||
.ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
return fonts;
|
||||
#else
|
||||
return new List<string>();
|
||||
#endif
|
||||
}
|
||||
|
||||
private CancellationTokenSource? _mainToken;
|
||||
|
|
@ -841,56 +841,6 @@ namespace ImageCatalog_2
|
|||
set => _visual.LogoTransparency = value;
|
||||
}
|
||||
|
||||
// Image library selection (UI radio buttons bind to the boolean helpers)
|
||||
private string _imageLibrary = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "System.Graphics" : "ImageSharp";
|
||||
|
||||
/// <summary>
|
||||
/// Whether the application is running on Windows. Used by cross-platform UIs to show/hide Windows-only options.
|
||||
/// </summary>
|
||||
public bool IsRunningOnWindows => RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
|
||||
/// <summary>
|
||||
/// The selected image processing library. Possible values: "System.Graphics" or "ImageSharp".
|
||||
/// This value is mirrored into PicSettings.ImageCreatorProvider so the runtime mapper picks the implementation.
|
||||
/// </summary>
|
||||
public string ImageLibrary
|
||||
{
|
||||
get => _imageLibrary;
|
||||
set
|
||||
{
|
||||
if (_imageLibrary == value) return;
|
||||
_imageLibrary = value;
|
||||
// Reflect selection into PicSettings so mapper can resolve at runtime
|
||||
_picSettings.ImageCreatorProvider = string.Equals(value, "ImageSharp", StringComparison.OrdinalIgnoreCase)
|
||||
? "ALTERNATE"
|
||||
: "Sharp";
|
||||
NotifyPropertyChanged();
|
||||
NotifyPropertyChanged(nameof(UseSystemGraphics));
|
||||
NotifyPropertyChanged(nameof(UseImageSharp));
|
||||
NotifyPropertyChanged(nameof(IsRunningOnWindows));
|
||||
}
|
||||
}
|
||||
|
||||
public bool UseSystemGraphics
|
||||
{
|
||||
get => string.Equals(ImageLibrary, "System.Graphics", StringComparison.OrdinalIgnoreCase);
|
||||
set
|
||||
{
|
||||
if (value) ImageLibrary = "System.Graphics";
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public bool UseImageSharp
|
||||
{
|
||||
get => string.Equals(ImageLibrary, "ImageSharp", StringComparison.OrdinalIgnoreCase);
|
||||
set
|
||||
{
|
||||
if (value) ImageLibrary = "ImageSharp";
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
// Folder division settings
|
||||
private int _filesPerFolder = 99;
|
||||
public int FilesPerFolder
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue