<UserControl x:Class="MainShell.ParaSetting.View.SaveSettingView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mw="http://www.maxwell-gp.com/"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <ResourceDictionary>
            <Style x:Key="SaveSettingLabelStyle" TargetType="Label" BasedOn="{StaticResource ProcessLabelStyle}">
                <Setter Property="Width" Value="220"/>
            </Style>

            <Style x:Key="SaveSettingToggleStyle" TargetType="ToggleButton" BasedOn="{StaticResource ProcessToggleStyle}">
                <Setter Property="MinWidth" Value="54"/>
                <Setter Property="Width" Value="54"/>
                <Setter Property="Margin" Value="8,0,0,0"/>
            </Style>

            <Style x:Key="SaveSettingTextBoxStyle" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
                <Setter Property="Height" Value="32"/>
                <Setter Property="MinWidth" Value="320"/>
                <Setter Property="Margin" Value="8,0,0,0"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="Background" Value="{StaticResource ProcessCardBackgroundBrush}"/>
                <Setter Property="BorderBrush" Value="{StaticResource ProcessCardBorderBrush}"/>
                <Setter Property="Foreground" Value="{StaticResource ProcessBodyForegroundBrush}"/>
            </Style>

            <Style x:Key="SaveSettingBrowseButtonStyle" TargetType="Button" BasedOn="{StaticResource SettingsButtonStyle}">
                <Setter Property="Height" Value="32"/>
                <Setter Property="MinWidth" Value="88"/>
                <Setter Property="Margin" Value="8,0,0,0"/>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid Background="{StaticResource ProcessPageBackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="60"/>
        </Grid.RowDefinitions>

        <ScrollViewer Grid.Row="0"
                      Margin="4,4,4,0"
                      VerticalScrollBarVisibility="Auto"
                      HorizontalScrollBarVisibility="Disabled"
                      Padding="0,0,4,0">
            <StackPanel Margin="0,0,0,4">
                <GroupBox Header="{DynamicResource FileRelatedSaveSetting}" Style="{StaticResource ProcessWideCardGroupBoxStyle}" DataContext="{Binding SaveSettingItem.FileSaveSetting}">
                    <StackPanel>
                        <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                            <Label Style="{StaticResource SaveSettingLabelStyle}" Content="{DynamicResource DeviceFoundationSaveEnable}"/>
                            <ToggleButton Style="{StaticResource SaveSettingToggleStyle}" IsChecked="{Binding IsSaveEnabled}"/>
                        </StackPanel>

                        <Grid Margin="0,0,0,10">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>

                            <Label Grid.Column="0" Style="{StaticResource SaveSettingLabelStyle}" Content="{DynamicResource DeviceFoundationSavePath}"/>
                            <TextBox Grid.Column="1" Style="{StaticResource SaveSettingTextBoxStyle}" IsReadOnly="True" Text="{Binding SaveFolder, UpdateSourceTrigger=PropertyChanged}"/>
                            <Button Grid.Column="2" Style="{StaticResource SaveSettingBrowseButtonStyle}" Content="{DynamicResource Browse}" Click="{mw:Action BrowseFileSaveFolder}"/>
                        </Grid>

                        <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                            <Label Style="{StaticResource SaveSettingLabelStyle}" Content="{DynamicResource DeviceFoundationCreateDateFolder}"/>
                            <ToggleButton Style="{StaticResource SaveSettingToggleStyle}" IsChecked="{Binding IsCreateDateFolder}"/>
                        </StackPanel>
                    </StackPanel>
                </GroupBox>

                <GroupBox Header="{DynamicResource ImageRelatedSaveSetting}" Style="{StaticResource ProcessWideCardGroupBoxStyle}" DataContext="{Binding SaveSettingItem.ImageSaveSetting}">
                    <StackPanel>
                        <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                            <Label Style="{StaticResource SaveSettingLabelStyle}" Content="{DynamicResource DeviceFoundationSaveEnable}"/>
                            <ToggleButton Style="{StaticResource SaveSettingToggleStyle}" IsChecked="{Binding IsSaveEnabled}"/>
                        </StackPanel>

                        <Grid Margin="0,0,0,10">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>

                            <Label Grid.Column="0" Style="{StaticResource SaveSettingLabelStyle}" Content="{DynamicResource DeviceFoundationSavePath}"/>
                            <TextBox Grid.Column="1" Style="{StaticResource SaveSettingTextBoxStyle}" IsReadOnly="True" Text="{Binding SaveFolder, UpdateSourceTrigger=PropertyChanged}"/>
                            <Button Grid.Column="2" Style="{StaticResource SaveSettingBrowseButtonStyle}" Content="{DynamicResource Browse}" Click="{mw:Action BrowseImageSaveFolder}"/>
                        </Grid>

                        <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                            <Label Style="{StaticResource SaveSettingLabelStyle}" Content="{DynamicResource DeviceFoundationCreateDateFolder}"/>
                            <ToggleButton Style="{StaticResource SaveSettingToggleStyle}" IsChecked="{Binding IsCreateDateFolder}"/>
                        </StackPanel>

                        <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                            <Label Style="{StaticResource SaveSettingLabelStyle}" Content="{DynamicResource DeviceFoundationSaveUpCameraImage}"/>
                            <ToggleButton Style="{StaticResource SaveSettingToggleStyle}" IsChecked="{Binding IsSaveUpCameraImage}"/>
                        </StackPanel>

                        <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                            <Label Style="{StaticResource SaveSettingLabelStyle}" Content="{DynamicResource DeviceFoundationSaveDownCameraImage}"/>
                            <ToggleButton Style="{StaticResource SaveSettingToggleStyle}" IsChecked="{Binding IsSaveDownCameraImage}"/>
                        </StackPanel>

                        <StackPanel Style="{StaticResource ProcessParameterRowStyle}">
                            <Label Style="{StaticResource SaveSettingLabelStyle}" Content="{DynamicResource DeviceFoundationSaveMapCameraImage}"/>
                            <ToggleButton Style="{StaticResource SaveSettingToggleStyle}" IsChecked="{Binding IsSaveMapCameraImage}"/>
                        </StackPanel>
                    </StackPanel>
                </GroupBox>
            </StackPanel>
        </ScrollViewer>

        <Grid Grid.Row="1" Margin="4,8,4,4">
            <Button Content="{DynamicResource Save}" Click="{mw:Action BtnSave}" Style="{StaticResource SaveButtonStyle}" HorizontalAlignment="Right"/>
        </Grid>
    </Grid>
</UserControl>
