schangxiang@126.com
2025-11-04 f5ed29dc26c7cd952d56ec5721a2efc43cd25992
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<UserControl x:Class="XHandler.View.MethodProperty.ShakeProperty"
             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:local="clr-namespace:XHandler.View.MethodProperty"
             xmlns:str="clr-namespace:XHandler.Properties"
             xmlns:ctrls="clr-namespace:XHandler.Controls"
             xmlns:valide="clr-namespace:XHandler.View.Consumables"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800" Loaded="UserControl_Loaded">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="40"/>
            <RowDefinition Height="40"/>
            <RowDefinition Height="40"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="125"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width=".9*"/>
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Row="0" Grid.Column="0" Text="{x:Static str:Resources.strCommandTag}" FontSize="16"
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0 0 15 0"/>
        <TextBlock Grid.Row="1" Grid.Column="0" Text="{x:Static str:Resources.strCommandName}" FontSize="16" 
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0 0 15 0"/>
 
        <TextBox Grid.Row="0" Grid.Column="1" x:Name="tbxCommandLabel" Height="30" FontSize="16" VerticalContentAlignment="Center" BorderThickness="0" Background="{DynamicResource lightGrayBrush}"
                 Text="{Binding label, Mode=TwoWay}" IsEnabled="False"/>
        <!--<TextBox Grid.Row="1" Grid.Column="1" x:Name="tbxCommandName" Height="30" FontSize="16" VerticalContentAlignment="Center" BorderThickness="0" Background="{DynamicResource lightGrayBrush}"
                 Text="{Binding name}" TextChanged="tbxCommandName_TextChanged"/>-->
        <TextBox x:Name="tbxCommandName" Grid.Row="1" Grid.Column="1" Height="30" FontSize="16" VerticalContentAlignment="Center" Background="{DynamicResource lightGrayBrush}"
                     BorderThickness="0" TextChanged="tbxCommandName_TextChanged">
            <TextBox.Text>
                <Binding Path="name" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True" >
                    <Binding.ValidationRules>
                        <local:AspirateValidationRule  ValidateType="tbxCommandName"/>
                    </Binding.ValidationRules>
                </Binding>
            </TextBox.Text>
        </TextBox>
        <TextBlock Grid.Row="1" Grid.Column="2" x:Name="nError" Text="{Binding  ElementName=tbxCommandName,Path=(Validation.Errors)[0].ErrorContent}" Foreground="Red" FontSize="16" 
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 5 5 0"/>
 
        <TextBlock Grid.Row="2" Grid.Column="0" Text="{x:Static str:Resources.strMode}" FontSize="16"
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0 0 15 0"/>
        <StackPanel Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal">
            <RadioButton x:Name="radioBtnShake" Grid.Row="2" Grid.Column="0" Content="{x:Static str:Resources.strShakeInfo}" FontSize="16" 
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 0 15 0" Checked="radioBtnShake_Checked"/>
            <RadioButton x:Name="radioBtnMove" Grid.Row="2" Grid.Column="0" Content="{x:Static str:Resources.strMoveInfo}" FontSize="16" 
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 0 15 0" Checked="radioBtnMove_Checked"/>
        </StackPanel>
 
        <Grid Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" x:Name="gridShakeParams" Visibility="Visible">
            <Grid.RowDefinitions>
                <RowDefinition Height="40"/>
                <RowDefinition Height="40"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="125"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Row="0" Grid.Column="0" Text="{x:Static str:Resources.strShakeSpeed}" FontSize="16"
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0 0 15 0"/>
            <TextBox x:Name="tbxShakeSpeed" Grid.Row="0" Grid.Column="1" Height="30" FontSize="16" VerticalContentAlignment="Center" Background="{DynamicResource lightGrayBrush}"
                     BorderThickness="0" TextChanged="tbxShakeSpeed_TextChanged">
                <TextBox.Text>
                    <Binding Path="shakeSpeed" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True" >
                        <Binding.ValidationRules>
                            <valide:ConsumablesValidationRule  ValidateType="1,4@[2],5@(0-5]"/>
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <TextBlock Grid.Row="0" Grid.Column="2" Text="{x:Static str:Resources.strShakeSpeedUnit}" FontSize="16"
                   VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10 0 0 0"/>
            <TextBlock Grid.Row="0" Grid.Column="2" x:Name="tbkErrorShakeSpeed"  Text="{Binding  ElementName=tbxShakeSpeed,Path=(Validation.Errors)[0].ErrorContent}" Foreground="Red" FontSize="16" 
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5 5 5 0"/>
 
            <TextBlock Grid.Row="1" Grid.Column="0" Text="{x:Static str:Resources.strShakeDuringTime}" FontSize="16"
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0 0 15 0"/>
            <TextBox x:Name="tbxShakeDuringTime" Grid.Row="1" Grid.Column="1" Height="30" FontSize="16" VerticalContentAlignment="Center" Background="{DynamicResource lightGrayBrush}"
                     BorderThickness="0" TextChanged="tbxShakeDuringTime_TextChanged">
                <TextBox.Text>
                    <Binding Path="shakeDuringTime" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True" >
                        <Binding.ValidationRules>
                            <valide:ConsumablesValidationRule  ValidateType="1,4@[0],5@[0-10000000]"/>
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
            <TextBlock Grid.Row="1" Grid.Column="2" Text="{x:Static str:Resources.strSecondUnit}" FontSize="16"
                   VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10 0 0 0"/>
        </Grid>
 
        <Grid Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" x:Name="gridMoveParams" Visibility="Collapsed">
            <Grid.RowDefinitions>
                <RowDefinition Height="40"/>
                <RowDefinition Height="40"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="125"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Row="0" Grid.Column="0" Text="{x:Static str:Resources.strShakeMoveSpeed}" FontSize="16"
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0 0 0 0"/>
            <TextBox x:Name="tbxShakeMoveSpeed" Grid.Row="0" Grid.Column="1" Height="30" FontSize="16" VerticalContentAlignment="Center" Background="{DynamicResource lightGrayBrush}"
                     BorderThickness="0" TextChanged="tbxShakeMoveSpeed_TextChanged">
                <TextBox.Text>
                    <Binding Path="shakeMoveSpeed" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True" >
                        <Binding.ValidationRules>
                            <valide:ConsumablesValidationRule  ValidateType="1,4@[0],5@[0-100]"/>
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
 
            <TextBlock Grid.Row="1" Grid.Column="0" Text="{x:Static str:Resources.strShakeAngle}" FontSize="16"
                   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0 0 0 0"/>
            <TextBox x:Name="tbxShakeMoveAngle" Grid.Row="1" Grid.Column="1" Height="30" FontSize="16" VerticalContentAlignment="Center" Background="{DynamicResource lightGrayBrush}"
                     BorderThickness="0" TextChanged="tbxShakeMoveAngle_TextChanged">
                <TextBox.Text>
                    <Binding Path="shakeMoveAngle" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True" >
                        <Binding.ValidationRules>
                            <valide:ConsumablesValidationRule  ValidateType="1,4@[1],5@[0-360]"/>
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
            </TextBox>
        </Grid>
    </Grid>
</UserControl>