<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:i="http://schemas.microsoft.com/xaml/behaviors"
             xmlns:prism="http://prismlibrary.com/"
             prism:ViewModelLocator.AutoWireViewModel="True"
             xmlns:hc="https://handyorg.github.io/handycontrol"
             mc:Ignorable="d" Background="Gray"
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>

                <!--<ResourceDictionary Source="/Detection.platform.Assets;component/Styles/ButtonStyles.xaml"/>
                <ResourceDictionary Source="/Detection.platform.Assets;component/Styles/TextBoxStyle.xaml"/>-->
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="60"/>
            <RowDefinition Height="1*"/>
        </Grid.RowDefinitions>
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="Loaded">
                <i:InvokeCommandAction Command="{Binding Path=LoadedCommand}"/>
            </i:EventTrigger>
            <i:EventTrigger EventName="Unloaded">
                <i:InvokeCommandAction Command="{Binding Path=UnloadedCommand}"/>
            </i:EventTrigger>
        </i:Interaction.Triggers>
        <Border Background="White">
            <TextBlock Text="{Binding Title}" FontSize="16" FontWeight="Bold" VerticalAlignment="Center"  Margin="10,0,10,0"/>
        </Border>
        <Border Background="White" Grid.Row="1" CornerRadius="5" Margin="10">
            <Grid Margin="50,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="50"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="1*"/>
                <RowDefinition Height="50"/>
            </Grid.RowDefinitions>
                <StackPanel Orientation="Horizontal" Grid.Row="0"  HorizontalAlignment="Left">
                    <TextBlock Text="日志分类：" VerticalAlignment="Center"/>
                    <ComboBox Text="{Binding SelectIndexLogType}" VerticalAlignment="Center" Margin="0,0,50,0">
                        <ComboBoxItem Content="全部"/>
                        <ComboBoxItem Content="系统"/>
                        <ComboBoxItem Content="网络"/>
                        <ComboBoxItem Content="应用"/>
                    </ComboBox>
                    <!--<TextBlock Text="启始时间：" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                    <hc:DatePicker Margin="0,0,10,0"  SelectedDate="{Binding StartTime}" Height="30"></hc:DatePicker>-->
                    <TextBlock Text="时间：" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                    <hc:DatePicker SelectedDate="{Binding EndTime}" Height="30"></hc:DatePicker>
                    <Button Content="查看"  Background="#FF009DFF"  Foreground="White"
                    Width="70" Margin="5,0"
                    Command="{Binding QueryDataCommand}"/>
                </StackPanel>
                <Grid  Background="#FF2A323B" Grid.Row="1" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition Width="10*"/>
                        <ColumnDefinition Width="10*"/>
                        <ColumnDefinition Width="10*"/>
                        <ColumnDefinition Width="10*"/>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="类别" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="0" Foreground="White" />
                    <TextBlock Text="应用" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="1" Foreground="White" />
                    <TextBlock Text="状态" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="2" Foreground="White"/>
                    <TextBlock Text="时间" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="3" Foreground="White"/>
                    <!--<TextBlock Text="操作" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="4" Foreground="White"/>-->
                </Grid>
                <ItemsControl Grid.Row="2" 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="100"/>
                                        <ColumnDefinition Width="10*"/>
                                        <ColumnDefinition Width="10*"/>
                                        <ColumnDefinition Width="10*"/>
                                        <ColumnDefinition Width="10*"/>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock  Grid.Column="0" Text="{Binding LogType}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                    <TextBlock  Grid.Column="1" Text="{Binding AppName}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                    <TextBlock  Grid.Column="2" Text="{Binding State}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                    <TextBlock  Grid.Column="3" Text="{Binding OriginTime,StringFormat=yyyy-MM-dd HH:mm:ss}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                    <!--<TextBlock  Grid.Column="4" Text="{Binding Message}" VerticalAlignment="Center" HorizontalAlignment="Center"/>-->
                            </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="3" 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>
        </Border>
    </Grid>
</UserControl>
