<Page x:Class="FLY.Thick.Base.UI.PgErrorTable"
      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:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
      mc:Ignorable="d" 
      
      d:DesignHeight="768" d:DesignWidth="1024"
	Title="Page_WarningSystem">
    <Page.Resources>
        <ResourceDictionary>
            <Style TargetType="Control" x:Key="iconPackStyle">
                <Setter Property="Width" Value="25"/>
                <Setter Property="Height" Value="auto"/>
                <Setter Property="MaxHeight" Value="25"/>
                <Setter Property="VerticalAlignment" Value="Center"/>
                <Setter Property="HorizontalAlignment" Value="Center"/>
            </Style>
            <Style TargetType="Ellipse" x:Key="backPackStyle">
                <Setter Property="Width" Value="50"/>
                <Setter Property="Height" Value="50"/>
                <Setter Property="Fill" Value="{StaticResource Brushes.Static}"/>
            </Style>
            <Style TargetType="TextBlock" x:Key="titlePackStyle">
                <Setter Property="Margin" Value="2"/>
                <Setter Property="FontSize" Value="16"/>
                <Setter Property="HorizontalAlignment" Value="Center"/>
                <Setter Property="Foreground" Value="{StaticResource Brushes.Text.White}"/>
            </Style>
            <Style TargetType="Button" x:Key="buttonStyle" BasedOn="{StaticResource Styles.Button.Empty}">
                <Setter Property="Margin" Value="20,0"/>
                <Setter Property="Foreground" Value="{StaticResource Brushes.Text.White}"/>
            </Style>
        </ResourceDictionary>
    </Page.Resources>

    <Grid Background="{StaticResource Brushes.ThemeBackground}">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid Background="{StaticResource Brushes.TitleBar.Background}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal" >
                <Button Style="{StaticResource Styles.TitleBar.BackButton2}" Command="BrowseBack"  >
                    <iconPacks:PackIconMaterial Kind="ArrowLeftThick" />
                </Button>
                <TextBlock Style="{StaticResource Styles.TitleBar.Text}"  Text="{StaticResource str.PgErrorTable.Title}"/>
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="60,0,0,0">
                    <Button Style="{StaticResource buttonStyle}" Click="button_iotip_click" >
                        <StackPanel>
                            <Grid Style="{StaticResource Styles.Shadow}">
                                <Ellipse Style="{StaticResource backPackStyle}" />
                                <iconPacks:PackIconMaterial Kind="AlphaI" Style="{StaticResource iconPackStyle}"/>
                            </Grid>
                            <TextBlock Text="{StaticResource str.PgErrorTable.IoTip}" Style="{StaticResource titlePackStyle}"/>
                        </StackPanel>
                    </Button>
                    <Button Style="{StaticResource buttonStyle}" Click="button_access_click" >
                        <StackPanel>
                            <Grid Style="{StaticResource Styles.Shadow}">
                                <Ellipse Style="{StaticResource backPackStyle}" />
                                <iconPacks:PackIconMaterial Kind="LockOpen" Style="{StaticResource iconPackStyle}"/>
                            </Grid>
                            <TextBlock Text="{StaticResource str.PgErrorTable.Access}" Style="{StaticResource titlePackStyle}"/>
                        </StackPanel>
                    </Button>
                    <Button Style="{StaticResource buttonStyle}" Click="button_database_click" >
                        <StackPanel>
                            <Grid Style="{StaticResource Styles.Shadow}">
                                <Ellipse Style="{StaticResource backPackStyle}" />
                                <iconPacks:PackIconMaterial Kind="DatabaseSearch" Style="{StaticResource iconPackStyle}"/>
                            </Grid>
                            <TextBlock Text="{StaticResource str.PgErrorTable.Database}" Style="{StaticResource titlePackStyle}"/>
                        </StackPanel>
                    </Button>
                    <Button Style="{StaticResource buttonStyle}" Click="button_reset_click">
                        <StackPanel>
                            <Grid Style="{StaticResource Styles.Shadow}">
                                <Ellipse Style="{StaticResource backPackStyle}" Fill="{StaticResource Brushes.Fault}" />
                                <iconPacks:PackIconMaterial Kind="RestartAlert" Style="{StaticResource iconPackStyle}" />
                            </Grid>
                            <TextBlock Text="{StaticResource str.PgErrorTable.Reset}" Style="{StaticResource titlePackStyle}"/>
                        </StackPanel>
                    </Button>
                </StackPanel>

            </StackPanel>
            <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" >
                <Button Style="{StaticResource buttonStyle}" Click="button_silence_click" Foreground="{StaticResource Brushes.Fault}">
                    <StackPanel >
                        <Grid Style="{StaticResource Styles.Shadow}">
                            <Ellipse Style="{StaticResource backPackStyle}" Fill="{StaticResource Brushes.Text.White}"/>
                            <iconPacks:PackIconMaterial Kind="VolumeMute" Style="{StaticResource iconPackStyle}"  />
                        </Grid>
                        <TextBlock Text="{StaticResource str.PgErrorTable.Silence}" Style="{StaticResource titlePackStyle}"/>
                    </StackPanel>
                </Button>
            </StackPanel>
        </Grid>
        <DataGrid Grid.Row="1" ItemsSource="{Binding ReasonList}" AutoGenerateColumns="False" IsReadOnly="True" Margin="{StaticResource ControlMargin}"
                      AlternationCount ="2"
                      AlternatingRowBackground="{StaticResource Brushes.Gray9}" 
                      RowHeaderWidth="0"
                      Style="{StaticResource MahApps.Styles.DataGrid.Azure}"
                      FontSize="{StaticResource FontSize.FieldContent.Middle}"
                        
                      >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Time,StringFormat={}{0:MM/dd HH:mm}}" Header="{StaticResource str.PgErrorTable.Time}" />
                <DataGridTextColumn Binding="{Binding ErrCode}" Header="{StaticResource str.PgErrorTable.ErrCode}"/>
                <DataGridTextColumn Binding="{Binding Description}" Header="{StaticResource str.PgErrorTable.Description}"/>
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</Page>

