<UserControl x:Class="MeterVision.Config.UCConfig"
             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:local="clr-namespace:MeterVision.Config"
             xmlns:localroot="clr-namespace:MeterVision"
             xmlns:zdfflatui="clr-namespace:ZdfFlatUI;assembly=WPF.UI"
             mc:Ignorable="d" 
             Background="WhiteSmoke"
             d:DesignHeight="800" d:DesignWidth="800">
    <Grid>
        <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="0 40 0 40" VerticalAlignment="Center">
            <StackPanel Orientation="Vertical">

                <Border BorderBrush="#D3D3D3" BorderThickness="1" Padding="0 0 0 10" Background="White" Width="600" Margin="0 0 0 0">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="40" />
                            <RowDefinition Height="10" />
                            <RowDefinition Height="45" />
                            <RowDefinition Height="45" />
                            <RowDefinition Height="45" />
                            <!--<RowDefinition Height="45" />
                            <RowDefinition Height="45" />-->
                        </Grid.RowDefinitions>
                        <Border Grid.Row="0" Background="#E8F4FD" BorderBrush="#D3D3D3" BorderThickness="0 0 0 1" Padding="10">
                            <StackPanel>
                                <TextBlock Text="路径设置：" FontSize="15px" FontWeight="Bold" />
                            </StackPanel>
                        </Border>

                        <Grid Grid.Row="2" VerticalAlignment="Center">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="50" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Text="ONNX模型文件:" Foreground="#333333" FontSize="14px" Margin="0 0 20 0" HorizontalAlignment="Right" VerticalAlignment="Center" />
                            <!--<TextBox Grid.Column="1" Text="{Binding Path=mConfigItem.OnnxPath, RelativeSource={RelativeSource AncestorType=Window}}" 
                                     IsReadOnly="True"
                                     FontSize="13px" Margin="0 0 0 0" Padding="2"  VerticalAlignment="Center"/>-->
                            <ComboBox Grid.Column="1" Grid.ColumnSpan="1" x:Name="cmbOnnx" FontSize="13px" Foreground="#000000" 
                                      SelectedValue="{Binding Path=mConfigItem.OnnxPath, RelativeSource={RelativeSource AncestorType=local:UCConfig}}"
                                    ItemsSource="{Binding Onnxs}"
                                      Margin="0,0,0,0" Padding="4" VerticalAlignment="Center"/>

                            <!--<zdfflatui:FlatButton Grid.Column="2" x:Name="btnSelectOnnx" HorizontalAlignment="Center" BorderThickness="0"
                                                      Background="#0078D4" Foreground="White" Content="📋"
                                                  Click="BtnSelectOnnx_Click" Margin="0" VerticalAlignment="Center"
                                                      Width="35" Height="30" FontSize="20px"  />-->
                        </Grid>

                        <Grid Grid.Row="3" VerticalAlignment="Center">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="50" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Text="AI识别动态库:" Foreground="#333333" FontSize="14px" Margin="0 0 20 0" HorizontalAlignment="Right" VerticalAlignment="Center" />

                            <!--Text="{Binding Path=mConfigItem.OnnxPath, RelativeSource={RelativeSource AncestorType=Window}}-->
                            <!--SelectedValue="{Binding CurAiDll,Mode=TwoWay}"-->
                            <ComboBox Grid.Column="1" Grid.ColumnSpan="1" x:Name="cmbAiDll" FontSize="13px" Foreground="#000000" 
                                      SelectedValue="{Binding Path=mConfigItem.AiDll, RelativeSource={RelativeSource AncestorType=local:UCConfig}}"
                                    ItemsSource="{Binding AiDlls}"
                                      Margin="0,0,0,0" Padding="4" VerticalAlignment="Center"/>
                        </Grid>

                        <Grid Grid.Row="4" VerticalAlignment="Center">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="50" />
                            </Grid.ColumnDefinitions>
                            <!--<TextBlock Grid.Column="0" Text="AI目标图像路径:" Foreground="#333333" FontSize="14px" Margin="0 0 20 0" VerticalAlignment="Center" HorizontalAlignment="Right" />-->
                            <TextBlock Grid.Column="0" Text="识别数据输出路径:" Foreground="#333333" FontSize="14px" Margin="0 0 20 0" VerticalAlignment="Center" HorizontalAlignment="Right" />

                            <TextBox Grid.Column="1" Text="{Binding Path=mConfigItem.Output, RelativeSource={RelativeSource AncestorType=local:UCConfig}}" 
                                     IsReadOnly="True"
                                     FontSize="13px" Margin="0 0 0 0" Padding="2"  VerticalAlignment="Center"/>

                            <zdfflatui:FlatButton Grid.Column="2" x:Name="btnDstImgPath" HorizontalAlignment="Center" BorderThickness="0"
                                                      Background="#0078D4" Foreground="White" Content="📂"
                                                  Click="BtnDstImgPath_Click" Margin="0 0 0 0" VerticalAlignment="Center"
                                                      Width="35" Height="30" FontSize="20px"  />
                        </Grid>

                        <!--<Grid Grid.Row="5" VerticalAlignment="Center">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="50" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Text="AI运行日志路径:" Foreground="#333333" FontSize="14px" Margin="0 0 20 0" VerticalAlignment="Center" HorizontalAlignment="Right" />
                            <TextBox Grid.Column="1" Text="{Binding Path=mConfigItem.AiLogPath, RelativeSource={RelativeSource AncestorType=Window}}" 
                                     IsReadOnly="True"
                                     FontSize="13px" Margin="0 0 0 0" Padding="2"  VerticalAlignment="Center"/>

                            <zdfflatui:FlatButton Grid.Column="2" x:Name="btnAiRunLog" HorizontalAlignment="Center" BorderThickness="0"
                                                      Background="#0078D4" Foreground="White" Content="📂"
                                                  Click="BtnAiRunLog_Click" Margin="0 0 0 0" VerticalAlignment="Center"
                                                      Width="35" Height="30" FontSize="20px"  />
                        </Grid>-->

                        <!--<Grid Grid.Row="6" VerticalAlignment="Center">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="50" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Grid.Column="0" Text="图像转换后路径:" Foreground="#333333" FontSize="14px" Margin="0 0 20 0" VerticalAlignment="Center" HorizontalAlignment="Right" />
                            <TextBox Grid.Column="1" Text="{Binding Path=mConfigItem.TransImgPath, RelativeSource={RelativeSource AncestorType=Window}}" 
                                     IsReadOnly="True"
                                     FontSize="13px" Margin="0 0 0 0" Padding="2"  VerticalAlignment="Center"/>

                            <zdfflatui:FlatButton Grid.Column="2" x:Name="btnTransImgPath" HorizontalAlignment="Center" BorderThickness="0"
                                                      Background="#0078D4" Foreground="White" Content="📂"
                                                  Click="BtnTransImgPath_Click" Margin="0 0 0 0" VerticalAlignment="Center"
                                                      Width="35" Height="30" FontSize="20px"  />
                        </Grid>-->
                        
                    </Grid>
                </Border>

                <!--<Border Visibility="Collapsed" BorderBrush="#D3D3D3" BorderThickness="1" Padding="0 0 0 10" Background="White" Width="600" Margin="0 20 0 0">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="40" />
                            <RowDefinition Height="15" />
                            <RowDefinition Height="45" />
                            <RowDefinition Height="45" />
                            <RowDefinition Height="45" />
                        </Grid.RowDefinitions>

                        <Border Grid.Row="0" Grid.ColumnSpan="3" Background="#E8F4FD" BorderBrush="#D3D3D3" 
                                BorderThickness="0 0 0 1" Padding="10 0 0 0" Margin="0">
                            <StackPanel VerticalAlignment="Center">
                                <TextBlock Text="表读数相等判定规则：" FontSize="15px" FontWeight="Bold" />
                            </StackPanel>
                        </Border>

                        <Grid Grid.Row="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="20" />
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Column="0" Text="全数字表：" HorizontalAlignment="Right"
                                           Foreground="#333333" FontSize="14px" Margin="0 0 20 0" VerticalAlignment="Center" />
                            <ComboBox Grid.Column="1" x:Name="cmbDigitMeter" FontSize="13px" Foreground="#000000" 
                                      DisplayMemberPath="Value" SelectedValuePath="Key" 
                                      SelectedValue="{Binding SelectedRulerDigitType,Mode=TwoWay}"
                                    ItemsSource="{x:Static local:ConfigItem.RulerDigitList}"
                                      Margin="0,0,0,0" Padding="4" VerticalAlignment="Center"/>
                        </Grid>

                        <Grid Grid.Row="3">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="20" />
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Column="0" Text="数字+指针表：" HorizontalAlignment="Right"
                                           Foreground="#333333" FontSize="14px" Margin="0 0 20 0" VerticalAlignment="Center" />
                            <ComboBox Grid.Column="1" x:Name="cmbDigitPointerMeter" FontSize="13px" Foreground="#000000" 
                                      DisplayMemberPath="Value" SelectedValuePath="Key"
                                      SelectedValue="{Binding SelectedRulerDigitPointerType,Mode=TwoWay}"
                                    ItemsSource="{x:Static local:ConfigItem.RulerDigitPointerList}"
                                    Margin="0,0,0,0" Padding="4" VerticalAlignment="Center"/>
                        </Grid>

                        <Grid Grid.Row="4">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="20" />
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Column="0" Text="全指针表：" HorizontalAlignment="Right"
                                           Foreground="#333333" FontSize="14px" Margin="0 0 20 0" VerticalAlignment="Center" />
                            <ComboBox Grid.Column="1" x:Name="cmbPointerMeter" FontSize="13px" Foreground="#000000" 
                                     DisplayMemberPath="Value" SelectedValuePath="Key"
                                      SelectedValue="{Binding SelectedRulerPointerType,Mode=TwoWay}"
                                    ItemsSource="{x:Static local:ConfigItem.RulerPointerList}"
                                    Margin="0,0,0,0" Padding="4" VerticalAlignment="Center"/>
                        </Grid>

                    </Grid>
                </Border>-->

                <Border BorderBrush="#D3D3D3" BorderThickness="1" Padding="0 0 0 10" Visibility="Collapsed"
                        Background="White" Width="600" Margin="0 20 0 0">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="40" />
                            <RowDefinition Height="15" />
                            <RowDefinition Height="45" />
                            <RowDefinition Height="45" />
                            <RowDefinition Height="45" />
                        </Grid.RowDefinitions>

                        <Border Grid.Row="0" Grid.ColumnSpan="3" Background="#E8F4FD" BorderBrush="#D3D3D3" 
                                BorderThickness="0 0 0 1" Padding="10 0 0 0" Margin="0">
                            <StackPanel VerticalAlignment="Center">
                                <TextBlock Text="数据分页大小(每页条数)设置：" FontSize="15px" FontWeight="Bold" />
                            </StackPanel>
                        </Border>

                        <Grid Grid.Row="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150" />
                                <ColumnDefinition Width="80" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="80" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="20" />
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Column="0" Text="单图识别：" HorizontalAlignment="Right" Foreground="#000000"
                                 FontSize="15px" Margin="0 0 20 0" FontWeight="Bold" VerticalAlignment="Center" />
                            <!--<ComboBox Grid.Column="1" x:Name="cmbDigit2Meter" FontSize="14px" Foreground="#000000" DisplayMemberPath="StandName2"  
                                    Margin="0,0,0,0" Padding="2" VerticalAlignment="Center"/>-->
                            <TextBlock Grid.Column="1" Text="明细列表：" HorizontalAlignment="Center"
                                           Foreground="#333333" FontSize="14px" Margin="0 0 0 0" VerticalAlignment="Center" />
                            <ComboBox Grid.Column="2" x:Name="cmbSingleDetailPageSize" FontSize="14px" Foreground="#000000"
                                    ItemsSource="{x:Static localroot:ThisApp.PageSizeOptions}"
                                      SelectedValue="{Binding mConfigItem.SinglePageSize}"
                                      Margin="0,0,20,0" Padding="4" VerticalAlignment="Center"/>
                        </Grid>

                        <Grid Grid.Row="3">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150" />
                                <ColumnDefinition Width="80" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="80" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="20" />
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Column="0" Text="模板维护：" HorizontalAlignment="Right" FontWeight="Bold"
                                           Foreground="#000000" FontSize="15px" Margin="0 0 20 0" VerticalAlignment="Center" />
                            <TextBlock Grid.Column="1" Text="目录列表：" HorizontalAlignment="Center"
                                           Foreground="#333333" FontSize="14px" Margin="0 0 0 0" VerticalAlignment="Center" />
                            <ComboBox Grid.Column="2" x:Name="cmbStandPageSize" FontSize="14px" Foreground="#000000"
                                    ItemsSource="{x:Static localroot:ThisApp.PageSizeOptions}"
                                      SelectedValue="{Binding mConfigItem.StandCatalogPageSize}"
                                      Margin="0,0,20,0" Padding="4" VerticalAlignment="Center"/>
                            <TextBlock Grid.Column="3" Text="明细列表：" HorizontalAlignment="Center"
                                           Foreground="#333333" FontSize="14px" Margin="0 0 0 0" VerticalAlignment="Center" />
                            <ComboBox Grid.Column="4" x:Name="cmbStandDetailPageSize" FontSize="14px" Foreground="#000000"
                                      ItemsSource="{x:Static localroot:ThisApp.PageSizeOptions}"
                                      SelectedValue="{Binding mConfigItem.StandPageSize}"
                                      Margin="0,0,20,0" Padding="4" VerticalAlignment="Center"/>
                        </Grid>

                        <Grid Grid.Row="4">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150" />
                                <ColumnDefinition Width="80" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="80" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="20" />
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Column="0" Text="批量识别：" HorizontalAlignment="Right" FontWeight="Bold"
                                           Foreground="#000000" FontSize="15px" Margin="0 0 20 0" VerticalAlignment="Center" />
                            <TextBlock Grid.Column="1" Text="目录列表：" HorizontalAlignment="Center"
                                           Foreground="#333333" FontSize="14px" Margin="0 0 0 0" VerticalAlignment="Center" />
                            <ComboBox Grid.Column="2" x:Name="cmbPatchPageSize" FontSize="14px" Foreground="#000000"
                                      ItemsSource="{x:Static localroot:ThisApp.PageSizeOptions}"
                                      SelectedValue="{Binding mConfigItem.PatchCatalogPageSize}"
                                      Margin="0,0,20,0" Padding="4" VerticalAlignment="Center"/>
                            <TextBlock Grid.Column="3" Text="明细列表：" HorizontalAlignment="Center"
                                           Foreground="#333333" FontSize="14px" Margin="0 0 0 0" VerticalAlignment="Center" />
                            <ComboBox Grid.Column="4" x:Name="cmbPatchDetailPageSize" FontSize="14px" Foreground="#000000"
                                       ItemsSource="{x:Static localroot:ThisApp.PageSizeOptions}"
                                      SelectedValue="{Binding mConfigItem.PatchPageSize}"
                                      Margin="0,0,20,0" Padding="4" VerticalAlignment="Center"/>
                        </Grid>

                    </Grid>
                </Border>


                <StackPanel Margin="0 10 0 0" HorizontalAlignment="Center" Visibility="Collapsed">
                    <Button x:Name="btnFreeSpace" Width="150" Height="30" Content="释放数据库空间占用" Click="BtnFreeSpace_Click" />
                </StackPanel>
            </StackPanel>
        </ScrollViewer>
                
    </Grid>
</UserControl>
