<UserControl x:Class="MegaRobo.C00225155App.DevicesViews.DeviceStatusView"
             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:local="clr-namespace:MegaRobo.C00225155App.DevicesViews"
             xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
             xmlns:mat="clr-namespace:Telerik.Windows.Controls.MaterialControls;assembly=Telerik.Windows.Controls"
             xmlns:mega="clr-namespace:MegaRobo.WpfComponents.MegaControls;assembly=MegaRobo.WpfComponents"
             xmlns:navi="clr-namespace:Telerik.Windows.Controls.Navigation;assembly=Telerik.Windows.Controls.Navigation"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:converter="clr-namespace:MegaRobo.C00225155App.Converters"
             mc:Ignorable="d"   Foreground="Black"
             DataContext="{Binding DeviceStatusVM, Source={StaticResource vmLocator}}"
             d:DesignHeight="520" d:DesignWidth="282">
    <UserControl.Resources>
        <Style TargetType="telerik:GridViewHeaderCell">
            <Setter Property="Foreground" Value="White"/>
            <!--<Setter Property="HorizontalContentAlignment" Value="Center"/>-->
        </Style>

        <Style TargetType="telerik:GridViewHeaderRow">
            <Setter Property="Background" Value="#FF117EDF" />
            <Setter Property="VerticalAlignment" Value="Top"/>
        </Style>


        <Style x:Key="DeviceStatusLightStyle" TargetType="Control">
            <Setter Property="Width" Value="16"/>
            <Setter Property="Height" Value="16"/>
            <Setter Property="Margin" Value="10,0"/>
            <!--<Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Control">
                        <Grid>
                            <iconPacks:PackIconMaterial Width="16"  Height="20" VerticalAlignment="Center" Kind="Brightness7"  Foreground="#FFB5B0B0"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>-->
            <Style.Triggers>
                <!-- 绑定自身 Tag 属性（枚举值） -->
                <Trigger Property="Tag" Value="Ongoing">
                    <Trigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard RepeatBehavior="Forever">
                                <DoubleAnimation 
                                Storyboard.TargetProperty="Opacity"
                                From="1" To="0.4" 
                                Duration="0:0:0.8" 
                                AutoReverse="True"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.EnterActions>
                </Trigger>
            </Style.Triggers>
        </Style>

    </UserControl.Resources>
    <StackPanel>
        <DockPanel>
            <DockPanel DockPanel.Dock="Top" >
                <Grid DockPanel.Dock="Top" Height="auto" VerticalAlignment="Stretch" Visibility="{Binding PlcErrorList,Converter={StaticResource CollectionCountToVisibility}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition Width="15"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="报错地址" Foreground="{StaticResource TextGreyColor}" Width="Auto"  Margin="3 0"/>
                    <Border Grid.Column="1" BorderThickness="0.5" Background="LightGray" Width="1.2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="3 0"/>
                    <TextBlock  Grid.Column="2" Text="报错信息" Foreground="{StaticResource TextGreyColor}"  />
                </Grid>
            </DockPanel>
            <ItemsControl ItemsSource="{Binding PlcErrorList, Mode=TwoWay}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate >
                        <Border BorderThickness="0" BorderBrush="#adb5bd" Margin="2" Padding="5" CornerRadius="3">
                            <DockPanel LastChildFill="False">
                                <Grid DockPanel.Dock="Top" Height="auto" VerticalAlignment="Stretch">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="auto"/>
                                        <ColumnDefinition Width="15"/>
                                        <ColumnDefinition/>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="0" Text="{Binding ErrorAddress}"  Width="Auto"   Margin="3 0"/>
                                    <TextBlock Grid.Column="2" Text="{Binding ErrorInfo}" Foreground="Red" />
                                </Grid>
                            </DockPanel>
                        </Border>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </DockPanel>
        <!--<telerik:RadGridView  VerticalAlignment="Top"  AutoGenerateColumns="False"  CanUserFreezeColumns="False"  CanUserReorderColumns="False"  
                       ItemsSource="{Binding PlcErrorList}"    ScrollViewer.IsDeferredScrollingEnabled="False"
                       Opacity="1"  RowHeight="32"  RowIndicatorVisibility="Collapsed"  ShowColumnFooters="False"  ShowGroupPanel="False"
                       Margin="1,1,1,3"  Visibility="{Binding PlcErrorList,Converter={StaticResource CollectionCountToVisibility}}">
            <telerik:RadGridView.Columns>
                -->
        <!-- 地址列 -->
        <!--
                <telerik:GridViewDataColumn    DataMemberBinding="{Binding ErrorAddress}"   Header="报错地址"     Width="Auto"    TextAlignment="Center"/>

                -->
        <!-- 错误信息列 -->
        <!--
                <telerik:GridViewDataColumn    DataMemberBinding="{Binding ErrorInfo}"   Header="报错信息"  Width="*"  TextWrapping="Wrap"/>
            </telerik:RadGridView.Columns>

            -->
        <!-- 行样式：当有错误时高亮显示 -->
        <!--
            <telerik:RadGridView.RowStyle>
                <Style TargetType="telerik:GridViewRow">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding ErrorInfo}" Value="{x:Null}">
                            <Setter Property="Background" Value="Transparent"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding ErrorInfo}" Value="">
                            <Setter Property="Background" Value="Transparent"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding ErrorInfo}" Value="{x:Null}">
                            <Setter Property="Background" Value="#FFE53939"/>
                            -->
        <!--<Setter Property="Foreground" Value="White"/>-->
        <!--
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </telerik:RadGridView.RowStyle>
        </telerik:RadGridView>-->

        <Border VerticalAlignment="Top" BorderBrush="{DynamicResource BorderColor}" BorderThickness="0" SnapsToDevicePixels="True">
            <mega:MegaGrid >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="24*" />
                        <ColumnDefinition Width="12*" />
                        <ColumnDefinition Width="150*" />
                        <ColumnDefinition Width="150*"/>
                    </Grid.ColumnDefinitions>
                    <mega:MegaAlert  Grid.ColumnSpan="4" ShowMode="WarnText"  WarnText="{Binding Pipe1mlWarnText, Mode=OneWay}" />
                    <StackPanel Grid.ColumnSpan="4" Orientation="Horizontal">
                        <!--<Control Style="{StaticResource DeviceStatusLightStyle}" Background="{Binding Pipette1Ml_Config_WorkStatus,Converter={StaticResource workStatusConverter}}" Tag="{Binding Pipette1Ml_Config_WorkStatus,FallbackValue=None}" />-->
                        <iconPacks:PackIconMaterial Width="32"  Height="20" VerticalAlignment="Center" Kind="nail" />
                        <TextBlock VerticalAlignment="Center"  FontSize="13" Text="配置站移液枪-1ml"  Margin="5,0,15,0"/>
                        <mega:WorkStatusBar  WorkStatusItem="{Binding Pipette1Ml_Config_WorkStatus}" />
                    </StackPanel>
                </Grid>
            </mega:MegaGrid>
        </Border >
        <DockPanel Height="10" DockPanel.Dock="Top">
            <!--<telerik:Label Width="60" Content="{Binding Pipette1Ml_Config_WorkStatus.Tag}" />
            <mega:WorkStatusBar TimeMode="UsedTime" WorkStatusItem="{Binding Pipette1Ml_Config_WorkStatus}" />-->
        </DockPanel>


        <Border VerticalAlignment="Top" BorderBrush="{DynamicResource BorderColor}" BorderThickness="0" SnapsToDevicePixels="True">
            <mega:MegaGrid >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="10*" />
                        <ColumnDefinition Width="10.071" />
                        <ColumnDefinition Width="63*" />
                        <ColumnDefinition Width="63*" />
                    </Grid.ColumnDefinitions>
                    <mega:MegaAlert Grid.ColumnSpan="4" ShowMode="WarnText"  WarnText="{Binding Pipe5mlWarnText, Mode=OneWay}" />
                    <StackPanel Grid.ColumnSpan="4" Orientation="Horizontal">
                        <!--<Control Style="{StaticResource DeviceStatusLightStyle}" Background="{Binding Pipette5Ml_Config_WorkStatus,Converter={StaticResource workStatusConverter}}" Tag="{Binding Pipette5Ml_Config_WorkStatus, FallbackValue=None}"/>-->
                        <iconPacks:PackIconMaterial Width="32"  Height="20" VerticalAlignment="Center" Kind="nail" />
                        <TextBlock VerticalAlignment="Center"  FontSize="13" Text="配置站移液枪-5ml" Margin="5,0,15,0"/>
                        <mega:WorkStatusBar  WorkStatusItem="{Binding Pipette5Ml_Config_WorkStatus}" />
                    </StackPanel>
                </Grid>
            </mega:MegaGrid>
        </Border>
        <DockPanel Height="10" DockPanel.Dock="Top">
            <!--<telerik:Label Width="60" Content="{Binding Pipette5Ml_Config_WorkStatus.Tag}" />
            <mega:WorkStatusBar TimeMode="UsedTime" WorkStatusItem="{Binding Pipette5Ml_Config_WorkStatus}" />-->
        </DockPanel>

        <!--<Border VerticalAlignment="Top" BorderBrush="{DynamicResource BorderColor}" BorderThickness="0" SnapsToDevicePixels="True">
            <mega:MegaGrid >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="24*" />
                        <ColumnDefinition Width="12*" />
                        <ColumnDefinition Width="83*" />
                        <ColumnDefinition Width="241*" />
                    </Grid.ColumnDefinitions>
                    <mega:MegaAlert Grid.ColumnSpan="4" ShowMode="WarnText"  WarnText="{Binding Pipe5mlWarnText_Detect, Mode=OneWay}" />
                    <StackPanel Grid.ColumnSpan="4" Orientation="Horizontal">
                        <iconPacks:PackIconMaterial Width="32"  Height="20" VerticalAlignment="Center" Kind="nail" />
                        <TextBlock VerticalAlignment="Center"  FontSize="13" Text="检测站移液枪-5ml" />
                    </StackPanel>
                </Grid>
            </mega:MegaGrid>
        </Border>
        <DockPanel Height="25" DockPanel.Dock="Top">
            <telerik:Label Width="60" Content="{Binding Pipette5Ml_Detect_WorkStatus.Tag}" />
            <mega:WorkStatusBar TimeMode="UsedTime" WorkStatusItem="{Binding Pipette5Ml_Detect_WorkStatus}" />
        </DockPanel>-->

        <!--<Border VerticalAlignment="Top" BorderBrush="{DynamicResource BorderColor}" BorderThickness="0" SnapsToDevicePixels="True">
            <mega:MegaGrid >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="24*" />
                        <ColumnDefinition Width="12*" />
                        <ColumnDefinition Width="83*" />
                        <ColumnDefinition Width="241*" />
                    </Grid.ColumnDefinitions>
                    <mega:MegaAlert Grid.ColumnSpan="4" ShowMode="WarnText"  WarnText="{Binding RamanWarnText, Mode=OneWay}" />
                    <StackPanel Grid.ColumnSpan="4" Orientation="Horizontal">
                        <iconPacks:PackIconMaterial Width="32"  Height="20" VerticalAlignment="Center" Kind="StateMachine"  />
                        <TextBlock VerticalAlignment="Center"  FontSize="13" Text="拉曼光谱" />
                    </StackPanel>
                </Grid>
            </mega:MegaGrid>
        </Border>
        <DockPanel Height="25" DockPanel.Dock="Top">
            <telerik:Label Width="60" Content="{Binding RamanWorkStatus.Tag}" />
            <mega:WorkStatusBar TimeMode="UsedTime" WorkStatusItem="{Binding RamanWorkStatus}" />
        </DockPanel>-->

        <Border VerticalAlignment="Top" BorderBrush="{DynamicResource BorderColor}" BorderThickness="0" SnapsToDevicePixels="True">
            <mega:MegaGrid >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="24*" />
                        <ColumnDefinition Width="12*" />
                        <ColumnDefinition Width="150*" />
                        <ColumnDefinition Width="150*" />
                    </Grid.ColumnDefinitions>
                    <mega:MegaAlert Grid.ColumnSpan="4" ShowMode="WarnText"  WarnText="{Binding MagneticStirWarnText, Mode=OneWay}" />
                    <StackPanel Grid.ColumnSpan="4" Orientation="Horizontal">
                        <!--<Control Style="{StaticResource DeviceStatusLightStyle}" Background="{Binding MagneticStirWorkStatus,Converter={StaticResource workStatusConverter}}" Tag="{Binding MagneticStirWorkStatus,FallbackValue=None}" />-->
                        <iconPacks:PackIconMaterial Width="32"  Height="20" VerticalAlignment="Center" Kind="PotMixOutline" />
                        <TextBlock VerticalAlignment="Center"  FontSize="13" Text="磁力搅拌"  Margin="5,0,15,0"/>
                        <mega:WorkStatusBar  WorkStatusItem="{Binding MagneticStirWorkStatus}" />
                    </StackPanel>
                </Grid>
            </mega:MegaGrid>
        </Border>
        <DockPanel Height="10" DockPanel.Dock="Top">
            <!--<telerik:Label Width="60" Content="{Binding MagneticStirWorkStatus.Tag}" />
            <mega:WorkStatusBar TimeMode="UsedTime" WorkStatusItem="{Binding MagneticStirWorkStatus}" />-->
        </DockPanel>

        <Border VerticalAlignment="Top" BorderBrush="{DynamicResource BorderColor}" BorderThickness="0" SnapsToDevicePixels="True">
            <mega:MegaGrid >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="24*" />
                        <ColumnDefinition Width="12*" />
                        <ColumnDefinition Width="150*" />
                        <ColumnDefinition Width="150*" />
                    </Grid.ColumnDefinitions>
                    <mega:MegaAlert Grid.ColumnSpan="4" ShowMode="WarnText"  WarnText="{Binding Scanner1WarnText, Mode=OneWay}" />
                    <StackPanel Grid.ColumnSpan="4" Orientation="Horizontal">
                        <!--<Control Style="{StaticResource DeviceStatusLightStyle}" Background="{Binding Scanner1WorkStatus,Converter={StaticResource workStatusConverter}}" Tag="{Binding Scanner1WorkStatus,FallbackValue=None}" />-->
                        <iconPacks:PackIconMaterial Width="32"  Height="20" VerticalAlignment="Center" Kind="QrcodeScan"  />
                        <TextBlock VerticalAlignment="Center"  FontSize="13" Text="配置站扫码枪" Margin="5,0,15,0"/>
                        <mega:WorkStatusBar  WorkStatusItem="{Binding Scanner1WorkStatus}" />
                    </StackPanel>
                </Grid>
            </mega:MegaGrid>
        </Border>
        <DockPanel Height="10" DockPanel.Dock="Top">
            <!--<telerik:Label Width="60" Content="{Binding Scanner1WorkStatus.Tag}" />
            <mega:WorkStatusBar TimeMode="UsedTime" WorkStatusItem="{Binding Scanner1WorkStatus}" />-->
        </DockPanel>

        <!--<Border VerticalAlignment="Top" BorderBrush="{DynamicResource BorderColor}" BorderThickness="0" SnapsToDevicePixels="True">
            <mega:MegaGrid >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="24*" />
                        <ColumnDefinition Width="12*" />
                        <ColumnDefinition Width="83*" />
                        <ColumnDefinition Width="241*" />
                    </Grid.ColumnDefinitions>
                    <mega:MegaAlert Grid.ColumnSpan="4" ShowMode="WarnText"  WarnText="{Binding Scanner2WarnText, Mode=OneWay}" />
                    <StackPanel Grid.ColumnSpan="4" Orientation="Horizontal">
                        <iconPacks:PackIconMaterial Width="32"  Height="20" VerticalAlignment="Center" Kind="QrcodeScan"  />
                        <TextBlock VerticalAlignment="Center"  FontSize="13" Text="检测站扫码枪" />
                    </StackPanel>
                </Grid>
            </mega:MegaGrid>
        </Border>
        <DockPanel Height="25" DockPanel.Dock="Top">
            <telerik:Label Width="60" Content="{Binding Scanner2WorkStatus.Tag}" />
            <mega:WorkStatusBar TimeMode="UsedTime" WorkStatusItem="{Binding Scanner2WorkStatus}" />
        </DockPanel>-->


        <Border VerticalAlignment="Top" BorderBrush="{DynamicResource BorderColor}" BorderThickness="0" SnapsToDevicePixels="True">
            <mega:MegaGrid >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="24*" />
                        <ColumnDefinition Width="12*" />
                        <ColumnDefinition Width="150*" />
                        <ColumnDefinition Width="150*" />
                    </Grid.ColumnDefinitions>
                    <mega:MegaAlert Grid.ColumnSpan="4" ShowMode="WarnText"  WarnText="{Binding LiquidWeightWarnText, Mode=OneWay}" />
                    <StackPanel Grid.ColumnSpan="4" Orientation="Horizontal">
                        <!--<Control Style="{StaticResource DeviceStatusLightStyle}" Background="{Binding LiquidWeightWorkStatus,Converter={StaticResource workStatusConverter}}"  Tag="{Binding LiquidWeightWorkStatus,FallbackValue=None}"/>-->
                        <iconPacks:PackIconMaterial Width="32"  Height="20" VerticalAlignment="Center" Kind="Scale"  />
                        <TextBlock VerticalAlignment="Center"  FontSize="13" Text="液体称重" Margin="5,0,15,0"/>
                        <mega:WorkStatusBar TimeMode="UsedTime" WorkStatusItem="{Binding LiquidWeightWorkStatus}" />
                    </StackPanel>
                </Grid>
            </mega:MegaGrid>
        </Border>
        <DockPanel Height="10" DockPanel.Dock="Top">
            <!--<telerik:Label Width="60" Content="{Binding LiquidWeightWorkStatus.Tag}" />
            <mega:WorkStatusBar TimeMode="UsedTime" WorkStatusItem="{Binding LiquidWeightWorkStatus}" />-->
        </DockPanel>

        <Border VerticalAlignment="Top" BorderBrush="{DynamicResource BorderColor}" BorderThickness="0" SnapsToDevicePixels="True">
            <mega:MegaGrid >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="24*" />
                        <ColumnDefinition Width="12*" />
                        <ColumnDefinition Width="150*" />
                        <ColumnDefinition Width="150*" />
                    </Grid.ColumnDefinitions>
                    <mega:MegaAlert Grid.ColumnSpan="4" ShowMode="WarnText"  WarnText="{Binding PowderWeightWarnText, Mode=OneWay}" />
                    <StackPanel Grid.ColumnSpan="4" Orientation="Horizontal">
                        <!--<Control Style="{StaticResource DeviceStatusLightStyle}" Background="{Binding PowderWeightWorkStatus,Converter={StaticResource workStatusConverter}}"  Tag="{Binding PowderWeightWorkStatus,FallbackValue=None}"/>-->
                        <iconPacks:PackIconMaterial Width="32"  Height="20" VerticalAlignment="Center" Kind="Scale"  />
                        <TextBlock VerticalAlignment="Center"  FontSize="13" Text="粉末称重"  Margin="5,0,15,0"/>
                        <mega:WorkStatusBar  WorkStatusItem="{Binding PowderWeightWorkStatus}" />
                    </StackPanel>
                </Grid>
            </mega:MegaGrid>
        </Border>
        <DockPanel Height="10" DockPanel.Dock="Top">
            <!--<telerik:Label Width="60" Content="{Binding PowderWeightWorkStatus.Tag}" />
            <mega:WorkStatusBar TimeMode="UsedTime" WorkStatusItem="{Binding PowderWeightWorkStatus}" />-->
        </DockPanel>


        <!--<Border VerticalAlignment="Top" BorderBrush="{DynamicResource BorderColor}" BorderThickness="0" SnapsToDevicePixels="True">
            <mega:MegaGrid >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="24*" />
                        <ColumnDefinition Width="12*" />
                        <ColumnDefinition Width="83*" />
                        <ColumnDefinition Width="241*" />
                    </Grid.ColumnDefinitions>
                    <mega:MegaAlert Grid.ColumnSpan="4" ShowMode="WarnText"  WarnText="{Binding DetectWeightWarnText, Mode=OneWay}" />
                    <StackPanel Grid.ColumnSpan="4" Orientation="Horizontal">
                        <iconPacks:PackIconMaterial Width="32"  Height="20" VerticalAlignment="Center" Kind="Scale"  />
                        <TextBlock VerticalAlignment="Center"  FontSize="13" Text="检测称重" />
                    </StackPanel>
                </Grid>
            </mega:MegaGrid>
        </Border>
        <DockPanel Height="25" DockPanel.Dock="Top">
            <telerik:Label Width="60" Content="{Binding DetectWeightWorkStatus.Tag}" />
            <mega:WorkStatusBar TimeMode="UsedTime" WorkStatusItem="{Binding DetectWeightWorkStatus}" />
        </DockPanel>-->


    </StackPanel>
</UserControl>
