- 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.
102 lines
6.3 KiB
XML
102 lines
6.3 KiB
XML
<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">
|
|
<TabControl Margin="4">
|
|
<TabItem Header="Esecuzione">
|
|
<Grid RowDefinitions="Auto,*">
|
|
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto">
|
|
<StackPanel Margin="4" Spacing="8">
|
|
<TextBlock Text="AI / OCR" FontWeight="Bold" />
|
|
|
|
<StackPanel Orientation="Horizontal" Spacing="12">
|
|
<CheckBox Content="Usa GPU"
|
|
IsChecked="{Binding UseNumberAiGpu, Mode=TwoWay}"
|
|
IsEnabled="{Binding NumberAiGpuOptionEnabled}" />
|
|
<CheckBox Content="Includi thumbnail" IsChecked="{Binding IncludeNumberAiThumbnails, Mode=TwoWay}" />
|
|
</StackPanel>
|
|
|
|
<Grid ColumnDefinitions="Auto,Auto,*" ColumnSpacing="8">
|
|
<TextBlock Grid.Column="0" Text="Carico OCR:" VerticalAlignment="Center" />
|
|
<ComboBox Grid.Column="1"
|
|
Width="84"
|
|
ItemsSource="{Binding NumberAiWorkloadOptions}"
|
|
SelectedItem="{Binding NumberAiWorkloadLevel, Mode=TwoWay}" />
|
|
<TextBlock Grid.Column="2"
|
|
Text="{Binding NumberAiStatsSummary}"
|
|
VerticalAlignment="Center"
|
|
TextWrapping="Wrap"
|
|
FontWeight="SemiBold" />
|
|
</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">
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="6">
|
|
<iconPacks:PackIconMaterial Kind="PlayCircle" Width="16" Height="16" Foreground="#2E7D32" />
|
|
<TextBlock Text="Avvia AI" />
|
|
</StackPanel>
|
|
</Button>
|
|
<Button Command="{Binding AsyncCancelOperationCommand}" Width="132">
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="6">
|
|
<iconPacks:PackIconMaterial Kind="Cancel" Width="16" Height="16" Foreground="#C62828" />
|
|
<TextBlock Text="Annulla" />
|
|
</StackPanel>
|
|
</Button>
|
|
</StackPanel>
|
|
|
|
<TextBlock Text="Output CSV" FontWeight="Bold" />
|
|
<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" />
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
|
|
<avaloniaDataGrid:DataGrid Grid.Row="1"
|
|
ItemsSource="{Binding PreviewResults}"
|
|
IsReadOnly="True"
|
|
AutoGenerateColumns="False"
|
|
Margin="4,4,4,4"
|
|
CanUserResizeColumns="True"
|
|
VerticalAlignment="Stretch">
|
|
<avaloniaDataGrid:DataGrid.Columns>
|
|
<avaloniaDataGrid:DataGridTextColumn Header="Path" Binding="{Binding Path}" Width="*" />
|
|
<avaloniaDataGrid:DataGridTextColumn Header="Text" Binding="{Binding Text}" Width="2*" />
|
|
</avaloniaDataGrid:DataGrid.Columns>
|
|
</avaloniaDataGrid:DataGrid>
|
|
</Grid>
|
|
</TabItem>
|
|
|
|
<TabItem Header="Impostazioni">
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
|
<StackPanel Margin="8" Spacing="8">
|
|
<TextBlock Text="Modelli" FontWeight="Bold" />
|
|
<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>
|
|
</TabControl>
|
|
</UserControl>
|