<UserControl
    x:Class="BPA.SingleDevice.View.AlarmLogView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:bpa="http://BPAUIControl.io/winfx/xaml/toolkit"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:BPA.SingleDevice.View"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    d:DesignHeight="450"
    d:DesignWidth="800"
    mc:Ignorable="d">
    <bpa:DialogContainer>
        <Grid Margin="10">
            <Grid.RowDefinitions>
                <RowDefinition Height="50" />
                <RowDefinition />
            </Grid.RowDefinitions>

            <!--#region 功能按钮-->
            <StackPanel
                Grid.Row="0"
                Margin="10"
                HorizontalAlignment="Right"
                bpa:PanelHelper.Spacing="15"
                Orientation="Horizontal">
                <ToggleButton
                    HorizontalAlignment="Right"
                    bpa:ToggleButtonHelper.CheckedContent="历史日志"
                    Command="{Binding ViewHistoryCommand}"
                    Content="实时日志"
                    FontSize="25"
                    IsChecked="{Binding IsShowHistory}"
                    Style="{DynamicResource SwitchToggleButton}" />
            </StackPanel>

            <!--#endregion-->

            <!--#region 列表-->
            <bpa:ControlDisplay Grid.Row="1">
                <DataGrid
                    Grid.Row="1"
                    AutoGenerateColumns="False"
                    BorderBrush="Gray"
                    BorderThickness="1"
                    CanUserAddRows="False"
                    CanUserDeleteRows="False"
                    CanUserReorderColumns="False"
                    CanUserResizeColumns="False"
                    CanUserResizeRows="False"
                    CanUserSortColumns="False"
                    GridLinesVisibility="All"
                    IsReadOnly="True"
                    ItemsSource="{Binding AlarmLogs}"
                    RowHeight="50"
                    SelectionMode="Single">
                    <DataGrid.Columns>
                        <DataGridTextColumn
                            Width="150"
                            Binding="{Binding Date}"
                            FontSize="16"
                            Header="日期" />
                        <DataGridTextColumn
                            Width="150"
                            Binding="{Binding Time}"
                            FontSize="16"
                            Header="时间" />
                        <DataGridTextColumn
                            Width="120"
                            Binding="{Binding Grade}"
                            FontSize="16"
                            Header="报警等级" />
                        <DataGridTextColumn
                            Width="180"
                            Binding="{Binding Value}"
                            FontSize="16"
                            Header="报警值" />
                        <DataGridTextColumn
                            Width="*"
                            Binding="{Binding Info}"
                            FontSize="16"
                            Header="报警信息" />
                    </DataGrid.Columns>
                </DataGrid>
            </bpa:ControlDisplay>
            <!--<bpa:MessageContainer Grid.Row="1" Identifier="RawMaterialManagementView" />-->
            <!--#endregion-->
        </Grid>
    </bpa:DialogContainer>
</UserControl>