<Page x:Class="MWS.Domain.View.History.HistoryReportPage"
      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:MWS.Domain.View.History"
      mc:Ignorable="d" 
      xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes" 
      xmlns:ControlHelper="clr-namespace:MWS.Domain.Common.ControlHelper" 
      d:DesignHeight="935" d:DesignWidth="1721"
      Title="HistoryReportPage"  Background="#F3F7FA" Loaded="Page_Loaded" Unloaded="Page_Unloaded">

    <Grid>
        <DockPanel   Height="80" VerticalAlignment="Top" Grid.ColumnSpan="2">

            <StackPanel Orientation="Horizontal"  Margin="21,20,12,20" >
                <TextBlock Text="设备" VerticalAlignment="Center" Margin="0,0,10,0" />
                <ComboBox x:Name="device"  Style="{StaticResource DefaultComboBoxStyle}"  ItemsSource="{Binding}"
                          md:HintAssist.Hint="全部"   Height="36"   Width="160" >

                </ComboBox>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="12,20" >
                <TextBlock Text="时间范围" VerticalAlignment="Center" Margin="0,0,10,0" />
                <Button x:Name="btDataSelect" Height="36" Foreground="#888888" Width="280" BorderThickness="1" Background="#FFFFFF" BorderBrush="#CCCCCC"  Click="btDataSelect_Click">
                    <TextBlock >
                            <Label Content="选择时间" x:Name="lbDateTimeSelect" FontSize="14" Margin="0,0,0,1"/>
                    </TextBlock>
                </Button>
                <!--<Button x:Name="btDateTime"  Height="36" Margin="20,0" Background="#2DA6EC" BorderThickness="0" md:ButtonAssist.CornerRadius="5" Click="btDateTime_Click">
                    <TextBlock>
                            <md:PackIcon Kind="CheckOutline" Width="20" Height="20" Margin="0,2"/>
                            <Label Content="选择" FontSize="14" Foreground="#FFFFFF" />
                    </TextBlock>
                </Button>-->
            </StackPanel>
            <StackPanel Orientation="Horizontal" >
                <Button x:Name="selectVar"  Height="36" Width="120" Background="#FFFFFF" BorderThickness="1" BorderBrush="#2DA6EC" md:ButtonAssist.CornerRadius="5" Command="{Binding SelectVarCodeCommand}" Click="selectVar_Click">
                    <TextBlock >
                            <Image Source="/Assets/Images/add.png" Height="20" Width="20" Margin="0,4" />
                            <Label Content="选择变量" FontSize="14" Foreground="#2DA6EC" Margin="0,0,0,1"/>
                    </TextBlock>
                </Button>
            </StackPanel>
            <StackPanel Orientation="Horizontal"  Margin=" 10,0">
                <ItemsControl ItemsSource="{Binding DeviceTags}">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal"/>
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate >
                        <DataTemplate>
                            <Button Background="#D4EFDA" Height="23" md:ButtonAssist.CornerRadius="3" BorderBrush="#A7E8B4" Margin="5,0">
                                <TextBlock Text="{Binding Name}" Foreground="#509B6E" Margin="0,-2,0,0"></TextBlock>
                            </Button>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
        
            </StackPanel>
            <StackPanel Orientation="Horizontal"  DockPanel.Dock="Right" HorizontalAlignment="Right">
                <Button x:Name="search"  Height="36" Margin="10,20,20,20" Background="#2DA6EC" BorderThickness="0" md:ButtonAssist.CornerRadius="5" Click="search_Click">
                    <TextBlock>
                        
                 <md:PackIcon Kind="Crosshairs" Width="20" Height="20" Margin="0,2"/>
                <Label Content="查询" FontSize="14" Foreground="#FFFFFF" />
                    </TextBlock>
                </Button>
                <!--<Button x:Name="export"  Height="36" Margin="10,20,20,20"  Background="#2DA6EC" BorderThickness="0" md:ButtonAssist.CornerRadius="5">
                    <TextBlock>
                 <md:PackIcon Kind="Export" Width="20" Height="20" Margin="0,2"/>
                <Label Content="导出" FontSize="14" Foreground="#FFFFFF" />
                    </TextBlock>
                </Button>-->
            </StackPanel>
        </DockPanel>
        <md:Card Height="835" md:ShadowAssist.ShadowDepth="Depth1" Background="#FFFFFF" Margin="21,80,21,0">
            <StackPanel Orientation="Vertical">
                <StackPanel Height="770" >
                    <ItemsControl ItemsSource="{Binding TagRecordDtos}" >
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Vertical"/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate >
                                <StackPanel Orientation="Horizontal">
                                    <Border BorderBrush="#C5D5DE" BorderThickness="1">
                                        <StackPanel Background="#4C8EC6" Height="68" Width="179" HorizontalAlignment="Center" VerticalAlignment="Center" >
                                            <TextBlock Foreground="#FFFFFF" FontSize="14" Text="{Binding Time}"  HorizontalAlignment="Center"
                                               Margin="0,25,0,0"></TextBlock>
                                        </StackPanel>
                                    </Border>
                                    <ItemsControl ItemsSource="{Binding Records}" Height="70" >
                                        <ItemsControl.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <WrapPanel />
                                            </ItemsPanelTemplate>
                                        </ItemsControl.ItemsPanel>
                                        <ItemsControl.ItemTemplate>
                                            <DataTemplate>
                                                <Border BorderBrush="#C5D5DE" BorderThickness="1">
                                                    <StackPanel Background="#EDF4F8" Height="68" Width="250" Orientation="Vertical">
                                                        <StackPanel HorizontalAlignment="Center" Margin="0,20,0,0">
                                                            <TextBlock Text="{Binding TagName}" FontSize="14" Foreground="#4D4E4F"></TextBlock>
                                                        </StackPanel>
                                                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Visibility="{Binding ValueVisibility}">
                                                            <TextBlock Text="{Binding Value}" FontSize="14" Foreground="#4D4E4F" ></TextBlock>
                                                            <TextBlock Text="{Binding UnitSign}" FontSize="14" Foreground="#4D4E4F"></TextBlock>
                                                        </StackPanel>
                                                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"   Visibility="{Binding LightVisibility}">
                                                            <TextBlock Text="{Binding Value}" FontSize="14"  Foreground="#4D4E4F"></TextBlock>
                                                            <Border CornerRadius="3" Height="12" Width="6" Background="{Binding Light}" Margin="5,0,0,0"></Border>
                                                        </StackPanel>
                                                       
                                                    </StackPanel>
                                                </Border>
                                            </DataTemplate>
                                        </ItemsControl.ItemTemplate>
                                    </ItemsControl>
                                </StackPanel>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>

                    <!--<StackPanel Orientation="Horizontal">
                        <Border BorderBrush="#C5D5DE" BorderThickness="1">
                            <StackPanel Background="#4C8EC6" Height="68" Width="179" HorizontalAlignment="Center" VerticalAlignment="Center" >
                                <TextBlock Foreground="#FFFFFF" FontSize="14" Text="2021-08-05 17:49:00"  HorizontalAlignment="Center"
                                           Margin="0,25,0,0"></TextBlock>
                            </StackPanel>
                        </Border>
                        <Border BorderBrush="#C5D5DE" BorderThickness="1">
                            <StackPanel Background="#EDF4F8" Height="68" Width="250" Orientation="Vertical">
                                <StackPanel HorizontalAlignment="Center" Margin="0,20,0,0">
                                    <TextBlock Text="主起升机构上升" FontSize="14" Foreground="#4D4E4F"></TextBlock>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                    <TextBlock Text="恢复" FontSize="14"  Foreground="#4D4E4F"></TextBlock>
                                    <Border CornerRadius="3" Height="12" Width="6" Background="#4BD67A" Margin="5,0,0,0"></Border>
                                </StackPanel>
                            </StackPanel>
                        </Border>
                        <Border BorderBrush="#C5D5DE" BorderThickness="1">
                            <StackPanel Background="#EDF4F8" Height="68" Width="250" Orientation="Vertical">
                                <StackPanel HorizontalAlignment="Center" Margin="0,20,0,0">
                                    <TextBlock Text="主起升机构上升" FontSize="14" Foreground="#4D4E4F"></TextBlock>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                    <TextBlock Text="恢复" FontSize="14"  Foreground="#4D4E4F"></TextBlock>
                                    <Border CornerRadius="3" Height="12" Width="6" Background="#F1455F" Margin="5,0,0,0"></Border>
                                </StackPanel>
                            </StackPanel>
                        </Border>
                        <Border BorderBrush="#C5D5DE" BorderThickness="1">
                            <StackPanel Background="#EDF4F8" Height="68" Width="250" Orientation="Vertical">
                                <StackPanel HorizontalAlignment="Center" Margin="0,20,0,0">
                                    <TextBlock Text="主起升机构上升" FontSize="14" Foreground="#4D4E4F"></TextBlock>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                    <TextBlock Text="恢复" FontSize="14"  Foreground="#4D4E4F"></TextBlock>
                                    <Border CornerRadius="3" Height="12" Width="6" Background="#90919E" Margin="5,0,0,0"></Border>
                                </StackPanel>
                            </StackPanel>
                        </Border>
                        <Border BorderBrush="#C5D5DE" BorderThickness="1">
                            <StackPanel Background="#EDF4F8" Height="68" Width="250" Orientation="Vertical" >
                                <StackPanel HorizontalAlignment="Center" Margin="0,20,0,0">
                                    <TextBlock Text="主起升高度" FontSize="14" Foreground="#4D4E4F"></TextBlock>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                    <TextBlock Text="2.8" FontSize="14"  Foreground="#4D4E4F"></TextBlock>
                                    <TextBlock Text="m" FontSize="14"  Foreground="#4D4E4F"></TextBlock>
                                </StackPanel>
                            </StackPanel>
                        </Border>
                        <Border BorderBrush="#C5D5DE" BorderThickness="1">
                            <StackPanel Background="#EDF4F8" Height="68" Width="250" Orientation="Vertical">
                                <StackPanel HorizontalAlignment="Center" Margin="0,20,0,0">
                                    <TextBlock Text="主起升机构上升" FontSize="14" Foreground="#4D4E4F"></TextBlock>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                    <TextBlock Text="上升1档" FontSize="14"  Foreground="#4D4E4F"></TextBlock>
                                    <TextBlock Text="m" FontSize="14"  Foreground="#4D4E4F"></TextBlock>
                                </StackPanel>
                            </StackPanel>
                        </Border>
                        <Border BorderBrush="#C5D5DE" BorderThickness="1">
                            <StackPanel Background="#EDF4F8" Height="68" Width="250" Orientation="Vertical">
                                <StackPanel HorizontalAlignment="Center" Margin="0,20,0,0">
                                    <TextBlock Text="主起升机构上升" FontSize="14" Foreground="#4D4E4F"></TextBlock>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                    <TextBlock Text="恢复" FontSize="14"  Foreground="#4D4E4F"></TextBlock>
                                    <Border CornerRadius="3" Height="12" Width="6" Background="#4BD67A" Margin="5,0,0,0"></Border>
                                </StackPanel>
                            </StackPanel>
                        </Border>
                    </StackPanel>-->

                </StackPanel>

                <StackPanel  VerticalAlignment="Center" Height="70">
                    <ControlHelper:Pagination PageDataCount="11"  x:Name="pagination" Height="70"/>
                </StackPanel>

            </StackPanel>
        </md:Card>
    </Grid>
</Page>
