<UserControl x:Class="StartServerWPF.Modules.MseedChart.Views.ChartPlotView"
             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:converter="clr-namespace:StartServerWPF.Modules.MseedChart.Converters"
             mc:Ignorable="d"  Background="#FFEEF1F3"
             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"       
             d:DesignHeight="450" d:DesignWidth="800"
             xmlns:prism="http://prismlibrary.com/"
             prism:ViewModelLocator.AutoWireViewModel="True">
    <UserControl.Resources>
        <converter:Bool2VisibilityConverter x:Key="Bool2Visibility"/>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="60"/>
            <RowDefinition Height="50"/>
            <RowDefinition Height="1000*"/>
        </Grid.RowDefinitions>
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="Loaded">
                <i:InvokeCommandAction Command="{Binding Path=LoadedCommand}"/>
            </i:EventTrigger>
            <i:EventTrigger EventName="Unloaded">
                <i:InvokeCommandAction Command="{Binding Path=UnloadedCommand}"/>
            </i:EventTrigger>
        </i:Interaction.Triggers>
        <Border Background="White">
            <TextBlock Text="{Binding Title}" FontSize="16" FontWeight="Bold" VerticalAlignment="Center"  Margin="10,0,10,0"/>
        </Border>
        <Border Background="White" Grid.Row="1" Grid.RowSpan="2" CornerRadius="5" Margin="10">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="1000*"/>
                </Grid.RowDefinitions>
                <!--波形回放-->
                <StackPanel  Orientation="Horizontal" >
                    <Button  Grid.Column="1" Grid.Row="1" Command="{Binding FileSelectorCommand}" CommandParameter="false" Background="#FF3BB4FF" >选择文件</Button>
                    <Button  Grid.Column="1" Grid.Row="1" Command="{Binding FileSelectorCommand}" CommandParameter="true" Background="#FFFFAF20" Margin="20,0,20,0">选择目录</Button>
                    <CheckBox Content="通道选择" x:Name="cBoxAll" IsChecked="{Binding SingleChannel}" VerticalAlignment="Center"/>
                    <ComboBox IsEnabled="{Binding ElementName=cBoxAll, Path=IsChecked}" Text="{Binding SelectChannel}" SelectedIndex="0"  VerticalAlignment="Center">
                        <ComboBoxItem Content="SHZ"/>
                        <ComboBoxItem Content="SHN"/>
                        <ComboBoxItem Content="SHE"/>
                    </ComboBox>
                    <TextBlock VerticalAlignment="Center" Margin="20,0,0,0">时间间隔:</TextBlock>
                    <TextBox Text="{Binding XaisInterval}" Width="60" VerticalAlignment="Center"/>
                    <Button  Command="{Binding IntervalSureCommand}" Background="#FF66B1FF" HorizontalAlignment="Right">确认</Button>
                    <CheckBox Command="{Binding AxesYVisibleCommand}" Visibility="Collapsed" CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self},Path=IsChecked}"  Content="Y轴显示" VerticalContentAlignment="Center" IsChecked="True" FontSize="15" Foreground="Black" Margin="5,0,5,0" FontWeight="Bold" />
                    <ComboBox ItemsSource="{Binding StationsName}" SelectedIndex="{Binding SelectStationYaxisIndex}" Visibility="Collapsed">
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <CheckBox IsChecked="{Binding IsChecked}" Command="{Binding SelectCommand}"  CommandParameter="{Binding }" />
                                    <TextBlock Text="{Binding Name}" />
                                </StackPanel>
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>
                    <CheckBox Command="{Binding OtimeSortCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self},Path=IsChecked}"  Content="排序" VerticalContentAlignment="Center" FontSize="15" Foreground="Black" Margin="20,0,0,0" FontWeight="Bold"></CheckBox>
                    <CheckBox Command="{Binding RealTimeDataCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self},Path=IsChecked}" Visibility="Collapsed" Content="实时" VerticalContentAlignment="Center" FontSize="15" Foreground="Black"  FontWeight="Bold" DockPanel.Dock="Right"></CheckBox>
                    <TextBox Text="{Binding IntervalTime}" Visibility="Collapsed" Width="60" VerticalAlignment="Center"></TextBox>
                </StackPanel>
                <!--实时波形-->
                <StackPanel Orientation="Horizontal" Visibility="{Binding IsRealtimeData,Converter={StaticResource Bool2Visibility}}" Background="White">
                    <Button  Grid.Column="1" Grid.Row="1" Command="{Binding RealTimeDataCommand}" CommandParameter="true" Background="#FF3BB4FF" >开始接收</Button>
                    <Button  Grid.Column="1" Grid.Row="1" Command="{Binding RealTimeDataCommand}" CommandParameter="false" Background="#FFFFAF20" Margin="20,0,20,0">停止接收</Button>
                    <CheckBox Content="通道选择" x:Name="cBoxAllChannel" IsChecked="{Binding SingleChannel}" VerticalAlignment="Center"/>
                    <ComboBox IsEnabled="{Binding ElementName=cBoxAllChannel, Path=IsChecked}" Text="{Binding SelectChannel}" SelectedIndex="0"  VerticalAlignment="Center">
                        <ComboBoxItem Content="SHZ"/>
                        <ComboBoxItem Content="SHN"/>
                        <ComboBoxItem Content="SHE"/>
                    </ComboBox>
                    <TextBlock VerticalAlignment="Center" Margin="20,0,0,0">时间间隔:</TextBlock>
                    <TextBox Text="{Binding XaisInterval}" Width="60" VerticalAlignment="Center"/>
                    <Button  Command="{Binding IntervalSureCommand}" Background="#FF66B1FF" HorizontalAlignment="Right">确认</Button>
                    <CheckBox Command="{Binding AxesYVisibleCommand}" Visibility="Collapsed" CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self},Path=IsChecked}"  Content="Y轴显示" VerticalContentAlignment="Center" IsChecked="True" FontSize="15" Foreground="Black" Margin="5,0,5,0" FontWeight="Bold" />
                    <TextBox Text="{Binding IntervalTime}" Visibility="Collapsed" Width="60" VerticalAlignment="Center"></TextBox>
                    <!--<TextBox Text="{Binding IntervalTime}" Width="60" VerticalAlignment="Center"></TextBox>-->
                </StackPanel>
                <ContentControl x:Name="contentControl" Content="{Binding ChildContent}" Grid.Row="1"/>
                <TextBlock Text="{Binding CurrentTime}" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="0,0,0,46"></TextBlock>
            </Grid>
        </Border>
    </Grid>
</UserControl>
