<UserControl x:Class="ConeCalorimeter.Views.CValueCalibrationView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <UserControl.Resources>
        <Style x:Key="DataLabelStyle" TargetType="TextBlock">
            <Setter Property="FontSize" Value="22" />
            <Setter Property="FontWeight" Value="SemiBold" />
            <Setter Property="Foreground" Value="#111A18" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>

        <Style x:Key="DataValueStyle" TargetType="TextBlock">
            <Setter Property="FontFamily" Value="Consolas" />
            <Setter Property="FontSize" Value="22" />
            <Setter Property="FontWeight" Value="SemiBold" />
            <Setter Property="Foreground" Value="#071614" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>

        <Style x:Key="StatusActionButtonStyle"
               TargetType="Button"
               BasedOn="{StaticResource InstrumentButtonStyle}">
            <Setter Property="Background" Value="#EEF1EF" />
            <Setter Property="BorderBrush" Value="#A9B1AD" />
            <Setter Property="Foreground" Value="#172320" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border x:Name="ButtonBorder"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="6"
                                SnapsToDevicePixels="True">
                            <ContentPresenter Margin="{TemplateBinding Padding}"
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                              RecognizesAccessKey="True" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter TargetName="ButtonBorder" Property="Opacity" Value="0.86" />
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="ButtonBorder" Property="Opacity" Value="0.62" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsActive}" Value="True">
                    <Setter Property="Background" Value="#2F8F5B" />
                    <Setter Property="BorderBrush" Value="#236A45" />
                    <Setter Property="Foreground" Value="#FFFFFF" />
                </DataTrigger>
                <DataTrigger Binding="{Binding IsStatusKnown}" Value="False">
                    <Setter Property="Background" Value="#E5E7E6" />
                    <Setter Property="BorderBrush" Value="#B8BFBB" />
                    <Setter Property="Foreground" Value="#68736E" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>

    <Grid Background="#F4F6F5">
        <Grid.RowDefinitions>
            <RowDefinition Height="76" />
            <RowDefinition Height="96" />
            <RowDefinition Height="270" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid Grid.Row="0"
              Margin="24,10,24,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="150" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="150" />
            </Grid.ColumnDefinitions>

            <Button Content="关闭"
                    Command="{Binding CloseCommand}"
                    Width="100"
                    Height="42"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Top"
                    Style="{StaticResource InstrumentButtonStyle}" />

            <TextBlock Grid.Column="1"
                       Text="C值标定"
                       FontSize="34"
                       FontWeight="SemiBold"
                       Foreground="#101817"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Top" />

            <Button Grid.Column="2"
                    Content="帮助"
                    Command="{Binding HelpCommand}"
                    Width="100"
                    Height="42"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Top"
                    Style="{StaticResource InstrumentButtonStyle}" />
        </Grid>

        <Border Grid.Row="0"
                Height="1"
                Margin="24,0"
                Background="#C9D0CC"
                VerticalAlignment="Bottom" />

        <Border Grid.Row="1"
                Margin="24,0"
                Background="#FBFCFB"
                BorderBrush="#C9D0CC"
                BorderThickness="1,1,1,0">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="42" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <TextBlock Text="基线数据"
                           FontSize="22"
                           FontWeight="SemiBold"
                           Foreground="#1B2826"
                           HorizontalAlignment="Center"
                           VerticalAlignment="Center" />

                <StackPanel Grid.Row="1"
                            Margin="124,0,96,28"
                            Orientation="Horizontal"
                            VerticalAlignment="Center">
                    <TextBlock Text="XO2:"
                               Style="{StaticResource DataLabelStyle}" />
                    <TextBlock Text="{Binding BaselineOxygenText}"
                               Margin="56,0,0,0"
                               MinWidth="80"
                               Style="{StaticResource DataValueStyle}" />
                    <TextBlock Text="%"
                               Margin="24,0,0,0"
                               Style="{StaticResource DataLabelStyle}" />
                </StackPanel>
            </Grid>
        </Border>

        <Border Grid.Row="2"
                Margin="24,0"
                Background="#FBFCFB"
                BorderBrush="#C9D0CC"
                BorderThickness="1">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="56" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <TextBlock Text="标定数据"
                           FontSize="22"
                           FontWeight="SemiBold"
                           Foreground="#1B2826"
                           HorizontalAlignment="Center"
                           VerticalAlignment="Center" />

                <Grid Grid.Row="1"
                      Margin="124,0,96,28">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="92" />
                        <ColumnDefinition Width="100" />
                        <ColumnDefinition Width="90" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="92" />
                        <ColumnDefinition Width="96" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Text="Te:"
                               Style="{StaticResource DataLabelStyle}" />
                    <TextBlock Grid.Column="1"
                               Text="{Binding TemperatureText}"
                               Style="{StaticResource DataValueStyle}" />
                    <TextBlock Grid.Column="2"
                               Text="K"
                               Style="{StaticResource DataLabelStyle}" />

                    <TextBlock Grid.Column="5"
                               Text="Δp:"
                               Style="{StaticResource DataLabelStyle}" />
                    <TextBlock Grid.Column="6"
                               Text="{Binding PressureDifferenceText}"
                               Style="{StaticResource DataValueStyle}" />
                    <TextBlock Grid.Column="7"
                               Text="Pa"
                               Style="{StaticResource DataLabelStyle}" />

                    <TextBlock Grid.Row="1"
                               Text="qb:"
                               Style="{StaticResource DataLabelStyle}" />
                    <TextBlock Grid.Row="1"
                               Grid.Column="1"
                               Text="{Binding HeatInputText}"
                               Style="{StaticResource DataValueStyle}" />
                    <TextBlock Grid.Row="1"
                               Grid.Column="2"
                               Text="KW"
                               Style="{StaticResource DataLabelStyle}" />

                    <TextBlock Grid.Row="1"
                               Grid.Column="5"
                               Text="XO2:"
                               Style="{StaticResource DataLabelStyle}" />
                    <TextBlock Grid.Row="1"
                               Grid.Column="6"
                               Text="{Binding CalibrationOxygenText}"
                               Style="{StaticResource DataValueStyle}" />
                    <TextBlock Grid.Row="1"
                               Grid.Column="7"
                               Text="%"
                               Style="{StaticResource DataLabelStyle}" />

                    <TextBlock Grid.Row="2"
                               Text="C:"
                               Style="{StaticResource DataLabelStyle}" />
                    <TextBlock Grid.Row="2"
                               Grid.Column="1"
                               Text="{Binding CValueText}"
                               Style="{StaticResource DataValueStyle}" />
                </Grid>
            </Grid>
        </Border>

        <Grid Grid.Row="3"
              Margin="24,12,24,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="58" />
                <RowDefinition Height="58" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <ItemsControl ItemsSource="{Binding TopActions}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal" />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Button Content="{Binding DisplayText}"
                                Command="{Binding Command}"
                                CommandParameter="{Binding Label}"
                                IsEnabled="{Binding IsEnabled}"
                                Width="150"
                                Height="42"
                                Margin="0,5,14,5"
                                Style="{StaticResource StatusActionButtonStyle}" />
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>

            <ItemsControl Grid.Row="1"
                          ItemsSource="{Binding BottomActions}"
                          HorizontalAlignment="Left">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal" />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Button Content="{Binding DisplayText}"
                                Command="{Binding Command}"
                                CommandParameter="{Binding Label}"
                                IsEnabled="{Binding IsEnabled}"
                                Width="150"
                                Height="42"
                                Margin="0,5,24,5"
                                Style="{StaticResource StatusActionButtonStyle}" />
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>

            <TextBlock Grid.Row="2"
                       Text="{Binding LastAction, StringFormat=最近操作：{0}}"
                       Margin="0,6,0,0"
                       FontSize="16"
                       Foreground="#53615C" />
        </Grid>
    </Grid>
</UserControl>
