feat: Add EXIF data removal option and update related UI bindings
Some checks failed
Build Windows Avalonia / build (push) Failing after 2m32s
Some checks failed
Build Windows Avalonia / build (push) Failing after 2m32s
This commit is contained in:
parent
e9142df97c
commit
fc0598e2fb
10 changed files with 104 additions and 72 deletions
|
|
@ -12,6 +12,7 @@ public sealed class LiteCatalogViewModel : ViewModelBase
|
|||
private readonly ILogger<LiteCatalogViewModel> _logger;
|
||||
private CatalogLiteConfiguration? _configuration;
|
||||
private CancellationTokenSource? _processingTokenSource;
|
||||
private string _configurationPath = string.Empty;
|
||||
private string _sourcePath = string.Empty;
|
||||
private string _destinationPath = string.Empty;
|
||||
private string _processingStatus = "Caricamento configurazione incorporata...";
|
||||
|
|
@ -52,6 +53,16 @@ public sealed class LiteCatalogViewModel : ViewModelBase
|
|||
public AsyncCommand StartProcessingCommand { get; }
|
||||
public AsyncCommand StopProcessingCommand { get; }
|
||||
|
||||
public string ConfigurationPath
|
||||
{
|
||||
get => _configurationPath;
|
||||
private set
|
||||
{
|
||||
_configurationPath = value;
|
||||
NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string SourcePath
|
||||
{
|
||||
get => _sourcePath;
|
||||
|
|
@ -172,6 +183,7 @@ public sealed class LiteCatalogViewModel : ViewModelBase
|
|||
var configuration = _configurationLoader.LoadEmbedded(_picSettings);
|
||||
|
||||
_configuration = configuration;
|
||||
ConfigurationPath = configuration.FilePath;
|
||||
SourcePath = configuration.SourcePath;
|
||||
DestinationPath = configuration.DestinationPath;
|
||||
NotifyPropertyChanged(nameof(HorizontalText));
|
||||
|
|
|
|||
|
|
@ -8,8 +8,16 @@
|
|||
Height="560"
|
||||
MinWidth="640"
|
||||
MinHeight="500">
|
||||
<Grid Margin="16" RowDefinitions="Auto,Auto,*,Auto" RowSpacing="12">
|
||||
<Grid ColumnDefinitions="150,*,104,72" ColumnSpacing="10">
|
||||
<Grid Margin="16" RowDefinitions="Auto,Auto,Auto,Auto,*,Auto" RowSpacing="12">
|
||||
<Grid ColumnDefinitions="150,*" ColumnSpacing="10">
|
||||
<TextBlock Text="Configurazione" VerticalAlignment="Center" FontWeight="SemiBold" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding ConfigurationPath}"
|
||||
IsReadOnly="True"
|
||||
Watermark="Configurazione incorporata" />
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="1" ColumnDefinitions="150,*,116" ColumnSpacing="10">
|
||||
<TextBlock Text="Sorgente" VerticalAlignment="Center" FontWeight="SemiBold" />
|
||||
<TextBox Grid.Column="1" Text="{Binding SourcePath, Mode=TwoWay}" Watermark="Cartella sorgente" />
|
||||
<Button Grid.Column="2" Command="{Binding SelectSourceFolderCommand}" ToolTip.Tip="Seleziona cartella sorgente">
|
||||
|
|
@ -18,15 +26,9 @@
|
|||
<TextBlock Text="Scegli" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Grid.Column="3" Click="OpenSourcePath_Click" ToolTip.Tip="Apri cartella sorgente in Esplora file">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="6">
|
||||
<iconPacks:PackIconMaterial Kind="Folder" Width="16" Height="16" />
|
||||
<TextBlock Text="Apri" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="1" ColumnDefinitions="150,*,104,72" ColumnSpacing="10">
|
||||
<Grid Grid.Row="2" ColumnDefinitions="150,*,116" ColumnSpacing="10">
|
||||
<TextBlock Text="Destinazione" VerticalAlignment="Center" FontWeight="SemiBold" />
|
||||
<TextBox Grid.Column="1" Text="{Binding DestinationPath, Mode=TwoWay}" Watermark="Cartella destinazione" />
|
||||
<Button Grid.Column="2" Command="{Binding SelectDestinationFolderCommand}" ToolTip.Tip="Seleziona cartella destinazione">
|
||||
|
|
@ -35,15 +37,9 @@
|
|||
<TextBlock Text="Scegli" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Grid.Column="3" Click="OpenDestinationPath_Click" ToolTip.Tip="Apri cartella destinazione in Esplora file">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="6">
|
||||
<iconPacks:PackIconMaterial Kind="Folder" Width="16" Height="16" />
|
||||
<TextBlock Text="Apri" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
<Border Grid.Row="2"
|
||||
<Border Grid.Row="3"
|
||||
Background="{DynamicResource PanelBackgroundBrush}"
|
||||
BorderBrush="{DynamicResource BorderMutedBrush}"
|
||||
BorderThickness="1"
|
||||
|
|
@ -68,7 +64,7 @@
|
|||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="3"
|
||||
<Border Grid.Row="4"
|
||||
Background="{DynamicResource PanelBackgroundBrush}"
|
||||
BorderBrush="{DynamicResource BorderMutedBrush}"
|
||||
BorderThickness="1"
|
||||
|
|
@ -89,7 +85,7 @@
|
|||
</Grid>
|
||||
</Border>
|
||||
|
||||
<StackPanel Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right" Spacing="10">
|
||||
<StackPanel Grid.Row="5" Orientation="Horizontal" HorizontalAlignment="Right" Spacing="10">
|
||||
<Button Command="{Binding StartProcessingCommand}" MinWidth="112" ToolTip.Tip="Avvia elaborazione">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="7">
|
||||
<iconPacks:PackIconMaterial Kind="PlayCircleOutline" Width="16" Height="16" Foreground="{DynamicResource AccentBrush}" />
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ using Avalonia.Controls;
|
|||
using Avalonia.Platform.Storage;
|
||||
using Avalonia.Threading;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
namespace CatalogLite;
|
||||
|
||||
|
|
@ -55,16 +53,6 @@ public partial class MainWindow : Window
|
|||
}
|
||||
}
|
||||
|
||||
private void OpenSourcePath_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
OpenInExplorer(_viewModel.SourcePath);
|
||||
}
|
||||
|
||||
private void OpenDestinationPath_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
OpenInExplorer(_viewModel.DestinationPath);
|
||||
}
|
||||
|
||||
private async void OnShowMessageRequested(object? sender, LiteMessageEventArgs e)
|
||||
{
|
||||
await ShowMessageDialogAsync(e.Title, e.Message);
|
||||
|
|
@ -108,46 +96,4 @@ public partial class MainWindow : Window
|
|||
closeButton.Click += (_, _) => dialog.Close();
|
||||
await dialog.ShowDialog(this);
|
||||
}
|
||||
|
||||
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}\"");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Directory.Exists(normalizedPath))
|
||||
{
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = normalizedPath,
|
||||
UseShellExecute = true
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
var containingDirectory = Path.GetDirectoryName(normalizedPath);
|
||||
if (!string.IsNullOrWhiteSpace(containingDirectory) && Directory.Exists(containingDirectory))
|
||||
{
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = containingDirectory,
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue