<UserControl x:Class="BPASmartClient.MorkTJAKAJC.View.DebugView"
             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:vm="clr-namespace:BPASmartClient.MorkTLebaiJC.ViewModel"
             mc:Ignorable="d" 
             Name="调试界面"
             d:DesignHeight="500" d:DesignWidth="1000" Unloaded="Dubug_Unloaded">
    <UserControl.DataContext>
        <vm:DebugViewModel/>
    </UserControl.DataContext>
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
                <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="10*"/>
            <ColumnDefinition Width="10*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="10*"/>
            <RowDefinition Height="10*"/>
            <RowDefinition Height="20*"/>
        </Grid.RowDefinitions>

        <GroupBox Grid.ColumnSpan="2"
            FontFamily="楷体"
            FontSize="20"
            Header=" 乐白机器人 ">
            <Grid Margin="10">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="3*"/>
                </Grid.RowDefinitions>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="连接状态" />
                    <TextBlock Text="{Binding RobotConnected}"
                           Margin="40,0"/>
                    <TextBlock Text="机器人模式："/>
                    <TextBlock Text="{Binding RobotMode}"
                               Margin="40,0"/>
                </StackPanel>
                <TextBlock Text="连接状态" />
                <TextBlock Text="{Binding RobotConnected}"
                           Margin="120,0,0,0"/>
                
                <ListBox Grid.Row="2" Background="Transparent" Margin="0,0,0,-9">
                    <ListBox.Template>
                        <ControlTemplate TargetType="{x:Type ListBox}">
                            <ScrollViewer  HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                                <WrapPanel Orientation="Horizontal" IsItemsHost="True" ScrollViewer.CanContentScroll="True"/>
                            </ScrollViewer>
                        </ControlTemplate>
                    </ListBox.Template>
                    <Button Content="机器人启动"
                            Margin="20,5" Width="80" Height="40"
                            Command="{Binding Button_RobotControlCommand}"
                            CommandParameter="机器人启动">
                    </Button>
                    <Button Content="启动示教"
                            Margin="20,5" Width="80" Height="40"
                            Command="{Binding Button_RobotControlCommand}"
                            CommandParameter="启动示教"/>
                    <Button Content="停止示教" 
                            Margin="20,5" Width="80" Height="40"
                            Command="{Binding Button_RobotControlCommand}"
                            CommandParameter="停止示教"/>
                    <Button Content="机器人急停"
                            Margin="20,5"  Width="80" Height="40"
                            Command="{Binding Button_RobotControlCommand}"
                            CommandParameter="机器人急停"/>
                    <Button Content="暂停"
                            Margin="10,5"  Width="40" Height="40"
                            Command="{Binding Button_RobotControlCommand}"
                            CommandParameter="暂停"/>
                    <Button Content="恢复"
                            Margin="10,5"  Width="40" Height="40"
                            Command="{Binding Button_RobotControlCommand}"
                            CommandParameter="恢复"/>
                </ListBox>
                <Grid Margin="629,-24,19,0" Grid.RowSpan="3">
                    <Grid.RowDefinitions>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid Grid.Row="0">
                        <TextBlock>DI</TextBlock>
                        <CheckBox Margin="50,0,0,0" IsEnabled="false" Name="Robot_DI0">DI0</CheckBox>
                        <CheckBox Margin="120,0,0,0" IsEnabled="false" Name="Robot_DI1">DI1</CheckBox>
                        <CheckBox Margin="190,0,0,0" IsEnabled="false" Name="Robot_DI2">DI2</CheckBox>
                        <CheckBox Margin="260,0,0,0" IsEnabled="false" Name="Robot_DI3">DI3</CheckBox>
                    </Grid>
                    <Grid Grid.Row="1">
                        <TextBlock Width="50">DO</TextBlock>
                        <ComboBox  Width="70" Margin="50,12,268,10" SelectedIndex="{Binding Lebai_DO_CH}">
                            <ComboBoxItem IsSelected="true">DO0</ComboBoxItem>
                            <ComboBoxItem>DO1</ComboBoxItem>
                            <ComboBoxItem>DO2</ComboBoxItem>
                            <ComboBoxItem>DO3</ComboBoxItem>
                        </ComboBox>
                        <ComboBox Margin="142,12,108,10" Width="70" SelectedIndex="{Binding Lebai_DO_Value}">
                            <ComboBoxItem IsSelected="true">true</ComboBoxItem>
                            <ComboBoxItem>false</ComboBoxItem>
                        </ComboBox>
                        <Button Width="50" Margin="260,12,10,10" Command="{Binding Button_LebaiDOuputCommand}" >输出</Button>
                    </Grid>
                </Grid>
            </Grid>
        </GroupBox>
        <GroupBox  Grid.Row="2"
            FontFamily="楷体"
            FontSize="20"
            Header=" 果汁机 ">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="3*"/>
                    <RowDefinition Height="3*"/>
                    <RowDefinition Height="3*"/>
                </Grid.RowDefinitions>
                <TextBlock Text="连接状态" />
                <TextBlock Text="{Binding JuicerConnected}"
                           Margin="120,0,0,0"/>
                <Grid Grid.Row="1">
                    <Grid.RowDefinitions>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="120"/>
                        <ColumnDefinition></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="设备状态" />
                    <Grid Grid.Column="1">
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0" Name="Heating" HorizontalAlignment="Center">制热</TextBlock>
                        <TextBlock Grid.Column="1" Name="cooling"  HorizontalAlignment="Center">制冷</TextBlock>
                        <TextBlock Grid.Column="2" Name="LackOfWater"  HorizontalAlignment="Center">缺水</TextBlock>
                        <TextBlock Grid.Column="3" Name="ChildLocks"  HorizontalAlignment="Center">童锁</TextBlock>
                        <TextBlock Grid.Column="4" Name="Use"  HorizontalAlignment="Center">使用</TextBlock>
                    </Grid>

                </Grid>


                <StackPanel Grid.Row="2" Orientation="Vertical">
                    <StackPanel Margin="0,10,0,0" Orientation="Horizontal">
                        <TextBlock>果汁</TextBlock>
                        <ComboBox Margin="100,0,0,0"
                                Width="100" >
                            <ComboBoxItem IsSelected="true">饮品1</ComboBoxItem>
                            <ComboBoxItem>饮品2</ComboBoxItem>
                            <ComboBoxItem>饮品3</ComboBoxItem>
                            <ComboBoxItem>饮品4</ComboBoxItem>
                        </ComboBox>
                        <ComboBox Margin="20,0,0,0" Width="100">
                            <ComboBoxItem IsSelected="true">冷饮</ComboBoxItem>
                            <ComboBoxItem>热饮</ComboBoxItem>
                        </ComboBox>
                        <Button Command="{Binding Button_MakeIceCreamCommand}"
                                Margin="20,0"
                                Content="制作" />
                    </StackPanel>
                    <StackPanel Margin="0,10,0,0" Orientation="Horizontal">

                    </StackPanel>
                </StackPanel>
            </Grid>
        </GroupBox>
        <GroupBox  Grid.Row="2" Grid.Column="1"
            FontFamily="楷体"
            FontSize="20"
            Header=" 咖啡机">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="30"/>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock Text="连接状态" />
                <TextBlock Text="{Binding CoffeeConnected}"
                           Margin="120,0,0,0"/>
                <Grid Grid.Row="1">
                    <Grid.Resources>
                        <Style TargetType="TextBlock">
                            <Setter Property="HorizontalAlignment" Value="Left" />
                            <Setter Property="VerticalAlignment" Value="Center" />
                        </Style>
                    </Grid.Resources>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="99" />
                        <ColumnDefinition Width="140" />
                        <ColumnDefinition Width="100" />
                        <ColumnDefinition Width="171" />
                    </Grid.ColumnDefinitions>
                    <TextBlock Height="23" Width="100" FontSize="18" HorizontalAlignment="Center">咖啡机状态</TextBlock>
                    <TextBlock FontSize="18" 
                            Grid.Column="1"
                            Text="{Binding CoffeeStatus}" Height="23" />
                    <TextBlock Grid.Column="2" Height="23" Width="80" FontSize="18">应用状态</TextBlock>
                    <TextBlock FontSize="18"
                            Grid.Column="3" 
                            Text="{Binding AppStatus}" Height="23"/>
                    <TextBlock Grid.Row="1" Grid.Column="0" Height="22" Width="80" FontSize="18">告警信息</TextBlock>
                    <TextBlock FontSize="15"
                            Grid.Row="1"
                            Grid.Column="1"
                            Text="{Binding Warning}"  />
                    <TextBlock Grid.Row="1" Grid.Column="2" Height="22" Width="80" FontSize="18">故障信息</TextBlock>
                    <TextBlock FontSize="18"
                            Grid.Row="1"
                            Grid.Column="3"
                            Text="{Binding CaffeeFault}" Height="22" Width="60" />
                </Grid>
                <StackPanel Grid.Row="2" Orientation="Vertical">
                    <StackPanel Margin="0,10,0,0" Orientation="Horizontal">
                        <TextBlock>饮品</TextBlock>
                        <ComboBox Margin="10,0"
                                Width="100"
                                ItemsSource="{Binding Coffees}"
                                SelectedItem="{Binding SelectedCoffee}" />
                        <Button Margin="10,0"
                            Command="{}"
                                Content="制作"/>
                        <Button Margin="10,0"
                            Command="{}"
                                Content="停止制作"/>
                    </StackPanel>
                    <StackPanel Margin="0,10,0,0" Orientation="Horizontal">
                        <TextBlock>模式</TextBlock>
                        <ComboBox Margin="10,0"
                                Width="100"
                                ItemsSource="{Binding CoffeeCmds}"
                                SelectedItem="{Binding SelectedCoffeeCmd}"/>
                        <Button Margin="10,0"
                                Command="{}"
                                Content="设置" Cursor="Hand"/>
                    </StackPanel>
                </StackPanel>
            </Grid>
        </GroupBox>
        <GroupBox Header="单片机控制"
                   FontSize="18"
                  Grid.Row="1" Grid.ColumnSpan="2"
                  Margin="0,0,0,10">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition></RowDefinition>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="5*"/>
                    <ColumnDefinition Width="5*"/>
                    <ColumnDefinition Width="13*"/>
                    <ColumnDefinition Width="7*"/>
                </Grid.ColumnDefinitions>
                <Grid Grid.Column="0" >
                    <TextBlock FontSize="12">连接状态</TextBlock>
                    <TextBlock Text="{Binding MCUConnected}"
                           Margin="70,0,0,0"/>
                    <TextBlock FontSize="12"></TextBlock>
                </Grid>
                <Grid Grid.Column="1" >
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Grid Grid.Row="0" Grid.Column="0" >
                            <TextBlock  FontSize="12"  HorizontalAlignment="Center">舵机控制</TextBlock>

                        </Grid>
                        <Grid Grid.Row="0" Grid.Column="1">
                            <ComboBox Margin="0,0,0,0" FontSize="12" Width="60" SelectedIndex="{Binding MCU_PWM_CH}">
                                <ComboBoxItem IsSelected="true">舵机1</ComboBoxItem>
                                <ComboBoxItem>舵机2</ComboBoxItem>
                                <ComboBoxItem>舵机3</ComboBoxItem>
                                <ComboBoxItem>舵机4</ComboBoxItem>
                            </ComboBox>
                        </Grid>
                        <Grid Grid.Row="1" Grid.Column="0">
                            <Button FontSize="15"  HorizontalAlignment="Center"  Command="{Binding Button_MCUOuputCommand}">输出</Button>
                        </Grid>
                        <Grid Grid.Row="1" Grid.Column="1" Width="60" >
                            <TextBox  Text="{Binding PWMInputNumber}"></TextBox>
                        </Grid>
                    </Grid>
                </Grid>
                <Grid Grid.Column="2" >
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Grid Grid.Row="0" Grid.Column="0" >
                            <TextBlock  FontSize="12"  HorizontalAlignment="Center">DI输入</TextBlock>
                        </Grid>
                        <Grid Grid.Row="1" Grid.Column="0" Width="400">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition></ColumnDefinition>
                                    <ColumnDefinition></ColumnDefinition>
                                    <ColumnDefinition></ColumnDefinition>
                                    <ColumnDefinition></ColumnDefinition>
                                    <ColumnDefinition></ColumnDefinition>
                                    <ColumnDefinition></ColumnDefinition>
                                    <ColumnDefinition></ColumnDefinition>
                                    <ColumnDefinition></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <Grid Grid.Column="0">
                                    <CheckBox FontSize="12" IsEnabled="false" IsChecked="{Binding CH0}">DI0</CheckBox>
                                </Grid>
                                <Grid Grid.Column="1">
                                    <CheckBox FontSize="12" IsEnabled="false" Name="CH1">DI1</CheckBox>
                                </Grid>
                                <Grid Grid.Column="2">
                                    <CheckBox FontSize="12" IsEnabled="false" Name="CH2">DI2</CheckBox>
                                </Grid>
                                <Grid Grid.Column="3">
                                    <CheckBox FontSize="12" IsEnabled="false" Name="CH3">DI3</CheckBox>
                                </Grid>
                                <Grid Grid.Column="4">
                                    <CheckBox FontSize="12" IsEnabled="false" Name="CH4">DI4</CheckBox>
                                </Grid>
                                <Grid Grid.Column="5">
                                    <CheckBox FontSize="12" IsEnabled="false" Name="CH5">DI5</CheckBox>
                                </Grid>
                                <Grid Grid.Column="6">
                                    <CheckBox FontSize="12" IsEnabled="false" Name="CH6">DI6</CheckBox>
                                </Grid>
                                <Grid Grid.Column="7">
                                    <CheckBox FontSize="12" IsEnabled="false" Name="CH7">DI7</CheckBox>
                                </Grid>
                            </Grid>

                        </Grid>
                    </Grid>
                </Grid>

                <Grid Grid.Column="3" >
                    <Grid.RowDefinitions>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition></ColumnDefinition>
                        <ColumnDefinition></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Grid Grid.Column="0">
                        <TextBlock FontSize="12" HorizontalAlignment="Center">DO输出</TextBlock>
                    </Grid>
                    <Grid Grid.Column="1" Grid.Row="0">
                        <ComboBox Width="50" FontSize="12" HorizontalAlignment="Center" SelectedIndex="{Binding MCU_DO_CH}">
                            <ComboBoxItem IsSelected="true">DO0</ComboBoxItem>
                            <ComboBoxItem>DO1</ComboBoxItem>
                            <ComboBoxItem>DO2</ComboBoxItem>
                            <ComboBoxItem>DO3</ComboBoxItem>
                            <ComboBoxItem>DO4</ComboBoxItem>
                            <ComboBoxItem>DO5</ComboBoxItem>
                            <ComboBoxItem>DO6</ComboBoxItem>
                            <ComboBoxItem>DO7</ComboBoxItem>
                        </ComboBox>
                    </Grid>
                    <Grid Grid.Column="0" Grid.Row="1">
                        <Button Width="50" Command="{Binding Button_MCUDOuputCommand}">输出</Button>
                    </Grid>
                    <Grid Grid.Column="1" Grid.Row="1">
                        <RadioButton FontSize="12"  IsChecked="{Binding MCU_DO_Value}">True</RadioButton>
                        <RadioButton Margin="50,0,0,0" FontSize="12">false</RadioButton>
                    </Grid>
                </Grid>
            </Grid>
        </GroupBox>
    </Grid>
</UserControl>
