<UserControl
    x:Class="MECF.Framework.UI.Client.CenterViews.DataLogs.DataHistory.DataView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:converter="clr-namespace:MECF.Framework.UI.Client.Ctrlib.Converter"
    xmlns:cv="clr-namespace:MECF.Framework.UI.Core.Converters;assembly=MECF.Framework.UI.Core"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:forms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:micro="clr-namespace:Caliburn.Micro"
    xmlns:system="clr-namespace:System;assembly=mscorlib"
    xmlns:userControls="clr-namespace:MECF.Framework.UI.Client.CenterViews.Core.UserControls"
    xmlns:userControls1="clr-namespace:Sicentury.Core.UserControls;assembly=Sicentury.Core"
    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
    xmlns:lex="http://wpflocalizeextension.codeplex.com"
    d:DesignHeight="450"
    d:DesignWidth="1500"
    mc:Ignorable="d"
    lex:LocalizeDictionary.DesignCulture="en"
    lex:ResxLocalizationProvider.DefaultAssembly="Sicentury.Localization"
    lex:ResxLocalizationProvider.DefaultDictionary="lang_common">
    <UserControl.Resources>

        <cv:BoolVisibilityConverter x:Key="BoolVisibilityConverter" />
        <cv:BoolReverseConverter x:Key="BoolReverseConverter" />
        <system:Boolean x:Key="True">True</system:Boolean>
        <system:Boolean x:Key="False">False</system:Boolean>

    </UserControl.Resources>
    <Grid IsEnabled="{Binding IsPermission}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="400" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="200" />
        </Grid.RowDefinitions>

        <Grid Grid.RowSpan="2" Grid.Column="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="80" />
                <RowDefinition Height="0" />
                <RowDefinition Height="1" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <Border
                Grid.Row="0"
                Padding="5,1"
                Background="{StaticResource Table_BG_Content}"
                BorderBrush="{StaticResource Table_BD}"
                BorderThickness="1,0,1,1"
                IsEnabled="{Binding IsBusy, Converter={StaticResource BoolReverseConverter}}">
                <StackPanel Orientation="Horizontal">
                    <StackPanel Width="260" Margin="0,15">
                        <StackPanel.Resources>
                            <Style TargetType="xctk:DateTimeUpDown">
                                <Setter Property="Width" Value="180" />
                                <Setter Property="Format" Value="Custom" />
                                <Setter Property="FormatString" Value="yyyy/MM/dd HH:mm:ss" />
                            </Style>
                        </StackPanel.Resources>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock
                                Width="70"
                                VerticalAlignment="Center"
                                FontFamily="Arial"
                                FontSize="14"
                                Foreground="{StaticResource FG_Black}"
                                Text="{lex:Loc ID_TXT_StartTime}" />
                            <WindowsFormsHost
                                Width="170"
                                Height="22"
                                Margin="5,0,0,0"
                                VerticalAlignment="Center"
                                FontFamily="Arial"
                                FontSize="14">
                                <forms:DateTimePicker
                                    x:Name="wfTimeFrom"
                                    CustomFormat="yyyy/MM/dd HH:mm:ss"
                                    Format="Custom"
                                    Value="2011-8-1" />
                            </WindowsFormsHost>
                        </StackPanel>
                        <StackPanel Margin="0,5,0,0" Orientation="Horizontal">
                            <TextBlock
                                Width="70"
                                VerticalAlignment="Center"
                                FontFamily="Arial"
                                FontSize="14"
                                Foreground="{StaticResource FG_Black}"
                                Text="{lex:Loc ID_TXT_EndTime}" />
                            <WindowsFormsHost
                                Width="170"
                                Height="22"
                                Margin="5,0,0,0"
                                VerticalAlignment="Center"
                                FontFamily="Arial"
                                FontSize="14">
                                <forms:DateTimePicker
                                    x:Name="wfTimeTo"
                                    CustomFormat="yyyy/MM/dd HH:mm:ss"
                                    Format="Custom"
                                    Value="2011-8-1" />
                            </WindowsFormsHost>
                        </StackPanel>
                    </StackPanel>

                    <StackPanel>
                        <Button
                            Width="100"
                            Height="30"
                            Margin="0,5,5,0"
                            HorizontalAlignment="Right"
                            Content="{lex:Loc ID_BTN_Query_Content}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <micro:ActionMessage MethodName="Query">
                                        <micro:ActionMessage.Parameters>
                                            <micro:Parameter Value="{StaticResource False}" />
                                        </micro:ActionMessage.Parameters>
                                    </micro:ActionMessage>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </Button>

                        <Button
                            Width="100"
                            Height="30"
                            Margin="0,5,5,0"
                            HorizontalAlignment="Right"
                            Content="{lex:Loc ID_BTN_Append_Content}"
                            ToolTip="Append selected items to current chart">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <micro:ActionMessage MethodName="Query">
                                        <micro:ActionMessage.Parameters>
                                            <micro:Parameter Value="{StaticResource True}" />
                                        </micro:ActionMessage.Parameters>
                                    </micro:ActionMessage>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </Button>

                    </StackPanel>
                </StackPanel>

            </Border>

            <Border
                Grid.Row="3"
                Padding="5"
                Background="{StaticResource Tab_BG}"
                BorderBrush="{StaticResource Tab_BD}"
                BorderThickness="1"
                IsEnabled="{Binding IsBusy, Converter={StaticResource BoolReverseConverter}}"
                SnapsToDevicePixels="True">
                <userControls1:ParameterNodeTreeViewControl
                    x:Name="tvParameterNodes"
                    PresetGroupsFolderName="DataHistory"
                    TreeRoot="{Binding ParameterNodes}" />
            </Border>
        </Grid>

        <GridSplitter
            Grid.Row="0"
            Grid.RowSpan="2"
            Grid.Column="1"
            Width="5"
            Margin="0,0,2,0"
            HorizontalAlignment="Left"
            VerticalAlignment="Stretch"
            Background="LightBlue"
            IsEnabled="{Binding IsBusy, Converter={StaticResource BoolReverseConverter}}" />

        <userControls:DataViewDataGrid
    x:Name="dataGrid"
    Grid.Row="1"
    Grid.Column="2"
    Margin="0,5,0,0"
    IsEnabled="{Binding IsBusy, Converter={StaticResource BoolReverseConverter}}"
    IsShowStatisticColumn="True"
    ItemsSource="{Binding Path=SelectedData}">
            <i:Interaction.Behaviors>
                <userControls:PhotoShotBehavior Target2="{Binding ElementName=chart}"/>
            </i:Interaction.Behaviors>
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Deleted">
                    <micro:ActionMessage MethodName="Deleted">
                        <micro:Parameter Value="$source" />
                        <micro:Parameter Value="$eventargs" />
                    </micro:ActionMessage>
                </i:EventTrigger>
                <i:EventTrigger EventName="Exporting">
                    <micro:ActionMessage MethodName="Exporting">
                        <micro:Parameter Value="$source" />
                        <micro:Parameter Value="$eventargs" />
                    </micro:ActionMessage>
                </i:EventTrigger>
                <i:EventTrigger EventName="Exported">
                    <micro:ActionMessage MethodName="Exported">
                        <micro:Parameter Value="$source" />
                        <micro:Parameter Value="$eventargs" />
                    </micro:ActionMessage>
                </i:EventTrigger>
                <i:EventTrigger EventName="ProgressMessageUpdating">
                    <micro:ActionMessage MethodName="ProgressUpdating">
                        <micro:Parameter Value="$source" />
                        <micro:Parameter Value="$eventargs" />
                    </micro:ActionMessage>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </userControls:DataViewDataGrid>

        <!--  data chart  -->
        <Grid
            Grid.Row="0"
            Grid.Column="2"
            Margin="5,0,0,0">

            <userControls:DataViewChart
                x:Name="chart"
                AutoRange="{Binding ChartAutoRange}"
                IsEnabled="{Binding IsBusy, Converter={StaticResource BoolReverseConverter}}"
                RenderableSeries="{Binding SelectedData}"
                VisibleRangeTime="{Binding VisibleRangeTime}"
                VisibleRangeValue="{Binding VisibleRangeValue}"/>

            <userControls1:BusyIndicator
                Width="Auto"
                Height="Auto"
                Padding="20,10"
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                Background="{StaticResource Tab_BG}"
                BorderBrush="Gray"
                BorderThickness="3"
                Message="{Binding BusyIndicatorContent}"
                Visibility="{Binding IsBusy, Converter={StaticResource BoolVisibilityConverter}}">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="Canceled">
                        <micro:ActionMessage MethodName="CancelQuery" />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </userControls1:BusyIndicator>
        </Grid>

        <GridSplitter
            Grid.Row="1"
            Grid.Column="2"
            Height="5"
            Margin="0,0,2,0"
            HorizontalAlignment="Stretch"
            VerticalAlignment="Top"
            Background="LightBlue"
            IsEnabled="{Binding IsBusy, Converter={StaticResource BoolReverseConverter}}" />



    </Grid>
</UserControl>