<pi:UserControlBase  
        xmlns:pi="https://github.com/ping9719/wpfex"
        x:Class="智慧物流软件系统.InterfaceRecordView"
        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:hc="https://handyorg.github.io/handycontrol" 
    mc:Ignorable="d"
        d:DesignHeight="737" d:DesignWidth="1192" LoadedVisibleFirst="LoadedVisible">
    <Border Margin="0" Background="AliceBlue" CornerRadius="3" Padding="0">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="1.5*"></RowDefinition>
                <RowDefinition Height="8*"></RowDefinition>
            </Grid.RowDefinitions>

            <Border Grid.Row="0" Margin="3" Background="AliceBlue" CornerRadius="3" Padding="0">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.6*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="0.7*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="0.7*"></ColumnDefinition>
                        <ColumnDefinition Width="0.7*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>

                    <TextBlock Grid.Row="0" Grid.Column="0" Margin="5"
                               VerticalAlignment="Center" HorizontalAlignment="Left" 
                               Text="接口地址：" FontSize="18" ></TextBlock>
                    <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding RequestUrl}"
                               VerticalAlignment="Center" HorizontalAlignment="Left" 
                               FontSize="18" MinWidth="120"></TextBox>

                    <TextBlock Grid.Row="0" Grid.Column="2" Margin="5"
                           VerticalAlignment="Center" HorizontalAlignment="Right" 
                           Text="请求参数：" FontSize="18" ></TextBlock>
                    <TextBox Grid.Row="0" Grid.Column="3" Text="{Binding RequestBody}"
                           VerticalAlignment="Center" HorizontalAlignment="Left" 
                           FontSize="18" MinWidth="120"></TextBox>



                    <TextBlock Grid.Row="2" Grid.Column="0" Margin="5"
                           VerticalAlignment="Center" HorizontalAlignment="Left" 
                           Text="调用类型：" FontSize="18" ></TextBlock>
                    <ComboBox Grid.Row="2" Grid.Column="1" 
                              VerticalAlignment="Center" HorizontalAlignment="Left" 
                              FontSize="18" MinWidth="120"  SelectedIndex="0" Text="{Binding RequestType}">
                        <ComboBoxItem Content="调用"></ComboBoxItem>
                        <ComboBoxItem Content="被调用"></ComboBoxItem>
                    </ComboBox>


                    <StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="6"   Orientation="Horizontal"
                              VerticalAlignment="Center" HorizontalAlignment="Left" >
                        <TextBlock Grid.Row="1" Grid.Column="0" Margin="5"
                           VerticalAlignment="Center" HorizontalAlignment="Right" 
                           Text="时间：" FontSize="18" ></TextBlock>
                        <ComboBox Grid.Row="1" Grid.Column="1" 
                              VerticalAlignment="Center" HorizontalAlignment="Left" 
                              FontSize="18" MinWidth="120" 
                              ItemsSource="{Binding TimeTypes}"
                              SelectedValue="{Binding TimeType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                              SelectedIndex="0"
                              >
                        </ComboBox>
                        <TextBlock FontSize="18" VerticalAlignment="Center" Text="  "></TextBlock>
                        <hc:DateTimePicker FontSize="18" Height="24" MinWidth="180"  Style="{StaticResource DateTimePickerExtend}"  SelectedDateTime="{Binding StartTime}"></hc:DateTimePicker>
                        <TextBlock FontSize="18" VerticalAlignment="Center" Text=" 到 "></TextBlock>
                        <hc:DateTimePicker FontSize="18"  Height="24"  MinWidth="180" Style="{StaticResource DateTimePickerExtend}" SelectedDateTime="{Binding EndTime}"></hc:DateTimePicker>
                    </StackPanel>

                    <Button Style="{StaticResource ButtonSuccess}"
                            Command="{Binding BtnSearchCommand}"
                            hc:BorderElement.CornerRadius="5" 
                            Grid.Column="5" Grid.Row="0" MinHeight="36" FontSize="16" Content="&#xe8b9; 搜索" FontFamily="{StaticResource IconFont}" Margin="0,0,0,-5" >
                    </Button>

                    <Button Style="{StaticResource ButtonWarning}"  
                            Command="{Binding BtnResetCommand}"
                            hc:BorderElement.CornerRadius="5" 
                            Grid.Column="6"  Grid.Row="0" MinHeight="36" FontSize="16" Content="&#xe652; 重置" FontFamily="{StaticResource IconFont}" Margin="0,0,0,-5" >
                    </Button>
                </Grid>
            </Border>

            <Border Grid.Row="1" Margin="3" Background="AliceBlue" CornerRadius="3" Padding="0">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="0.8*"></RowDefinition>
                        <RowDefinition Height="8*"></RowDefinition>
                        <RowDefinition Height="0.7*"></RowDefinition>
                    </Grid.RowDefinitions>
                    <StackPanel Grid.Row="0" Orientation="Horizontal">
                        <Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnExportCommand}"
                                Content="&#xe866; 导  出" FontFamily="{StaticResource IconFont}"
                                Style="{StaticResource ButtonWarning}" Background="DarkOrange">
                        </Button>
                    </StackPanel>
                    <DataGrid Grid.Row="1" 
                              SelectedCellsChanged="DataGrid_SelectedCellsChanged"
                              ItemsSource="{Binding DataGridItemSource}" 
                              RowHeight="39" 
                              AutoGenerateColumns="False"
                              FontSize="13">
                        <DataGrid.Columns>
                            <DataGridTextColumn  Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
                            <DataGridTextColumn  Header="接口地址" Binding="{Binding RequestUrl}"></DataGridTextColumn>
                            <DataGridTextColumn  Header="设备IP" Binding="{Binding DeviceIp}"></DataGridTextColumn>
                            <DataGridTextColumn  Header="请求参数" Binding="{Binding RequestBody}" MaxWidth="100"></DataGridTextColumn>
                            <DataGridTextColumn  Header="QueryString" Binding="{Binding QueryString}" MaxWidth="100"></DataGridTextColumn>
                            <DataGridTextColumn  Header="请求时间" Binding="{Binding RequestTime,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
                            <DataGridTextColumn  Header="返回参数" Binding="{Binding ResponseJson}" MaxWidth="100"></DataGridTextColumn>
                            <DataGridTextColumn  Header="返回时间" Binding="{Binding ResponseTime,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
                            <DataGridTextColumn  Header="耗时(ms)" Binding="{Binding ExecutionTime}"></DataGridTextColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                    <Grid Grid.Row="2">
                        <Border CornerRadius="3" Background="Transparent" VerticalAlignment="Center" >
                            <Grid HorizontalAlignment="Stretch"  Margin="0" VerticalAlignment="Top" Width="Auto" MinHeight="26">
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="5*"></ColumnDefinition>
                                    <ColumnDefinition Width="5*"></ColumnDefinition>
                                    <ColumnDefinition Width="5*"></ColumnDefinition>
                                </Grid.ColumnDefinitions>

                                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="5">
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="共"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="条记录  "></TextBlock>



                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="第"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="/"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
                                    <TextBlock FontSize="14" VerticalAlignment="Center" Text="页 "></TextBlock>

                                    <ComboBox FontSize="14" VerticalAlignment="Center" SelectedValue="{Binding PageSize}" SelectedValuePath="Tag">
                                        <ComboBoxItem Tag="10" IsSelected="True">10条/页</ComboBoxItem>
                                        <ComboBoxItem Tag="20">20条/页</ComboBoxItem>
                                        <ComboBoxItem Tag="50">50条/页</ComboBoxItem>
                                        <ComboBoxItem Tag="100">100条/页</ComboBoxItem>
                                        <ComboBoxItem Tag="500">500条/页</ComboBoxItem>
                                    </ComboBox>
                                </StackPanel>

                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">
                                    <Grid>
                                        <Grid.RowDefinitions >
                                            <RowDefinition Height="30"></RowDefinition>
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="auto"/>
                                            <ColumnDefinition Width="auto"/>
                                            <ColumnDefinition Width="auto"/>
                                            <ColumnDefinition Width="auto"/>
                                            <ColumnDefinition Width="auto"/>
                                        </Grid.ColumnDefinitions>

                                        <Button BorderBrush="Transparent"  Background="Transparent" Grid.Column="0" Name="btnFirst" Content="首页" Foreground="Black" FontSize="14" 
                                                Command="{Binding BtnFirstPageCommand}"/>
                                        <Button BorderBrush="Transparent"  Background="Transparent" Grid.Column="1" Name="btnPrev" Content="上一页" FontSize="14" 
                                                Command="{Binding BtnPrePageCommand}"/>
                                        <TextBox BorderBrush="Transparent" Grid.Column="2" FontSize="14" MinWidth="50"   HorizontalAlignment="Center" VerticalAlignment="Center"  Cursor="IBeam" IsEnabled="False"
                                                 Text ="{Binding CurrentPage}" TextAlignment="Center"

                                                 />
                                        <Button BorderBrush="Transparent"  Background="Transparent" Grid.Column="3" Name="btnNext" Content="下一页" FontSize="14" 
                                                Command="{Binding BtnNextPageCommand}"/>
                                        <Button BorderBrush="Transparent"  Background="Transparent" Grid.Column="4" Name="btnLast" Content="末页" FontSize="14" 
                                                Command="{Binding BtnLastPageCommand}"/>
                                    </Grid>
                                </StackPanel>
                            </Grid>
                        </Border>
                    </Grid>
                </Grid>
            </Border>

        </Grid>
    </Border>
</pi:UserControlBase>
