<UserControl x:Class="StartServerWPF.Modules.Main.Views.LogManagementView"
             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:prism="http://prismlibrary.com/"
             prism:ViewModelLocator.AutoWireViewModel="True"
             xmlns:hc="https://handyorg.github.io/handycontrol"
             mc:Ignorable="d"
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>

                <!--<ResourceDictionary Source="/Detection.platform.Assets;component/Styles/ButtonStyles.xaml"/>
                <ResourceDictionary Source="/Detection.platform.Assets;component/Styles/TextBoxStyle.xaml"/>-->
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Margin="20">
        <Grid.RowDefinitions>
            <RowDefinition Height="50"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" Grid.Row="0" Margin="50,0"  HorizontalAlignment="Left">
            <TextBlock Text="启始时间：" VerticalAlignment="Center" HorizontalAlignment="Center"/>
            <hc:DateTimePicker Margin="0,0,10,0"  SelectedDateTime="{Binding StartTime}" Height="30"></hc:DateTimePicker>
            <TextBlock Text="结束时间：" VerticalAlignment="Center" HorizontalAlignment="Center"/>
            <hc:DateTimePicker SelectedDateTime="{Binding EndTime}" Height="30"></hc:DateTimePicker>
            <Button Content="查看"  Background="#FF009DFF"  Foreground="White"
                    Width="70" Margin="5,0"
                    Command="{Binding QueryDataCommand}"/>
        </StackPanel>

        <Grid Grid.Row="2">
            <Grid.RowDefinitions>
                <RowDefinition Height="30"/>
                <RowDefinition/>
                <RowDefinition Height="50"/>
            </Grid.RowDefinitions>
            <Border Background="#EEE"/>
            <Grid Background="#FF2A323B" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="200"/>
                    <ColumnDefinition Width="10*"/>
                    <ColumnDefinition Width="10*"/>
                    <ColumnDefinition Width="10*"/>
                    <ColumnDefinition Width="10*"/>
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <TextBlock Text="应用" VerticalAlignment="Center" Grid.Column="0" Foreground="White" HorizontalAlignment="Center"/>
                <TextBlock Text="状态" VerticalAlignment="Center" Grid.Column="1" Foreground="White"/>
                <TextBlock Text="时间" VerticalAlignment="Center" Grid.Column="3" Foreground="White"/>
                <TextBlock Text="操作" VerticalAlignment="Center" Grid.Column="4" Foreground="White"/>
            </Grid>
            <ItemsControl Grid.Row="1" ItemsSource="{Binding DataList}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate >
                        <Border BorderBrush="#F7F9FA" BorderThickness="0,0,0,1" Background="Transparent">
                            <Grid Height="30" Background="Transparent" Name="root">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="200"/>
                                    <ColumnDefinition  Width="60"/>
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>
                                <TextBlock Text="{Binding CreateTime}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                <TextBlock Text="{Binding UserName}" VerticalAlignment="Center" Grid.Column="1"/>
                                <TextBlock Text="{Binding Message}" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="2"/>
                            </Grid>
                        </Border>
                        <DataTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="root" Property="Background" Value="#F7F9FA"/>
                            </Trigger>
                        </DataTemplate.Triggers>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
            <hc:Pagination Grid.Row="2" HorizontalAlignment="Center" FontSize="15"  MaxPageCount="{Binding MaxCountPage}" PageIndex="{Binding PageIndex}" IsJumpEnabled="True">
                <hc:Interaction.Triggers>
                    <hc:EventTrigger EventName="PageUpdated">
                        <hc:EventToCommand Command="{Binding PageUpdatedCmd}" PassEventArgsToCommand="True" />
                    </hc:EventTrigger>
                </hc:Interaction.Triggers>
            </hc:Pagination>
        </Grid>
    </Grid>
</UserControl>
