<UserControl
    x:Class="HBLConsole.View.DebugView"
    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:local="clr-namespace:HBLConsole.View"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:pry="clr-namespace:HBLConsole.PryUserControl;assembly=HBLConsole.PryUserControl"
    xmlns:vm="clr-namespace:HBLConsole.ViewModel"
    d:DesignHeight="450"
    d:DesignWidth="1000"
    mc:Ignorable="d">

    <UserControl.DataContext>
        <vm:DebugViewModel />
    </UserControl.DataContext>

    <UserControl.Resources>

        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Resources/ResourceDictionarys/BasicStyle.xaml">

                    <Style x:Key="TextBoxStyle" TargetType="TextBox">
                        <Setter Property="FontFamily" Value="楷体" />
                        <Setter Property="FontSize" Value="22" />
                        <Setter Property="Background" Value="Transparent" />
                        <Setter Property="Foreground" Value="#9934F7F7" />
                        <Setter Property="BorderBrush" Value="#00c2f4" />
                        <Setter Property="CaretBrush" Value="Aqua" />
                        <Setter Property="VerticalAlignment" Value="Center" />
                    </Style>

                    <!--#region 按钮样式-->
                    <Style x:Key="ButtonStyle" TargetType="Button">
                        <Setter Property="Foreground" Value="#00c2f4" />
                        <Setter Property="FontSize" Value="18" />
                        <Setter Property="Margin" Value="10 0"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="Button">
                                    <Border
                                        Name="TitleBarBr"
                                        Background="Transparent"
                                        BorderBrush="#00c2f4"
                                        BorderThickness="2"
                                        CornerRadius="10">
                                        <ContentPresenter
                                            Margin="{TemplateBinding Margin}"
                                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                    </Border>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsMouseOver" Value="true">
                                            <Setter TargetName="TitleBarBr" Property="Background" Value="#3300c2f4" />
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                    <!--#endregion-->

                    <!--#region 开关按钮样式-->
                    <Style x:Key="ToggleButStyle" TargetType="{x:Type ToggleButton}">
                        <Setter Property="IsChecked" Value="False" />
                        <Setter Property="FontFamily" Value="楷体" />
                        <Setter Property="Foreground" Value="#ddd" />
                        <Setter Property="IsEnabled" Value="False" />
                        <Setter Property="FontSize" Value="18" />
                        <Setter Property="Margin" Value="0,0,10,0" />
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ToggleButton}">
                                    <!--<Grid x:Name="gr" SnapsToDevicePixels="True">-->
                                    <Border
                                        Name="br"
                                        Background="#FF1E9614"
                                        CornerRadius="5">
                                        <ContentPresenter
                                            x:Name="contentPresenter"
                                            Margin="4,2"
                                            HorizontalAlignment="Center"
                                            VerticalAlignment="Center"
                                            Content="{TemplateBinding Content}"
                                            ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                            ContentTemplate="{TemplateBinding ContentTemplate}"
                                            Focusable="False"
                                            RecognizesAccessKey="True"
                                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                    </Border>

                                    <!--</Grid>-->
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsChecked" Value="True">
                                            <Setter TargetName="br" Property="Background" Value="#FF1E9614" />
                                        </Trigger>

                                        <Trigger Property="IsChecked" Value="False">
                                            <Setter TargetName="br" Property="Background" Value="#FFF11A38" />
                                        </Trigger>

                                        <Trigger Property="IsMouseOver" Value="True">
                                            <!--<Setter TargetName="tb" Property="Foreground" Value="#2695FF" />-->
                                        </Trigger>

                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>

                    <!--#endregion-->

                    <!--#region ListBox样式-->
                    <Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
                        <Setter Property="OverridesDefaultStyle" Value="True" />
                        <Setter Property="SnapsToDevicePixels" Value="True" />
                        <Setter Property="BorderBrush" Value="{x:Null}" />
                        <Setter Property="Foreground" Value="White" />
                        <Setter Property="FontSize" Value="20" />
                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                        <Setter Property="VerticalContentAlignment" Value="Center" />
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                    <Border x:Name="border" CornerRadius="8">
                                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                    </Border>
                                    <!--<ControlTemplate.Triggers>
                                        <Trigger Property="IsSelected" Value="True">
                                            <Setter TargetName="border" Property="Background">
                                                <Setter.Value>
                                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                                        <GradientStop Offset="0.5" Color="#FF6B6B6B" />
                                                        <GradientStop Offset="0.5" Color="#FF535353" />
                                                        <GradientStop Offset="0.022" Color="#FF535353" />
                                                        <GradientStop Offset="0.991" Color="#FF555555" />
                                                    </LinearGradientBrush>
                                                </Setter.Value>
                                            </Setter>
                                        </Trigger>
                                    </ControlTemplate.Triggers>-->
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                    <!--#endregion-->
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="400" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <Grid Grid.Column="0">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="40" />
            </Grid.RowDefinitions>
            <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
                <ItemsControl ItemsSource="{Binding simOrderConfig}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Grid Margin="0 10">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition />
                                    <ColumnDefinition />
                                    <ColumnDefinition Width="150"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock
                                    HorizontalAlignment="Right"
                                    VerticalAlignment="Center"
                                    FontSize="16"
                                    Foreground="#00c2f4"
                                    Text="{Binding Text}" />

                                <TextBox
                                    Grid.Column="1"
                                    Margin="10 0"
                                    IsEnabled="{Binding IsEnable}"
                                    Style="{StaticResource TextBoxStyle}"
                                    Text="{Binding Loc}" />

                                <CheckBox
                                    Grid.Column="2"
                                    Height="20"
                                    VerticalAlignment="Center"
                                    Background="#FF2AB2E7"
                                    Content="启用随机数"
                                    FontSize="16"
                                    Foreground="#00c2f4"
                                    IsChecked="{Binding IsSelected}"
                                    Template="{StaticResource CbTemplate}" />
                            </Grid>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>

            <UniformGrid Columns="2" Grid.Row="1">
                <Button
                    Grid.Column="1"
                    
                    Command="{Binding bql}"
                    Content="模拟订单"
                    Style="{StaticResource ButtonStyle}" />
                <Button
                    Command="{Binding AddSimDataCommand}"
                    Content="新增模拟数据"
                    Style="{StaticResource ButtonStyle}" />
            </UniformGrid>

        </Grid>




        <Grid Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="40" />
                <RowDefinition Height="10" />
                <RowDefinition Height="40" />
                <RowDefinition Height="40" />
                <RowDefinition />
            </Grid.RowDefinitions>

            <StackPanel Orientation="Horizontal">



                <!--#region 控制按钮-->


                <Button
                    x:Name="button_loop"
                    Margin="0,0,10,0"
                    Command="{Binding LoopSimOrderCommand}"
                    CommandParameter="{Binding ElementName=button_loop, Path=Content}"
                    Content="{Binding LoopButton, Mode=TwoWay, NotifyOnTargetUpdated=True}"
                    Foreground="{Binding LoopColor, Mode=TwoWay, NotifyOnTargetUpdated=True}"
                    Style="{StaticResource ButtonStyle}" />
                <Button
                    Margin="0,0,10,0"
                    Command="{Binding InitCommand}"
                    Content="初始化"
                    Style="{StaticResource ButtonStyle}" />

                <Button
                    Command="{Binding InitCommand}"
                    Content="停止"
                    Style="{StaticResource ButtonStyle}" />
                <!--#endregion-->

            </StackPanel>



            <StackPanel Grid.Row="3" Orientation="Horizontal">
                <Button
                    Width="200"
                    Margin="10,0,10,0"
                    Command="{Binding bql}"
                    Content="冰淇淋模拟"
                    Style="{StaticResource ButtonStyle}" />

                <Button
                    Width="200"
                    Margin="10,0,10,0"
                    Command="{Binding cfj}"
                    Content="咖啡机模拟"
                    Style="{StaticResource ButtonStyle}" />
            </StackPanel>

        </Grid>




    </Grid>



</UserControl>
