alielie
2025-03-18 a061384ba628a09bf4df91f50321ab22c03129aa
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
<UserControl x:Class="Plugin.ServoManage.ServoManage"
             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:Plugin.ServoManage"
             mc:Ignorable="d" 
             xmlns:hb="clr-namespace:HMI.Base;assembly=HMI.Base"
             xmlns:uic="clr-namespace:HMI.UI.Converter;assembly=HMI.UI"
             xmlns:pw="https://opensource.panuon.com/wpf"
             xmlns:pu="https://opensource.panuon.com/wpf-ui"
             xmlns:dp="clr-namespace:HMI.UI.DpUtil;assembly=HMI.UI"
             xmlns:cc="clr-namespace:HMI.Core;assembly=HMI.Core"
             Loaded="UserControl_Loaded"
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <Style x:Key="Desc" TargetType="Label">
            <Setter Property="Padding" Value="10"/>
            <Setter Property="FontSize" Value="12"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="BorderBrush" Value="#3a3a3a"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
        </Style>
 
        <Style x:Key="LabelText" TargetType="Label" BasedOn="{StaticResource Desc}">
            <Setter Property="BorderThickness" Value="1,0,1,1"/>
        </Style>
 
        <Style x:Key="BDesc" TargetType="Label" BasedOn="{StaticResource Desc}">
            <Setter Property="Background" Value="#afeeee"/>
        </Style>
 
        <Style x:Key="YDesc" TargetType="Label" BasedOn="{StaticResource Desc}">
            <Setter Property="Background" Value="#ffff00"/>
        </Style>
    </UserControl.Resources>
    
    <Border Style="{StaticResource CardBoarder}">
        <Grid dp:GridHelper.Space="10">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
 
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="7*"/>
                <ColumnDefinition Width="3*"/>
            </Grid.ColumnDefinitions>
 
            <DockPanel Grid.ColumnSpan="2">
                <StackPanel DockPanel.Dock="Right" Style="{StaticResource ButtonGroup}">
                    <Button Style="{StaticResource AddBtn}" x:Name="addBtn" Click="Button_Click"/>
                    <Button Style="{StaticResource EditBtn}" x:Name="editBtn" Click="Button_Click"/>
                    <Button Style="{StaticResource RfhBtn}" x:Name="rfhBtn" Click="Button_Click"/>
                    <Button Style="{StaticResource DelBtn}" x:Name="delBtn" Click="Button_Click"/>
                </StackPanel>
                <TextBlock Style="{StaticResource TitleBox}" Text="{DynamicResource svo.title}"/>
            </DockPanel>
 
            <DockPanel Grid.Row="2" Grid.ColumnSpan="2" Margin="0,10,0,0">
                <pu:Drawer DockPanel.Dock="Left" x:Name="DrwMenu" MinWidth="35" MaxWidth="400"
                           Padding="0"
                           ShadowColor="{x:Null}"
                           AnimationDuration="0" BorderThickness="2,0,0,2" BorderBrush="{StaticResource CommonBoarder}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
 
                        <Border Grid.ColumnSpan="2" BorderThickness="2" BorderBrush="{StaticResource CommonBoarder}" Background="{StaticResource VerBar}">
                            <DockPanel Height="35">
                                <ToggleButton x:Name="drawerBtn" BorderThickness="0"
                  DockPanel.Dock="Right"
                  Background="Transparent"
                  Width="35" Height="35" HorizontalAlignment="Right"
                  RenderTransformOrigin="0.5,0.5"
                                              Foreground="{StaticResource PrimaryColorContract}"
                  FontFamily="{StaticResource iconfont}"
                  Content="&#xe60e;" IsChecked="{Binding IsOpen, ElementName=DrwMenu, Mode=TwoWay}">
                                    <ToggleButton.Style>
                                        <Style TargetType="ToggleButton" BasedOn="{StaticResource CommonToggle}">
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding IsOpen, ElementName=DrwMenu}" Value="False">
                                                    <Setter Property="RenderTransform">
                                                        <Setter.Value>
                                                            <RotateTransform Angle="-90"/>
                                                        </Setter.Value>
                                                    </Setter>
                                                </DataTrigger>
                                                <DataTrigger Binding="{Binding IsOpen, ElementName=DrwMenu}" Value="True">
                                                    <Setter Property="Background" Value="Red"/>
                                                    <Setter Property="RenderTransform">
                                                        <Setter.Value>
                                                            <RotateTransform Angle="90"/>
                                                        </Setter.Value>
                                                    </Setter>
                                                </DataTrigger>
                                                <Trigger Property="IsChecked" Value="True">
                                                    <Setter Property="Background" Value="Red"/>
                                                </Trigger>
                                            </Style.Triggers>
                                        </Style>
                                    </ToggleButton.Style>
                                </ToggleButton>
 
                                <TextBlock Text="{DynamicResource svo.list}" FontSize="16" 
                                           Foreground="{StaticResource PrimaryColorContract}"
                                           VerticalAlignment="Center" HorizontalAlignment="Center"/>
                            </DockPanel>
                        </Border>
 
 
                        <Grid Grid.Row="1">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
 
                            <DataGrid Grid.Row="1" Grid.ColumnSpan="2" Style="{StaticResource DefaultDataGrid}"
                                      IsReadOnly="False"
                                      SelectionMode="Single"
                                      BorderThickness="0"
                                      ItemsSource="{Binding Datas}">
                                <DataGrid.Columns>
                                    <DataGridTemplateColumn Header="#" IsReadOnly="True" CanUserResize="False">
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding Converter={StaticResource rowNumber},
RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow},AncestorLevel=1}}"/>
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
 
                                    <DataGridTextColumn IsReadOnly="True" Width="*" Binding="{Binding Name}">
                                        <DataGridTextColumn.Header>
                                            <TextBlock Text="{DynamicResource svo.name}"/>
                                        </DataGridTextColumn.Header>
                                    </DataGridTextColumn>
 
                                    <DataGridTemplateColumn Width="100" IsReadOnly="True" CanUserResize="False">
                                        <DataGridTemplateColumn.Header>
                                            <TextBlock Text="{DynamicResource App.Opt}"/>
                                        </DataGridTemplateColumn.Header>
 
                                        <DataGridTemplateColumn.CellTemplate>
                                            <DataTemplate>
                                                <StackPanel Orientation="Horizontal" dp:StackPanelHelper.ChildSpace="10">
                                                    <Button x:Name="editServoBtn" Style="{StaticResource EditLink}"  DataContext="{Binding }"
Click="Button_Click"/>
                                                    <Button x:Name="delServoBtn" Style="{StaticResource DeleteLink}"
DataContext="{Binding }"
Click="Button_Click"/>
                                                </StackPanel>
                                            </DataTemplate>
                                        </DataGridTemplateColumn.CellTemplate>
                                    </DataGridTemplateColumn>
                                </DataGrid.Columns>
 
                            </DataGrid>
                        </Grid>
 
                        <Label Grid.Row="1" Grid.Column="1"  Width="100" Height="34"
                               VerticalContentAlignment="Center"
                               HorizontalContentAlignment="Center"
                                   Content="{DynamicResource svo.list}"
                                   FontSize="16">
                            <Label.LayoutTransform>
                                <RotateTransform CenterX="25" CenterY="25" Angle="270"/>
                            </Label.LayoutTransform>
 
                            <Label.Style>
                                <Style TargetType="Label">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding IsOpen, ElementName=DrwMenu,Mode=OneWay}" Value="True">
                                            <Setter Property="Visibility" Value="Collapsed"/>
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding IsOpen, ElementName=DrwMenu}" Value="False">
                                            <Setter Property="Visibility" Value="Visible"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Label.Style>
                        </Label>
                    </Grid>
                </pu:Drawer>
 
                <Border BorderThickness="2" BorderBrush="{StaticResource CommonBoarder}">
                    <Grid dp:GridHelper.Space="10">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
 
                        <DockPanel>
                            <StackPanel Style="{StaticResource ButtonGroup}">
                                <TextBlock Style="{StaticResource TitleBox}" 
                                           FontSize="{StaticResource ContentFontSize2}" 
                                           Text="{DynamicResource svo.product}"/>
                                <ComboBox x:Name="productInput" Style="{StaticResource FormComboxStyle}" MinWidth="180" />
 
                                <Button Style="{StaticResource AddBtn}" Click="Button_Click"/>
                                <Button Style="{StaticResource EditBtn}" Click="Button_Click"/>
                                <Button Style="{StaticResource RfhBtn}" Click="Button_Click"/>
                                <Button Style="{StaticResource DelBtn}" Click="Button_Click"/>
                            </StackPanel>
                        </DockPanel>
 
                        <WrapPanel Grid.Row="1">
                            <GroupBox Header="报警" Padding="10">
                                <StackPanel Style="{StaticResource ButtonGroup}">
                                    <StackPanel>
                                        <Label Style="{StaticResource YDesc}" Content="控制报警"/>
                                        <Label Style="{StaticResource LabelText}" Content="控制报警"/>
                                    </StackPanel>
                                    <StackPanel>
                                        <Label Style="{StaticResource YDesc}" Content="驱动报警"/>
                                        <Label Style="{StaticResource LabelText}" Content="控制报警"/>
                                    </StackPanel>
                                    <StackPanel>
                                        <Label Style="{StaticResource YDesc}" Content="故障驱动"/>
                                        <Label Style="{StaticResource LabelText}" Content="0"/>
                                    </StackPanel>
                                </StackPanel>
                            </GroupBox>
 
                            <GroupBox Header="位置" Padding="10">
                                <StackPanel Style="{StaticResource ButtonGroup}">
                                    <StackPanel>
                                        <Label Style="{StaticResource BDesc}" Content="当前位置"/>
                                        <Label Style="{StaticResource LabelText}" Content="0"/>
                                    </StackPanel>
 
                                    <StackPanel>
                                        <Label Style="{StaticResource BDesc}" Content="当前速度"/>
                                        <Label Style="{StaticResource LabelText}" Content="0"/>
                                    </StackPanel>
                                    <StackPanel>
                                        <Label Style="{StaticResource BDesc}" Content="加速度"/>
                                        <Label Style="{StaticResource LabelText}" Content="0"/>
                                    </StackPanel>
                                    <StackPanel>
                                        <Label Style="{StaticResource BDesc}" Content="减速度"/>
                                        <Label Style="{StaticResource LabelText}" Content="0"/>
                                    </StackPanel>
                                </StackPanel>
                            </GroupBox>
 
                            <GroupBox Header="状态" Padding="10">
                                <StackPanel Style="{StaticResource ButtonGroup}">
                                    <StackPanel>
                                        <Label Style="{StaticResource YDesc}" Content="使能"/>
                                        <Label Style="{StaticResource LabelText}">
                                            <Ellipse Height="30" Width="30" Fill="{StaticResource Normal}" />
                                        </Label>
                                    </StackPanel>
 
                                    <StackPanel>
                                        <Label Style="{StaticResource YDesc}" Content="准备好"/>
                                        <Label Style="{StaticResource LabelText}">
                                            <Ellipse Height="30" Width="30" Fill="{StaticResource Normal}" />
                                        </Label>
                                    </StackPanel>
                                    <StackPanel>
                                        <Label Style="{StaticResource YDesc}" Content="运行中"/>
                                        <Label Style="{StaticResource LabelText}">
                                            <Ellipse Height="30" Width="30" Fill="{StaticResource Normal}" />
                                        </Label>
                                    </StackPanel>
                                    <StackPanel>
                                        <Label Style="{StaticResource YDesc}" Content="故障"/>
                                        <Label Style="{StaticResource LabelText}">
                                            <Ellipse Height="30" Width="30" Fill="{StaticResource Normal}" />
                                        </Label>
                                    </StackPanel>
                                    <StackPanel>
                                        <Label Style="{StaticResource YDesc}" Content="轴报警"/>
                                        <Label Style="{StaticResource LabelText}">
                                            <Ellipse Height="30" Width="30" Fill="{StaticResource Normal}" />
                                        </Label>
                                    </StackPanel>
                                    <StackPanel>
                                        <Label Style="{StaticResource YDesc}" Content="代码"/>
                                        <Label Style="{StaticResource LabelText}">
                                            <Ellipse Height="30" Width="30" Fill="{StaticResource Normal}" />
                                        </Label>
                                    </StackPanel>
                                </StackPanel>
                            </GroupBox>
 
                            <GroupBox Header="限位传感器" Padding="10">
                                <StackPanel Style="{StaticResource ButtonGroup}" Orientation="Vertical">
                                    <StackPanel Orientation="Horizontal">
                                        <Label Style="{StaticResource YDesc}" Content="使能"/>
                                        <Label Style="{StaticResource LabelText}" BorderThickness="0,1,1,1" >
                                            <Ellipse Height="30" Width="30" Fill="{StaticResource Normal}" />
                                        </Label>
                                    </StackPanel>
 
                                    <StackPanel Orientation="Horizontal">
                                        <Label Style="{StaticResource YDesc}" Content="准备好"/>
                                        <Label Style="{StaticResource LabelText}" BorderThickness="0,1,1,1" >
                                            <Ellipse Height="30" Width="30" Fill="{StaticResource Normal}" />
                                        </Label>
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <Label Style="{StaticResource YDesc}" Content="运行中"/>
                                        <Label Style="{StaticResource LabelText}" BorderThickness="0,1,1,1" >
                                            <Ellipse Height="30" Width="30" Fill="{StaticResource Normal}" />
                                        </Label>
                                    </StackPanel>
                                </StackPanel>
                            </GroupBox>
 
                            <GroupBox Header="寸动" Padding="10">
                                <StackPanel Style="{StaticResource ButtonGroup}">
                                    <Button Style="{StaticResource PrimaryButton}">寸动</Button>
 
                                    <Label Style="{StaticResource LabelText}" BorderThickness="1" Content="准备好"/>
 
                                    <Button Style="{StaticResource PrimaryButton}">正向</Button>
                                </StackPanel>
                            </GroupBox>
 
                            <GroupBox Header="操作" Padding="10">
                                <Grid dp:GridHelper.Space="10">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>
                                    <Button Style="{StaticResource PrimaryButton}">调试模式</Button>
                                    <UniformGrid Grid.Row="1" Columns="2">
                                        <Button Style="{StaticResource PrimaryButton}"
                                                Margin="0,0,5,0">调试模式</Button>
                                        <Button Style="{StaticResource PrimaryButton}"
                                                Margin="5,0,0,0">调试模式</Button>
                                    </UniformGrid>
                                    <Button Grid.Row="2" Style="{StaticResource PrimaryButton}">初始化</Button>
                                    <Button Grid.Row="3" Style="{StaticResource PrimaryButton}">停止</Button>
                                    <UniformGrid Grid.Row="4" Columns="3">
                                        <Button Style="{StaticResource PrimaryButton}">调试模式</Button>
                                        <Label Style="{StaticResource LabelText}" 
                                               Margin="10,0,10,0"
                                               BorderThickness="1" Content="准备好"/>
                                        <Button Style="{StaticResource PrimaryButton}">调试模式</Button>
                                    </UniformGrid>
                                </Grid>
                                
                            </GroupBox>
 
 
                        </WrapPanel>
                    </Grid>
                </Border>
            </DockPanel>
        </Grid>
    </Border>
</UserControl>