<UserControl x:Class="WPFCatalog.Controls.GeneralSettingsControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:wpfCatalog="clr-namespace:WPFCatalog"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
        xmlns:System="clr-namespace:System;assembly=mscorlib"
        xmlns:catalogLib="clr-namespace:CatalogLib;assembly=CatalogLib"
        mc:Ignorable="d" 
             d:DesignHeight="900" d:DesignWidth="500"
             d:DataContext="{d:DesignInstance wpfCatalog:MainWindowViewModel}"
             >
    <UserControl.Resources>
        <ObjectDataProvider x:Key="ResizeEnum" MethodName="GetValues" ObjectType="{x:Type System:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="catalogLib:ResizeModes" />
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <ObjectDataProvider x:Key="ResizeDimensionsEnum" MethodName="GetValues" ObjectType="{x:Type System:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="catalogLib:ResizeDimensions" />
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
    </UserControl.Resources>
    <Grid>
        <ScrollViewer>
            <StackPanel Orientation="Vertical">
                <GroupBox Header="Directory" >
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="30"/>
                            <ColumnDefinition Width="30"/>
                        </Grid.ColumnDefinitions>


                        <Label Grid.Row="0" Grid.Column="0" Content="Sorgente"/>
                        <TextBox Grid.Row="0" Grid.Column="1" x:Name="txtSorgente" Margin="0,5" Text="{Binding DirSorgente}" Controls:TextBoxHelper.ClearTextButton="True" />
                        <Button Grid.Row="0" Grid.Column="2" x:Name="btnSelectSorgente" Margin="5,5" Command="{Binding SelectSourceFolderCommand}">
                            <Button.Content>
                                <iconPacks:PackIconMaterial Kind="FolderPlus" />
                            </Button.Content>
                        </Button>
                        <Button Grid.Row="0" Grid.Column="3" x:Name="btnOpenSorgente" Margin="5,5" Command="{Binding OpenSourceFolderCommand}">
                            <Button.Content>
                                <iconPacks:PackIconMaterial Kind="FolderOutline" />
                            </Button.Content>
                        </Button>

                        <Label Grid.Row="1" Grid.Column="0" Content="Destinazione"/>
                        <TextBox Grid.Row="1" Grid.Column="1" x:Name="txtDestinazione" Margin="0,5" Text="{Binding DirDestinazione}" Controls:TextBoxHelper.ClearTextButton="True"/>
                        <Button Grid.Row="1" Grid.Column="2" x:Name="btnSelectDestinazione" Margin="5,5" Command="{Binding SelectDestinationFolderCommand}">
                            <Button.Content>
                                <iconPacks:PackIconMaterial Kind="FolderPlus" />
                            </Button.Content>
                        </Button>
                        <Button Grid.Row="1" Grid.Column="3" x:Name="btnOpenDestinazione" Margin="5.4,0,4.6,4.6" Command="{Binding OpenDestinationFolderCommand}" Height="19" VerticalAlignment="Bottom">
                            <Button.Content>
                                <iconPacks:PackIconMaterial Kind="FolderOutline" />
                            </Button.Content>
                        </Button>
                        <!--<Controls:ToggleSwitch Grid.Row="2" Grid.Column="1" Header="Aggiorna le sottodirectory" IsChecked="{Binding DirAggiornaSottoDirectory}"  />-->
                        <CheckBox Grid.Row="2" Grid.Column="1" Content="Aggiorna le sottodirectory" x:Name="chkAggiornaSottodirectory" IsChecked="{Binding DirAggiornaSottoDirectory}"/>

                    </Grid>

                </GroupBox>
                <GroupBox Header="Generale" Margin="2">
                    <StackPanel Orientation="Vertical" >
                        <CheckBox Content="Forza JPG" x:Name="chkForzaJPG" IsChecked="{Binding GeneraleForzaJPG}" Margin="2"/>
                        <CheckBox Content="Rotazione Automatica" x:Name="chkRotazioneAutomatica" IsChecked="{Binding GeneraleRotazioneAutomatica}" Margin="2"/>
                        <CheckBox Content="Sovrascrivi File" x:Name="chkSovrascriviFile" IsChecked="{Binding GeneraleSovrascriviFile}"  Margin="2"/>
                        <CheckBox Content="MultiThreading" IsChecked="{Binding Threading}" Margin="2"></CheckBox>
                    </StackPanel>
                </GroupBox>
                <GroupBox Header="Sottocartelle" Margin="2">
                    <StackPanel Orientation="Vertical">

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition></RowDefinition>

                            </Grid.RowDefinitions>
                            <CheckBox Grid.Row="0" Grid.Column="1"  Content="Crea Sottocartelle" x:Name="chkCreaSottocartelle"  Margin="4,0,0,0" IsChecked="{Binding SubdirCreaSottoCartelle}"/>
                            <Label Grid.Row="1" Grid.Column="0"  Content="Ogni"/>
                            <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="1">
                                <TextBox Width="50" HorizontalAlignment="Left" x:Name="txtOgni" Text="{Binding SubdirIntervalloFile}"/>
                                <Label Content="file"/>
                            </StackPanel>

                            <Label Grid.Row="2" Grid.Column="0" Content="Suffisso" Target="{Binding ElementName=txtSuffisso}"/>
                            <TextBox Grid.Row="2" Grid.Column="1"  HorizontalAlignment="Stretch" x:Name="txtSuffisso" Text="{Binding SubdirSuffisso}"/>

                        </Grid>

                        <StackPanel Orientation="Horizontal" >
                            <Label Content="Num. Cifre Contatore" />
                            <TextBox Width="40" HorizontalAlignment="Right" x:Name="txtNumCifreContatore" Text="{Binding SubdirCifreContatore}"/>

                        </StackPanel>
                        <RadioButton Content="Numerazione Progressiva" IsChecked="{Binding SubdirNumerazioneProgressiva}" x:Name="rdbNumerazioneProgressiva" />
                        <RadioButton Content="Numerazione Files" x:Name="rdbNumerazioneFiles" IsChecked="{Binding SubdirNumerazioneFiles}"/>
                    </StackPanel>
                </GroupBox>
                <GroupBox Margin="2">
                    <GroupBox.Header>
                        <StackPanel Orientation="Horizontal">
                            <iconPacks:PackIconMaterial Kind="Camera" />
                            <TextBlock Text="Foto" Margin="5,0,0,0" />
                        </StackPanel>
                    </GroupBox.Header>
                    <Grid >
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="15*"/>
                            <ColumnDefinition Width="48*"/>
                            <ColumnDefinition Width="88*"/>
                        </Grid.ColumnDefinitions>

                        <Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="Ridimensiona"></Label>
                        <CheckBox Grid.Row="0" Grid.Column="2" IsChecked="{Binding FotoRidimensiona}"></CheckBox>
                        
                        <Label Grid.Row="1" Grid.Column="0" Content="Altezza" Grid.ColumnSpan="2" Margin="0,0,0,2" />
                        <TextBox Grid.Row="1" Grid.Column="2"  Margin="4,4,4,6" Text="{Binding FotoAltezza}"/>


                        <Label Grid.Row="1" Grid.Column="0" Content="Larghezza" Grid.ColumnSpan="2" Margin="0,26,0,2" Grid.RowSpan="2" />
                        <TextBox Grid.Row="2" Grid.Column="2"  Margin="4,2,4,6" Text="{Binding FotoLarghezza}"></TextBox>

                        <Label Grid.Row="2" Grid.Column="0" Content="Qualità" Grid.ColumnSpan="2" Margin="0,24,0,1" Grid.RowSpan="2" />
                        <!--<TextBox Grid.Row="2" Grid.Column="2" Width="80" Margin="4,2,4,5" />-->
                        <Grid Grid.Row="3" Grid.Column="2" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="20"/>
                            </Grid.ColumnDefinitions>
                            <Slider Grid.Column="0"  Orientation="Horizontal" Maximum="100" Minimum="0" Value="{Binding CompressioneJpeg}"></Slider>
                            <TextBlock Grid.Column="1" Text="{Binding CompressioneJpeg}"></TextBlock>
                        </Grid>


                        <CheckBox Grid.Row="4" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,16,0,17.88" IsChecked="{Binding FotoMantieniDimensioni}"/>
                        <TextBlock Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" Grid.ColumnSpan="2" HorizontalAlignment="Left" Text="Mantieni Rapporto di aspetto" TextWrapping="WrapWithOverflow"  Margin="4,0,4,25.88"  />

                        <Label Grid.Row="5" Grid.Column="0" Content="Suffisso" Grid.ColumnSpan="2" Margin="0,0.12,0,-0.12" />
                        <TextBox Grid.Row="5" Grid.Column="2"  Margin="4,4.12,4,3.88" Text="{Binding FotoSuffisso}" />
                        
                        <Label Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2">Algoritmo di ridimensionamento</Label>
                        <ComboBox Grid.Row="6" Grid.Column="2" ItemsSource="{Binding Source={StaticResource ResizeEnum}}" SelectedItem="{Binding ResizeMode}"></ComboBox>

                        <Label Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2">Lato ridimensionamento</Label>
                        <ComboBox Grid.Row="7" Grid.Column="2" ItemsSource="{Binding Source={StaticResource ResizeDimensionsEnum}}" SelectedItem="{Binding ResizeDimension}"></ComboBox>


                    </Grid>
                </GroupBox>
            </StackPanel>
        </ScrollViewer>
    </Grid>
</UserControl>
