<UserControl
    x:Class="BPA.SingleDevice.View.DebugView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:bpa="http://BPAUIControl.io/winfx/xaml/toolkit"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:BPA.SingleDevice.View"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:vm="clr-namespace:BPA.SingleDevice.ViewModel"
    d:DesignHeight="950"
    d:DesignWidth="800"
    mc:Ignorable="d">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="1*" />
            <RowDefinition Height="1*" />
        </Grid.RowDefinitions>
        <ToggleButton
            Margin="10"
            HorizontalAlignment="Left"
            Content="开机自启"
            FontSize="40"
            IsChecked="{Binding AutoStart}" 
            Style="{DynamicResource SwitchAccentToggleButton}" />
        <ToggleButton
            x:Name="ModeButton"
            Margin="10"
            HorizontalAlignment="Right"
            bpa:ToggleButtonHelper.CheckedContent="调试模式"
            Command="{Binding SwitchSystemModeCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked}"
            Content="配料模式"
            FontSize="40"
            Style="{DynamicResource SwitchAccentToggleButton}" />

        <!--  流水线手动控制移动  -->
        <Border
            Grid.Row="1"
            Margin="10"
            BorderBrush="Gray"
            BorderThickness="3">
            <StackPanel
                HorizontalAlignment="Stretch"
                VerticalAlignment="Top"
                IsEnabled="{Binding ElementName=ModeButton, Path=IsChecked}"
                Orientation="Horizontal">
                <Button
                    Margin="10"
                    Command="{Binding StartMoveInchCommand}"
                    Content="寸动开始"
                    FontSize="40" />
                <Button
                    Margin="10"
                    Command="{Binding StopMoveInchCommand}"
                    Content="寸动停止"
                    FontSize="40" />
                <ToggleButton
                    Margin="10"
                    bpa:ToggleButtonHelper.CheckedContent="反转"
                    Content="正转"
                    FontSize="40"
                    IsChecked="{Binding IsReverse}"
                    Style="{DynamicResource SwitchAccentToggleButton}" />
                <TextBlock
                    FontSize="40"
                    Foreground="White"
                    Text="寸动速度：" />

                <TextBox
                    Width="200"
                    Margin="10"
                    FontSize="40"
                    Text="{Binding InchSpeed}" />
            </StackPanel>
        </Border>

        <!--  味魔方手动控制  -->
        <Border
            Grid.Row="2"
            Margin="5"
            BorderBrush="Gray"
            BorderThickness="3">
            <StackPanel Margin="5" Orientation="Vertical">
                <Grid Margin="0,0,0,10">
                    <TextBlock
                        FontSize="40"
                        Foreground="White"
                        Text="流水线移动参数设置" />
                    <Button
                        Width="320"
                        HorizontalAlignment="Right"
                        bpa:ButtonHelper.Shape="Round"
                        Command="{Binding WriteParamsCommand}"
                        Content="保存并写入设置" />
                </Grid>

                <StackPanel Margin="5" Orientation="Horizontal">
                    <TextBlock
                        FontSize="40"
                        Foreground="White"
                        Text="移动速度：" />
                    <TextBox Width="200" Text="{Binding MoveSpeed}" />
                </StackPanel>
                <!--<StackPanel Margin="5" Orientation="Horizontal">
                    <TextBlock
                        FontSize="22"
                        Foreground="White"
                        Text="加速时间：" />
                    <TextBox Width="120" Text="{Binding AccTime}" />
                </StackPanel>-->
                <StackPanel Margin="5" Orientation="Horizontal">
                    <TextBlock
                        FontSize="40"
                        Foreground="White"
                        Text="移动长度：" />
                    <TextBox Width="200" Text="{Binding MoveLength}" />
                </StackPanel>
                <StackPanel Margin="5" Orientation="Horizontal">
                    <TextBlock
                        FontSize="40"
                        Foreground="White"
                        Text="移动延时：" />
                    <TextBox Width="200" Text="{Binding MoveDelay}" />
                </StackPanel>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>