<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:vm="clr-namespace:HBLConsole.ViewModel"
    d:DesignHeight="450"
    d:DesignWidth="800"
    mc:Ignorable="d">

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

    <UserControl.Resources>

        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Resources/ResourceDictionarys/BasicStyle.xaml">
                    <!--#region 按钮样式-->
                    <Style x:Key="ButtonStyle" TargetType="Button">
                        <Setter Property="Foreground" Value="#00c2f4" />
                        <Setter Property="FontSize" Value="18" />
                        <Setter Property="Width" Value="100" />
                        <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="3,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-->
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>



    </UserControl.Resources>

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

        <StackPanel Orientation="Horizontal">
            <Button
                Command="{Binding SimOrderCommand}"
                Content="模拟订单"
                Style="{StaticResource ButtonStyle}" />

            <TextBlock
                Margin="10,0,0,0"
                VerticalAlignment="Center"
                FontSize="16"
                Foreground="#00c2f4"
                Text="取碗队列数量：" />

            <TextBlock
                VerticalAlignment="Center"
                FontSize="16"
                Foreground="#00c2f4"
                Text="{Binding BowlCount}" />

            <TextBlock
                Margin="10,0,0,0"
                VerticalAlignment="Center"
                FontSize="16"
                Foreground="#00c2f4"
                Text="取面队列数量：" />

            <TextBlock
                Margin="0,0,10,0"
                VerticalAlignment="Center"
                FontSize="16"
                Foreground="#00c2f4"
                Text="{Binding NoodleCount}" />


        </StackPanel>

        <StackPanel Grid.Row="2" Orientation="Horizontal">
            <Button
                Margin="0,0,10,0"
                Command="{Binding InitCommand}"
                Content="初始化"
                Style="{StaticResource ButtonStyle}" />

            <Button
                Command="{Binding InitCommand}"
                Content="停止"
                Style="{StaticResource ButtonStyle}" />
        </StackPanel>

        <ScrollViewer
            Grid.Row="3"
            HorizontalScrollBarVisibility="Visible"
            Style="{StaticResource ScrollViewerStyle}"
            VerticalScrollBarVisibility="Visible">
            <ItemsControl ItemsSource="{Binding processConditions}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Margin="0 5" VerticalAlignment="Center" Orientation="Horizontal">
                            <TextBlock
                                VerticalAlignment="Center"
                                Foreground="#ddd"
                                Text="{Binding ProcessTitl}" />

                            <ListBox
                                Background="Transparent"
                                BorderThickness="0"
                                ItemsSource="{Binding Conditions}">
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <VirtualizingStackPanel Orientation="Horizontal" />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <ToggleButton
                                            Content="{Binding ConditionName}"
                                            IsChecked="{Binding ConditionMet}"
                                            Style="{StaticResource ToggleButStyle}" />
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>

                        </StackPanel>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </ScrollViewer>



    </Grid>



</UserControl>
