Refactor path handling in UI components
- Removed redundant folder and file opening methods from AiTabView and FaceAiTabView. - Introduced PathPickerField control to streamline path selection and opening functionality across multiple views. - Updated FaceAiTabView and GeneralTabView to utilize PathPickerField for source and destination path selection. - Created PathShellService to encapsulate logic for opening paths in the file explorer. - Simplified XAML structure by replacing manual grid definitions with PathPickerField components. - Removed unused namespaces and cleaned up code for better readability and maintainability.
This commit is contained in:
parent
f3ac1ea920
commit
398cfa310e
10 changed files with 484 additions and 562 deletions
|
|
@ -1,6 +1,7 @@
|
|||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:avaloniaDataGrid="clr-namespace:Avalonia.Controls;assembly=Avalonia.Controls.DataGrid"
|
||||
xmlns:controls="clr-namespace:ImageCatalog_2.Controls"
|
||||
xmlns:iconPacks="https://github.com/MahApps/IconPacks.Avalonia"
|
||||
x:Class="ImageCatalog_2.AvaloniaViews.AiTabView"
|
||||
x:CompileBindings="False">
|
||||
|
|
@ -31,25 +32,13 @@
|
|||
FontWeight="SemiBold" />
|
||||
</Grid>
|
||||
|
||||
<Grid ColumnDefinitions="Auto,*,Auto,Auto" ColumnSpacing="6">
|
||||
<TextBlock Grid.Column="0" Text="Sorgente:" VerticalAlignment="Center" />
|
||||
<TextBox Grid.Column="1"
|
||||
Text="{Binding DestinationPath, Mode=OneWay}"
|
||||
IsReadOnly="True"
|
||||
VerticalAlignment="Center" />
|
||||
<Button Grid.Column="2" Width="104" Command="{Binding SelectDestinationFolderCommand}">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="6">
|
||||
<iconPacks:PackIconMaterial Kind="FolderOpenOutline" Width="14" Height="14" />
|
||||
<TextBlock Text="Scegli..." />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Grid.Column="3" Width="72" Click="OpenAiSourceFolder_Click">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="6">
|
||||
<iconPacks:PackIconMaterial Kind="Folder" Width="14" Height="14" />
|
||||
<TextBlock Text="Apri" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
<controls:PathPickerField Label="Sorgente:"
|
||||
Text="{Binding DestinationPath, Mode=TwoWay}"
|
||||
IsTextReadOnly="True"
|
||||
PreferenceKey="Picker.DestinationFolder.LastPath"
|
||||
PickerTitle="Seleziona cartella sorgente AI"
|
||||
PickerMode="Folder"
|
||||
AppendDirectorySeparator="True" />
|
||||
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Spacing="8">
|
||||
<Button Command="{Binding StartAiCommand}" Width="132">
|
||||
|
|
@ -67,22 +56,14 @@
|
|||
</StackPanel>
|
||||
|
||||
<TextBlock Text="Output CSV" FontWeight="Bold" />
|
||||
<Grid ColumnDefinitions="Auto,*,Auto,Auto" ColumnSpacing="6">
|
||||
<TextBlock Text="Percorso CSV:" VerticalAlignment="Center" Margin="0,0,8,0" Grid.Column="0" />
|
||||
<TextBox Text="{Binding CsvOutputPath, Mode=TwoWay}" Grid.Column="1" VerticalAlignment="Center" />
|
||||
<Button Width="104" Command="{Binding SelectCsvOutputCommand}" Grid.Column="2">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="6">
|
||||
<iconPacks:PackIconMaterial Kind="FileOutline" Width="14" Height="14" />
|
||||
<TextBlock Text="Scegli..." />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Width="72" Grid.Column="3" Click="OpenCsvOutputFolder_Click">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="6">
|
||||
<iconPacks:PackIconMaterial Kind="Folder" Width="14" Height="14" />
|
||||
<TextBlock Text="Apri" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
<controls:PathPickerField Label="Percorso CSV:"
|
||||
Text="{Binding CsvOutputPath, Mode=TwoWay}"
|
||||
PreferenceKey="Picker.CsvOutput.LastPath"
|
||||
PickerTitle="Salva CSV"
|
||||
PickerMode="SaveFile"
|
||||
FileTypeName="CSV"
|
||||
FilePatterns="*.csv"
|
||||
DefaultExtension="csv" />
|
||||
|
||||
<TextBlock Text="Anteprima risultati" FontWeight="Bold" />
|
||||
<ProgressBar Minimum="0" Maximum="100" Value="{Binding AiProgress}" Height="16" Margin="0,0,0,4" />
|
||||
|
|
@ -108,22 +89,12 @@
|
|||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="8" Spacing="8">
|
||||
<TextBlock Text="Modelli" FontWeight="Bold" />
|
||||
<Grid ColumnDefinitions="Auto,*,Auto,Auto" ColumnSpacing="6">
|
||||
<TextBlock Text="Cartella modelli:" VerticalAlignment="Center" Margin="0,0,8,0" Grid.Column="0" />
|
||||
<TextBox Text="{Binding ModelsFolderPath, Mode=TwoWay}" Grid.Column="1" VerticalAlignment="Center" />
|
||||
<Button Width="104" Command="{Binding SelectModelsFolderCommand}" Grid.Column="2">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="6">
|
||||
<iconPacks:PackIconMaterial Kind="FolderOpenOutline" Width="14" Height="14" />
|
||||
<TextBlock Text="Scegli..." />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Width="72" Grid.Column="3" Click="OpenModelsFolder_Click">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="6">
|
||||
<iconPacks:PackIconMaterial Kind="Folder" Width="14" Height="14" />
|
||||
<TextBlock Text="Apri" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
<controls:PathPickerField Label="Cartella modelli:"
|
||||
Text="{Binding ModelsFolderPath, Mode=TwoWay}"
|
||||
PreferenceKey="Picker.ModelsFolder.LastPath"
|
||||
PickerTitle="Seleziona cartella modelli"
|
||||
PickerMode="Folder"
|
||||
AppendDirectorySeparator="True" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue