<Window x:Class="NEIntelligentControl2.Windows.ControlTrackWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:NEIntelligentControl2.Windows"
        mc:Ignorable="d"
        Title="控制跟踪" Height="662" Width="1200" Loaded="Window_Loaded" Background="#FF454545" WindowStyle="None" WindowStartupLocation="CenterOwner" Closing="Window_Closing">
    <WindowChrome.WindowChrome>
        <WindowChrome/>
    </WindowChrome.WindowChrome>
    <Window.Resources>

        <Style TargetType="{x:Type ScrollBar}">
            <Setter Property="Background" Value="#77F0F8FF"/>
            <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
            <Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
            <!--滚动条宽度-->
            <Setter Property="Width" Value="8"/>
            <Setter Property="MinWidth" Value="6"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ScrollBar}">
                        <!--滚动条背景色-->
                        <Grid x:Name="Bg" Background="#77DDDDDD" SnapsToDevicePixels="true" Width="8">
                            <Grid.RowDefinitions>
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}">
                                <Track.DecreaseRepeatButton>
                                    <RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/>
                                </Track.DecreaseRepeatButton>
                                <Track.IncreaseRepeatButton>
                                    <RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/>
                                </Track.IncreaseRepeatButton>
                                <Track.Thumb>
                                    <Thumb Style="{StaticResource ScrollBarThumb}"/>
                                </Track.Thumb>
                            </Track>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="Orientation" Value="Horizontal">
                    <Setter Property="Width" Value="Auto"/>
                    <Setter Property="MinWidth" Value="0"/>
                    <Setter Property="Height" Value="6"/>
                    <Setter Property="MinHeight" Value="6"/>
                    <Setter Property="Background" Value="#77F0F8FF"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ScrollBar}">
                                <Grid x:Name="Bg" Background="#77DDDDDD" SnapsToDevicePixels="true">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                    </Grid.ColumnDefinitions>
                                    <Track x:Name="PART_Track"  IsEnabled="{TemplateBinding IsMouseOver}">
                                        <Track.DecreaseRepeatButton>
                                            <RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
                                        </Track.DecreaseRepeatButton>
                                        <Track.IncreaseRepeatButton>
                                            <RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/>
                                        </Track.IncreaseRepeatButton>
                                        <Track.Thumb>
                                            <Thumb Style="{StaticResource ScrollBarThumb}" />
                                        </Track.Thumb>
                                    </Track>
                                </Grid>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsEnabled" Value="false">
                                        <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/>
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <TextBlock Text="操作详情" Margin="5" FontSize="14" Foreground="WhiteSmoke" HorizontalAlignment="Left"/>

            <Border Grid.Row="1" Background="#FFF9F9F9" Margin="5" CornerRadius="7">
                <TabControl Background="{x:Null}" Margin="3">
                    <TabItem Header="控制跟踪">
                        <DataGrid HorizontalGridLinesBrush="#FFA0A0A0" VerticalGridLinesBrush="#FFA0A0A0" FontSize="14" AutoGenerateColumns="False" IsReadOnly="True">
                            <DataGrid.Columns>
                                <DataGridTextColumn Header="风机编号" MinWidth="90"/>
                                <DataGridTextColumn Header="风场" MinWidth="90"/>
                                <DataGridTextColumn Header="风机型号" MinWidth="90"/>
                                <DataGridTextColumn Header="控制类型" MinWidth="90"/>
                                <DataGridTextColumn Header="风速" MinWidth="100"/>
                                <DataGridTextColumn Header="功率" MinWidth="100"/>
                                <DataGridTextColumn Header="发电机转速" MinWidth="100"/>
                                <DataGridTextColumn Header="叶片1角度" MinWidth="100"/>
                                <DataGridTextColumn Header="叶片2角度" MinWidth="100"/>
                                <DataGridTextColumn Header="叶片3角度" MinWidth="100"/>
                                <DataGridTextColumn Header="控制时间" MinWidth="100"/>
                                <DataGridTextColumn Header="进度" MinWidth="100"/>
                            </DataGrid.Columns>
                        </DataGrid>
                    </TabItem>
                    <TabItem Header="操作日志" Loaded="TabItem_Loaded">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <StackPanel Orientation="Horizontal" Margin="0,5">
                                <TextBlock Text="风场：" VerticalAlignment="Center"/>
                                <ComboBox x:Name="_CBStation" MinWidth="100" DisplayMemberPath="Name" VerticalAlignment="Center" SelectionChanged="_CBStation_SelectionChanged"/>
                                <!--<TextBlock Text="操作人：" VerticalAlignment="Center"/>
                                <ComboBox MinWidth="100" VerticalAlignment="Center"/>
                                <TextBlock Text="操作类型：" VerticalAlignment="Center"/>
                                <ComboBox MinWidth="100" VerticalAlignment="Center"/>-->
                                <TextBlock Text="开始时间：" VerticalAlignment="Center" Margin="10,0,0,0"/>
                                <TextBox x:Name="_TBStart" MinWidth="120" VerticalAlignment="Center" Padding="3" LostFocus="TextBox_LostFocus"/>
                                <TextBlock Text="结束时间：" VerticalAlignment="Center" Margin="10,0,0,0"/>
                                <TextBox x:Name="_TBEnd" MinWidth="120" VerticalAlignment="Center" Padding="3" LostFocus="TextBox_LostFocus"/>

                                <Button Content="查 询" Padding="17,3" Click="Button_Click" Tag="search" Margin="5"/>
                            </StackPanel>
                            <DataGrid Grid.Row="1" x:Name="_DGControlLog" HorizontalGridLinesBrush="#FFA0A0A0" VerticalGridLinesBrush="#FFA0A0A0" FontSize="14" AutoGenerateColumns="False" IsReadOnly="True"  Margin="0,0,0,5" Grid.RowSpan="2">
                                <DataGrid.Columns>
                                    <DataGridTextColumn Header="操作时间" MinWidth="150" Binding="{Binding TimeString}"/>
                                    <DataGridTextColumn Header="风机编号" MinWidth="150" Binding="{Binding WindturbineId}"/>
                                    <DataGridTextColumn Header="场站" MinWidth="150" Binding="{Binding StationName}"/>
                                    <DataGridTextColumn Header="操作类型" MinWidth="150" Binding="{Binding ControlTypeString}"/>
                                    <DataGridTextColumn Header="操作人" MinWidth="150" Binding="{Binding UserName}"/>
                                    <DataGridTextColumn Header="是否成功" MinWidth="150" Binding="{Binding IsSuccess}"/>
                                </DataGrid.Columns>
                            </DataGrid>
                        </Grid>
                    </TabItem>
                    <TabItem Header="风机控制日志">
                        <TextBox Background="DimGray" x:Name="_TBLog" FontSize="14" Foreground="#FF50B55F" BorderBrush="{x:Null}" AcceptsTab="True" AcceptsReturn="True" VerticalScrollBarVisibility="Auto"/>
                    </TabItem>
                </TabControl>
            </Border>


            <Button Grid.ColumnSpan="2" Height="25" Width="51.8" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="3,0" BorderBrush="{x:Null}" Foreground="{x:Null}" Padding="0,0,0,0" BorderThickness="0,0,0,0" Background="{x:Null}" Click="Button_Click" Tag="close" WindowChrome.IsHitTestVisibleInChrome="True">
                <Image Source="pack://application:,,,/智动启停;component/Images/PV/close.png"/>
            </Button>
        </Grid>
    </Grid>
</Window>
