<Window x:Class="ThermalCamera.window.TemperQueryWnd"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:wnd="clr-namespace:ThermalCamera.ViewModel"
        xmlns:ctrl="clr-namespace:NetSDKControl.Control;assembly=NetSDKControl"
        xmlns:tri="http://schemas.microsoft.com/expression/2010/interactivity"
        Title="TemperQueryWnd(热成像温度查询)" Height="450" Width="800"
        WindowStartupLocation="CenterOwner" ResizeMode="NoResize" ShowInTaskbar="False">
    <tri:Interaction.Triggers>
        <tri:EventTrigger EventName="Closed">
            <tri:InvokeCommandAction Command="{Binding ClosedCmd}"/>
        </tri:EventTrigger>
    </tri:Interaction.Triggers>
    <Window.DataContext>
        <wnd:TemperQueryViewModel/>
    </Window.DataContext>
    <Window.Resources>
        <Style x:Key="ListViewItemStyle" TargetType="{x:Type ListViewItem}">
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
        </Style>
    </Window.Resources>
    <Grid>
        <StackPanel Margin="5">
            <GroupBox Header="Query Condition(查询条件)" Margin="5">
                <StackPanel>
                    <WrapPanel Margin="0,5">
                        <WrapPanel HorizontalAlignment="Left">
                            <TextBlock Text="StartTime(开始时间):" VerticalAlignment="Center"/>
                            <ctrl:DateTimePicker Value="{Binding StartTime, Mode=TwoWay}" Margin="5,0"/>
                        </WrapPanel>
                        <WrapPanel Margin="50,0,0,0">
                            <TextBlock Text="EndTime(结束时间):" VerticalAlignment="Center"/>
                            <ctrl:DateTimePicker Value="{Binding EndTime, Mode=TwoWay}" Margin="5,0"/>
                        </WrapPanel>
                    </WrapPanel>
                    
                    <WrapPanel Margin="0,5">
                        <TextBlock Text="Query Type(查询类型):" VerticalAlignment="Center"/>
                        <ComboBox Width="120" Height="25" Margin="10,0" SelectedIndex="{Binding QueryType}" ItemsSource="{Binding MeterTypeList}" SelectedItem="0"/>
                        <TextBlock Text="Channel(通道):" VerticalAlignment="Center" Margin="10,0"/>
                        <TextBox Width="50" Height="20" Margin="5,0" Text="{Binding Channel}" PreviewTextInput="TextBox_PreviewTextInput"/>
                        <Button Content="Query(查询)" Width="80" Height="25" Margin="50,0" Command="{Binding QueryCmd}" IsEnabled="{Binding QueryEn}"/>
                    </WrapPanel>
                    <WrapPanel Margin="0,5">
                        <TextBlock Text="TotalCount(总条数):" VerticalAlignment="Center"/>
                        <TextBox Width="50" IsReadOnly="True" Margin="10,0" Text="{Binding TotalCount}"/>
                    </WrapPanel>
                </StackPanel>
            </GroupBox>
            <ListView Margin="5,0" ItemsSource="{Binding QueryList}" HorizontalAlignment="Left"
                      ItemContainerStyle="{StaticResource ResourceKey=ListViewItemStyle}" SelectionMode="Single"
                      Height="260" Width="750">
                <ListView.View>
                    <GridView>
                        <GridViewColumn Header="Name(名称)" Width="70" DisplayMemberBinding="{Binding Name}"/>
                        <GridViewColumn Header="Channel(通道)" Width="85" DisplayMemberBinding="{Binding Channel}"/>
                        <GridViewColumn Header="Time(时间)" Width="130" DisplayMemberBinding="{Binding Time}"/>
                        <GridViewColumn Header="PresetId(预置点)" Width="95" DisplayMemberBinding="{Binding PresetID}"/>
                        <GridViewColumn Header="RuleId(规则编号)" Width="95" DisplayMemberBinding="{Binding RuleID}"/>
                        <GridViewColumn Header="Coordinate(坐标)" Width="100" DisplayMemberBinding="{Binding Coordinate}"/>
                        <GridViewColumn Header="Type(类型)" Width="60" DisplayMemberBinding="{Binding MeterType}"/>
                        <GridViewColumn Header="Aver(均值)" Width="60" DisplayMemberBinding="{Binding TemperAver}"/>
                        <GridViewColumn Header="Max(最高值)" Width="65" DisplayMemberBinding="{Binding TemperMax}"/>
                        <GridViewColumn Header="Min(最低值)" Width="65" DisplayMemberBinding="{Binding TemperMin}"/>
                    </GridView>
                </ListView.View>
            </ListView>
        </StackPanel>
    </Grid>
</Window>
