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,43 +1,24 @@
|
|||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:iconPacks="https://github.com/MahApps/IconPacks.Avalonia"
|
||||
xmlns:controls="clr-namespace:ImageCatalog_2.Controls"
|
||||
x:Class="ImageCatalog_2.AvaloniaViews.GeneralTabView">
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="4" Spacing="8">
|
||||
<TextBlock Text="Percorsi" FontWeight="Bold" />
|
||||
<StackPanel Margin="0,2,0,0" Spacing="6">
|
||||
<Grid Margin="0,0,0,2" ColumnDefinitions="Auto,*,Auto,Auto" ColumnSpacing="6">
|
||||
<TextBlock Text="Sorgente:" VerticalAlignment="Center" Margin="0,0,8,0" Grid.Column="0" />
|
||||
<TextBox Text="{Binding SourcePath, Mode=TwoWay}" Grid.Column="1" VerticalAlignment="Center" />
|
||||
<Button Width="104" Command="{Binding SelectSourceFolderCommand}" 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="OpenSourceFolder_Click">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="6">
|
||||
<iconPacks:PackIconMaterial Kind="Folder" Width="14" Height="14" />
|
||||
<TextBlock Text="Apri" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
<Grid ColumnDefinitions="Auto,*,Auto,Auto" ColumnSpacing="6">
|
||||
<TextBlock Text="Destinazione:" VerticalAlignment="Center" Margin="0,0,8,0" Grid.Column="0" />
|
||||
<TextBox Text="{Binding DestinationPath, Mode=TwoWay}" Grid.Column="1" VerticalAlignment="Center" />
|
||||
<Button Width="104" Command="{Binding SelectDestinationFolderCommand}" 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="OpenDestinationFolder_Click">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="6">
|
||||
<iconPacks:PackIconMaterial Kind="Folder" Width="14" Height="14" />
|
||||
<TextBlock Text="Apri" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
<controls:PathPickerField Margin="0,0,0,2"
|
||||
Label="Sorgente:"
|
||||
Text="{Binding SourcePath, Mode=TwoWay}"
|
||||
PreferenceKey="Picker.SourceFolder.LastPath"
|
||||
PickerTitle="Seleziona cartella sorgente"
|
||||
PickerMode="Folder"
|
||||
AppendDirectorySeparator="True" />
|
||||
<controls:PathPickerField Label="Destinazione:"
|
||||
Text="{Binding DestinationPath, Mode=TwoWay}"
|
||||
PreferenceKey="Picker.DestinationFolder.LastPath"
|
||||
PickerTitle="Seleziona cartella destinazione"
|
||||
PickerMode="Folder"
|
||||
AppendDirectorySeparator="True" />
|
||||
</StackPanel>
|
||||
|
||||
<Grid ColumnDefinitions="*,*" ColumnSpacing="24" Margin="0,4,0,0">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue