<UserControl
    x:Class="MECF.Framework.UI.Client.Ctrlib.Controls.CoolingWaterDataPresenter"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:converters="clr-namespace:MECF.Framework.UI.Core.Converters;assembly=MECF.Framework.UI.Core"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:deviceControl="clr-namespace:Aitex.Core.UI.DeviceControl;assembly=MECF.Framework.UI.Core"
    xmlns:deviceData="clr-namespace:MECF.Framework.Common.Aitex.Core.Common.DeviceData;assembly=MECF.Framework.Common"
    xmlns:lex="http://wpflocalizeextension.codeplex.com"
    xmlns:local="clr-namespace:MECF.Framework.UI.Client.Ctrlib.Controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    d:DataContext="{d:DesignInstance Type=deviceData:AITWaterFlowData,
                                     IsDesignTimeCreatable=False}"
    d:DesignHeight="450"
    d:DesignWidth="800"
    lex:LocalizeDictionary.DesignCulture="zh"
    lex:ResxLocalizationProvider.DefaultAssembly="Sicentury.Localization"
    lex:ResxLocalizationProvider.DefaultDictionary="lang_pm"
    mc:Ignorable="d">
    <UserControl.Resources>

        <local:CoolingWaterAlarmTipsConverter x:Key="AlarmTipsConverter" />
        <converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />

        <Style x:Key="WaterTempBackground" TargetType="Border">
            <Setter Property="BorderBrush" Value="{DynamicResource Table_BD}" />
            <Setter Property="BorderThickness" Value="0,0,1,1" />
            <Setter Property="Padding" Value="5,1" />
            <Setter Property="ToolTip">
                <Setter.Value>
                    <ToolTip Content="{Binding Converter={StaticResource AlarmTipsConverter}}" />
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsWarning}" Value="false" />
                        <Condition Binding="{Binding IsAlarm}" Value="false" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Background" Value="Transparent" />
                </MultiDataTrigger>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsWarning}" Value="true" />
                        <Condition Binding="{Binding IsAlarm}" Value="false" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Background" Value="#f4b575" />
                </MultiDataTrigger>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsWarning}" Value="False" />
                        <Condition Binding="{Binding IsAlarm}" Value="True" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Background" Value="#f49f9f" />
                </MultiDataTrigger>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsWarning}" Value="True" />
                        <Condition Binding="{Binding IsAlarm}" Value="True" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Background" Value="#f49f9f" />
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="WaterTempForeground" TargetType="TextBlock">
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="FontFamily" Value="Arial" />
            <Setter Property="FontSize" Value="14" />
            <Setter Property="TextWrapping" Value="Wrap" />
            <Setter Property="Text" Value="{Binding Value, StringFormat=0.00}" />
            <Style.Triggers>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsWarning}" Value="false" />
                        <Condition Binding="{Binding IsAlarm}" Value="false" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Foreground" Value="{DynamicResource FG_Black}" />
                </MultiDataTrigger>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsWarning}" Value="true" />
                        <Condition Binding="{Binding IsAlarm}" Value="false" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Foreground" Value="#e66e2e" />
                </MultiDataTrigger>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsWarning}" Value="False" />
                        <Condition Binding="{Binding IsAlarm}" Value="True" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Foreground" Value="#ff0f0f" />
                </MultiDataTrigger>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsWarning}" Value="True" />
                        <Condition Binding="{Binding IsAlarm}" Value="True" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Foreground" Value="#ff0f0f" />
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>
    <Grid Margin="0,0,0,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="23" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="50" />
            <ColumnDefinition Width="70" />
        </Grid.ColumnDefinitions>

        <Border
            Padding="5,1"
            Background="{DynamicResource Table_BG_Title_Inner}"
            BorderBrush="{DynamicResource Table_BD}"
            BorderThickness="1,0,1,1">
            <TextBlock
                HorizontalAlignment="Right"
                VerticalAlignment="Center"
                lex:ResxLocalizationProvider.DefaultDictionary="lang_pm_terms"
                Text="{lex:Loc {Binding DisplayName, FallbackValue=Unknown}}"
                TextWrapping="Wrap" />
        </Border>
        <Border
            Grid.Column="1"
            Padding="5,1"
            Background="{DynamicResource Table_BG_Content_Inner}"
            BorderBrush="{DynamicResource Table_BD}"
            BorderThickness="0,0,1,1">

            <deviceControl:AITSensor
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                CustomColorOff="Red"
                CustomColorOn="Lime"
                IsCustomRender="True"
                LightOnValue="{Binding IsFlowSW}"
                Visibility="{Binding Converter={StaticResource NullToVisibilityConverter}, Mode=OneTime}" />
        </Border>

        <Border Grid.Column="2" Style="{StaticResource WaterTempBackground}">
            <TextBlock Style="{StaticResource WaterTempForeground}" />
        </Border>

    </Grid>
</UserControl>
