- 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.
56 lines
1.3 KiB
C#
56 lines
1.3 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using System;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
|
|
namespace ImageCatalog_2.AvaloniaViews;
|
|
|
|
public partial class GeneralTabView : Avalonia.Controls.UserControl
|
|
{
|
|
public GeneralTabView()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void OpenSourceFolder_Click(object? sender, RoutedEventArgs e)
|
|
{
|
|
if (DataContext is DataModel model)
|
|
{
|
|
OpenInExplorer(model.SourcePath);
|
|
}
|
|
}
|
|
|
|
private void OpenDestinationFolder_Click(object? sender, RoutedEventArgs e)
|
|
{
|
|
if (DataContext is DataModel model)
|
|
{
|
|
OpenInExplorer(model.DestinationPath);
|
|
}
|
|
}
|
|
|
|
private static void OpenInExplorer(string? path)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(path))
|
|
{
|
|
return;
|
|
}
|
|
|
|
var normalizedPath = path.Trim().Trim('"');
|
|
try
|
|
{
|
|
if (File.Exists(normalizedPath))
|
|
{
|
|
Process.Start("explorer.exe", $"/select,\"{normalizedPath}\"");
|
|
}
|
|
else if (Directory.Exists(normalizedPath))
|
|
{
|
|
Process.Start(new ProcessStartInfo { FileName = normalizedPath, UseShellExecute = true });
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
// Ignore failures when opening Explorer.
|
|
}
|
|
}
|
|
}
|