VisionDynamicAccuracyAnalyzer.xaml 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  1. <UserControl x:Class="TeamAAS_VP.Views.Product.VisionDynamicAccuracyAnalyzer"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:prism="http://prismlibrary.com/"
  5. xmlns:wf="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
  6. xmlns:vp="clr-namespace:Cognex.VisionPro;assembly=Cognex.VisionPro.Controls"
  7. xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
  8. xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
  9. xmlns:sys="clr-namespace:System;assembly=mscorlib"
  10. xmlns:uControl="clr-namespace:TeamAAS_VP.Controls"
  11. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  12. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  13. xmlns:vm="clr-namespace:TeamAAS_VP.ViewModels.Product"
  14. xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
  15. xmlns:lex="http://wpflocalizeextension.codeplex.com"
  16. lex:LocalizeDictionary.DesignCulture="zh-CN"
  17. lex:ResxLocalizationProvider.DefaultAssembly="TeamAAS-VP"
  18. lex:ResxLocalizationProvider.DefaultDictionary="Lang"
  19. prism:ViewModelLocator.AutoWireViewModel="True"
  20. mc:Ignorable="d"
  21. d:DataContext="{d:DesignInstance Type=vm:VisionDynamicAccuracyAnalyzerViewModel}"
  22. d:Height="1080"
  23. d:Width="1920"
  24. MinHeight="500"
  25. MinWidth="500"
  26. d:Background="White"
  27. HorizontalAlignment="Stretch"
  28. VerticalAlignment="Stretch"
  29. FontFamily="{DynamicResource DefaultFont}">
  30. <prism:Dialog.WindowStyle>
  31. <Style TargetType="Window">
  32. <Setter Property="prism:Dialog.WindowStartupLocation"
  33. Value="CenterScreen" />
  34. <Setter Property="AllowDrop"
  35. Value="True" />
  36. <Setter Property="ShowInTaskbar"
  37. Value="True" />
  38. <Setter Property="MinHeight"
  39. Value="500" />
  40. <Setter Property="MinWidth"
  41. Value="500" />
  42. <Setter Property="WindowState"
  43. Value="Maximized" />
  44. <Setter Property="Topmost"
  45. Value="True" />
  46. </Style>
  47. </prism:Dialog.WindowStyle>
  48. <UserControl.Resources>
  49. <!-- 复用静态测试的样式 -->
  50. <Style TargetType="Button"
  51. BasedOn="{StaticResource MaterialDesignFlatDarkBgButton}">
  52. <Setter Property="Padding"
  53. Value="10 5" />
  54. <Setter Property="Margin"
  55. Value="5" />
  56. <Setter Property="FontSize"
  57. Value="14" />
  58. <Setter Property="BorderThickness"
  59. Value="0" />
  60. </Style>
  61. <Style TargetType="TextBlock">
  62. <Setter Property="VerticalAlignment"
  63. Value="Center" />
  64. <Setter Property="Margin"
  65. Value="5" />
  66. </Style>
  67. <Style TargetType="TextBox"
  68. BasedOn="{StaticResource MaterialDesignTextBox}">
  69. <Setter Property="Margin"
  70. Value="5" />
  71. <Setter Property="VerticalContentAlignment"
  72. Value="Center" />
  73. </Style>
  74. <Style x:Key="DataGridStyle"
  75. TargetType="DataGrid"
  76. BasedOn="{StaticResource MaterialDesignDataGrid}">
  77. <Setter Property="Margin"
  78. Value="5" />
  79. <Setter Property="AutoGenerateColumns"
  80. Value="False" />
  81. <Setter Property="CanUserAddRows"
  82. Value="False" />
  83. <Setter Property="CanUserDeleteRows"
  84. Value="False" />
  85. <Setter Property="IsReadOnly"
  86. Value="True" />
  87. <Setter Property="AlternatingRowBackground"
  88. Value="#F5F5F5" />
  89. </Style>
  90. <Style x:Key="TitleStyle"
  91. TargetType="TextBlock">
  92. <Setter Property="FontSize"
  93. Value="16" />
  94. <Setter Property="FontWeight"
  95. Value="Bold" />
  96. <Setter Property="Margin"
  97. Value="0 10 0 5" />
  98. <Setter Property="Foreground"
  99. Value="#2C3E50" />
  100. </Style>
  101. </UserControl.Resources>
  102. <Grid>
  103. <Grid.ColumnDefinitions>
  104. <ColumnDefinition Width="45*" />
  105. <ColumnDefinition Width="55*" />
  106. </Grid.ColumnDefinitions>
  107. <!-- 左侧控制面板 -->
  108. <ScrollViewer >
  109. <Border Grid.Column="0"
  110. BorderBrush="#BDC3C7"
  111. BorderThickness="0 0 1 0">
  112. <Grid>
  113. <Grid.RowDefinitions>
  114. <RowDefinition Height="Auto" />
  115. <RowDefinition Height="Auto" />
  116. <RowDefinition Height="Auto" />
  117. <RowDefinition Height="Auto" />
  118. <RowDefinition Height="*"
  119. MinHeight="150" />
  120. <RowDefinition Height="Auto" />
  121. </Grid.RowDefinitions>
  122. <!-- 机器人位置设置 -->
  123. <Border Grid.Row="0"
  124. Background="#ECF0F1"
  125. Padding="10">
  126. <StackPanel>
  127. <TextBlock Style="{StaticResource TitleStyle}"
  128. Text="机器人位置设置" />
  129. <Grid Margin="0 10 0 0">
  130. <Grid.RowDefinitions>
  131. <RowDefinition Height="Auto" />
  132. <RowDefinition Height="Auto" />
  133. <RowDefinition Height="Auto" />
  134. </Grid.RowDefinitions>
  135. <!-- A点坐标 -->
  136. <Grid Grid.Row="0"
  137. Margin="0 0 0 10">
  138. <Grid.ColumnDefinitions>
  139. <ColumnDefinition Width="Auto" />
  140. <ColumnDefinition Width="*" />
  141. <ColumnDefinition Width="Auto" />
  142. </Grid.ColumnDefinitions>
  143. <TextBlock Text="A点坐标:"
  144. Grid.Column="0"
  145. VerticalAlignment="Center" />
  146. <TextBox Grid.Column="1"
  147. d:Text="X:0.000 Y:0.000 Z:0.000 U:0.000 V:0.000 W:0.000"
  148. ToolTip="机器人A点位置坐标"
  149. IsReadOnly="True"
  150. Background="#F8F9FA">
  151. <TextBox.Text>
  152. <MultiBinding StringFormat="X:{0:f3} Y:{1:f3} Z:{2:f3} U:{3:f3} V:{4:f3} W:{5:f3}">
  153. <Binding Path="PointA.X"/>
  154. <Binding Path="PointA.Y"/>
  155. <Binding Path="PointA.Z"/>
  156. <Binding Path="PointA.U"/>
  157. <Binding Path="PointA.V"/>
  158. <Binding Path="PointA.W"/>
  159. </MultiBinding>
  160. </TextBox.Text>
  161. </TextBox>
  162. <Button Grid.Column="2"
  163. Content="示教"
  164. Command="{Binding TeachPointACommand}"
  165. Background="#3498DB"
  166. Foreground="White"
  167. Width="60"
  168. Margin="5,0,0,0" />
  169. </Grid>
  170. <!-- B点坐标 -->
  171. <Grid Grid.Row="1"
  172. Margin="0 0 0 10">
  173. <Grid.ColumnDefinitions>
  174. <ColumnDefinition Width="Auto" />
  175. <ColumnDefinition Width="*" />
  176. <ColumnDefinition Width="Auto" />
  177. </Grid.ColumnDefinitions>
  178. <TextBlock Text="B点坐标:"
  179. Grid.Column="0"
  180. VerticalAlignment="Center" />
  181. <TextBox Grid.Column="1"
  182. d:Text="X:100.000 Y:50.000 Z:0.000 U:0.000 V:0.000 W:0.000"
  183. ToolTip="机器人B点拍照位置坐标"
  184. IsReadOnly="True"
  185. Background="#F8F9FA" >
  186. <TextBox.Text>
  187. <MultiBinding StringFormat="X:{0:f3} Y:{1:f3} Z:{2:f3} U:{3:f3} V:{4:f3} W:{5:f3}">
  188. <Binding Path="PointB.X"/>
  189. <Binding Path="PointB.Y"/>
  190. <Binding Path="PointB.Z"/>
  191. <Binding Path="PointB.U"/>
  192. <Binding Path="PointB.V"/>
  193. <Binding Path="PointB.W"/>
  194. </MultiBinding>
  195. </TextBox.Text>
  196. </TextBox>
  197. <Button Grid.Column="2"
  198. Content="示教"
  199. Command="{Binding TeachPointBCommand}"
  200. Background="#3498DB"
  201. Foreground="White"
  202. Width="60"
  203. Margin="5,0,0,0" />
  204. </Grid>
  205. <!-- 视觉流程选择 -->
  206. <Grid Grid.Row="2">
  207. <Grid.ColumnDefinitions>
  208. <ColumnDefinition Width="Auto" />
  209. <ColumnDefinition Width="*" />
  210. </Grid.ColumnDefinitions>
  211. <TextBlock Text="视觉流程:"
  212. Grid.Column="0"
  213. VerticalAlignment="Center" />
  214. <ComboBox Grid.Column="1"
  215. ItemsSource="{Binding ProcedureModels}"
  216. SelectedItem="{Binding SelectProcedure, Mode=TwoWay}"
  217. ToolTip="选择视觉处理流程">
  218. <ComboBox.ItemTemplate>
  219. <DataTemplate>
  220. <TextBlock Text="{Binding Name}" />
  221. </DataTemplate>
  222. </ComboBox.ItemTemplate>
  223. <b:Interaction.Triggers>
  224. <b:EventTrigger EventName="SelectionChanged">
  225. <b:InvokeCommandAction Command="{Binding ProcedureSelectionChangedCommand}" />
  226. </b:EventTrigger>
  227. </b:Interaction.Triggers>
  228. </ComboBox>
  229. </Grid>
  230. </Grid>
  231. </StackPanel>
  232. </Border>
  233. <!-- 测试参数设置 -->
  234. <Border Grid.Row="1"
  235. Background="#F8F9FA"
  236. Padding="10">
  237. <StackPanel>
  238. <TextBlock Style="{StaticResource TitleStyle}"
  239. Text="测试参数设置" />
  240. <!-- 新增:2D/3D 选项 -->
  241. <StackPanel Orientation="Horizontal"
  242. Margin="0 5 0 5">
  243. <TextBlock Text="模式:" />
  244. <RadioButton Content="3D-1"
  245. GroupName="VisionMode"
  246. Margin="10 0 0 0"
  247. IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}"
  248. IsChecked="{Binding Is3DMode, Mode=TwoWay, Converter={StaticResource InvertBooleanConverter}}" />
  249. <RadioButton Content="3D-2"
  250. GroupName="VisionMode"
  251. Margin="10 0 0 0"
  252. IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}"
  253. IsChecked="{Binding Is3DMode, Mode=TwoWay}" />
  254. </StackPanel>
  255. <Grid Margin="0 10 0 0">
  256. <Grid.ColumnDefinitions>
  257. <ColumnDefinition Width="*" />
  258. <ColumnDefinition Width="*" />
  259. <ColumnDefinition Width="*" />
  260. </Grid.ColumnDefinitions>
  261. <!-- 重复次数 -->
  262. <StackPanel Grid.Column="0">
  263. <TextBlock Text="重复次数:" />
  264. <mah:NumericUpDown Value="{Binding RepeatCount, Mode=TwoWay}"
  265. Minimum="1"
  266. Maximum="1000"
  267. d:Value="50"
  268. TextAlignment="Center"
  269. HorizontalContentAlignment="Center"
  270. HorizontalAlignment="Stretch"
  271. IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}" />
  272. </StackPanel>
  273. <!-- 移动速度 -->
  274. <StackPanel Grid.Column="1"
  275. Margin="10,0,0,0">
  276. <TextBlock Text="移动速度(%):" />
  277. <mah:NumericUpDown Value="{Binding MoveSpeed, Mode=TwoWay}"
  278. Minimum="1"
  279. Maximum="100"
  280. d:Value="50"
  281. TextAlignment="Center"
  282. HorizontalContentAlignment="Center"
  283. HorizontalAlignment="Stretch"
  284. IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}" />
  285. </StackPanel>
  286. <StackPanel Grid.Column="2"
  287. Margin="10,0,0,0">
  288. <TextBlock Text="垂直步进距离(ms):" />
  289. <uControl:myNumericUpDowm MinWidth="100"
  290. Interval="0.1"
  291. Maximum="10"
  292. Minimum="-10"
  293. StringFormat="{}{0:N3} mm"
  294. Value="{Binding Distance,Mode=TwoWay}"
  295. Margin="10,0" />
  296. </StackPanel>
  297. </Grid>
  298. </StackPanel>
  299. </Border>
  300. <!-- 测试控制区域 -->
  301. <Border Grid.Row="2"
  302. Background="#ECF0F1"
  303. Padding="10">
  304. <StackPanel>
  305. <TextBlock Style="{StaticResource TitleStyle}"
  306. Text="测试控制" />
  307. <WrapPanel HorizontalAlignment="Center"
  308. Margin="0 10 0 0">
  309. <CheckBox Content="启用垂直检测"
  310. Foreground="Black"
  311. Style="{StaticResource MaterialDesignCheckBox}"
  312. VerticalAlignment="Center"
  313. IsChecked="{Binding IsVertical}"
  314. Margin="10,0"
  315. FontSize="15" />
  316. <Button Content="单次测试"
  317. Background="#3498DB"
  318. Foreground="White"
  319. MinWidth="100"
  320. Height="35"
  321. FontWeight="Bold"
  322. Command="{Binding SingleTestCommand}"
  323. IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}" />
  324. <Button Content="连续测试"
  325. Background="#27AE60"
  326. Foreground="White"
  327. MinWidth="100"
  328. Height="35"
  329. FontWeight="Bold"
  330. Command="{Binding StartTestCommand}" />
  331. <Button Content="停止"
  332. Background="#E74C3C"
  333. Foreground="White"
  334. MinWidth="100"
  335. Height="35"
  336. Command="{Binding StopTestCommand}" />
  337. <Button Content="暂停"
  338. Background="#F39C12"
  339. Foreground="White"
  340. MinWidth="100"
  341. Height="35"
  342. Command="{Binding PauseTestCommand}" />
  343. </WrapPanel>
  344. </StackPanel>
  345. </Border>
  346. <!-- 进度显示 -->
  347. <Border Grid.Row="3"
  348. Background="White"
  349. Padding="10">
  350. <StackPanel>
  351. <TextBlock Style="{StaticResource TitleStyle}"
  352. Text="测试进度" />
  353. <Grid Margin="0 10 0 0">
  354. <Grid.RowDefinitions>
  355. <RowDefinition Height="Auto" />
  356. <RowDefinition Height="Auto" />
  357. </Grid.RowDefinitions>
  358. <ProgressBar Grid.Row="0"
  359. Height="25"
  360. Margin="5"
  361. Minimum="0"
  362. Maximum="{Binding RepeatCount}"
  363. Value="{Binding CurrentProgress}"
  364. IsEnabled="False"
  365. d:Maximum="100"
  366. d:Value="50" />
  367. <TextBlock Grid.Row="1"
  368. HorizontalAlignment="Center"
  369. FontSize="12"
  370. Foreground="#7F8C8D"
  371. d:Text="等待开始..."
  372. Text="{Binding Message}" />
  373. </Grid>
  374. <!-- 实时统计信息 -->
  375. <WrapPanel Margin="0 15 0 0"
  376. HorizontalAlignment="Center">
  377. <Border Background="#3498DB"
  378. Padding="10 5"
  379. Margin="5"
  380. CornerRadius="3">
  381. <StackPanel>
  382. <TextBlock Text="当前循环"
  383. Foreground="White"
  384. FontSize="11" />
  385. <TextBlock Text="{Binding CurrentProgress}"
  386. d:Text="1"
  387. Foreground="White"
  388. FontSize="16"
  389. FontWeight="Bold"
  390. HorizontalAlignment="Center" />
  391. </StackPanel>
  392. </Border>
  393. <Border Background="#2ECC71"
  394. Padding="10 5"
  395. Margin="5"
  396. CornerRadius="3">
  397. <StackPanel>
  398. <TextBlock Text="成功率"
  399. Foreground="White"
  400. FontSize="11" />
  401. <TextBlock Text="{Binding SuccessRate, StringFormat={}{0:F1}%}"
  402. d:Text="100%"
  403. Foreground="White"
  404. FontSize="16"
  405. FontWeight="Bold"
  406. HorizontalAlignment="Center" />
  407. </StackPanel>
  408. </Border>
  409. <Border Background="#9B59B6"
  410. Padding="10 5"
  411. Margin="5"
  412. CornerRadius="3">
  413. <StackPanel>
  414. <TextBlock Text="往返时间"
  415. Foreground="White"
  416. FontSize="11" />
  417. <TextBlock Text="{Binding CycleTime, StringFormat={}{0:F2}s}"
  418. d:Text="2.34s"
  419. Foreground="White"
  420. FontSize="16"
  421. FontWeight="Bold"
  422. HorizontalAlignment="Center" />
  423. </StackPanel>
  424. </Border>
  425. </WrapPanel>
  426. </StackPanel>
  427. </Border>
  428. <!-- 测试结果列表 -->
  429. <Border Grid.Row="4"
  430. Background="White"
  431. Padding="10">
  432. <Grid>
  433. <Grid.RowDefinitions>
  434. <RowDefinition Height="Auto" />
  435. <RowDefinition Height="*" />
  436. </Grid.RowDefinitions>
  437. <StackPanel Grid.Row="0"
  438. Orientation="Horizontal">
  439. <TextBlock Style="{StaticResource TitleStyle}"
  440. Text="测试结果列表" />
  441. <TextBlock Margin="10,0,0,0"
  442. VerticalAlignment="Center"
  443. Foreground="#7F8C8D"
  444. Text="(显示最近20次结果)" />
  445. </StackPanel>
  446. <DataGrid x:Name="dgResults"
  447. Grid.Row="1"
  448. Style="{StaticResource DataGridStyle}"
  449. MaxHeight="250"
  450. AutoGenerateColumns="False"
  451. CanUserAddRows="False"
  452. IsReadOnly="True"
  453. ItemsSource="{Binding TestResults}">
  454. <DataGrid.Columns>
  455. <DataGridTextColumn Header="序号"
  456. Binding="{Binding Index}"
  457. MinWidth="50" />
  458. <DataGridTextColumn Header="状态"
  459. Binding="{Binding IsPhotoSuccess}"
  460. MinWidth="60" />
  461. <DataGridTextColumn Header="像素X"
  462. Binding="{Binding PixelX, StringFormat={}{0:F3}}"
  463. MinWidth="70" />
  464. <DataGridTextColumn Header="像素Y"
  465. Binding="{Binding PixelY, StringFormat={}{0:F3}}"
  466. MinWidth="70" />
  467. <DataGridTextColumn Header="角度"
  468. Binding="{Binding AngleU, StringFormat={}{0:F2}}"
  469. MinWidth="60" />
  470. <DataGridTextColumn Header="绝对X"
  471. Binding="{Binding TransformX, StringFormat={}{0:F3}}"
  472. MinWidth="70" />
  473. <DataGridTextColumn Header="绝对Y"
  474. Binding="{Binding TransformY, StringFormat={}{0:F3}}"
  475. MinWidth="70" />
  476. <DataGridTextColumn Header="循环时间"
  477. Binding="{Binding CycleTime, StringFormat={}{0:F2}s}"
  478. MinWidth="80" />
  479. <DataGridTextColumn Header="时间戳"
  480. Binding="{Binding Timestamp}"
  481. MinWidth="120" />
  482. </DataGrid.Columns>
  483. </DataGrid>
  484. </Grid>
  485. </Border>
  486. <!-- 导出和精度分析 -->
  487. <Border Grid.Row="5"
  488. Background="#ECF0F1"
  489. Padding="10">
  490. <StackPanel>
  491. <!-- 导出按钮 -->
  492. <WrapPanel HorizontalAlignment="Right">
  493. <Button Content="导出CSV"
  494. Background="#3498DB"
  495. Foreground="White"
  496. MinWidth="100"
  497. Command="{Binding ExportCSVCommand}" />
  498. <Button Content="生成报告"
  499. Background="#9B59B6"
  500. Foreground="White"
  501. MinWidth="100"
  502. Command="{Binding ExportReportCommand}" />
  503. <Button Content="清空数据"
  504. Background="#95A5A6"
  505. Foreground="White"
  506. MinWidth="100"
  507. Command="{Binding ClearDataCommand}" />
  508. </WrapPanel>
  509. <!-- 动态精度分析 -->
  510. <Border Margin="0 10 0 0"
  511. Background="#F8F9FA"
  512. Padding="10"
  513. CornerRadius="5">
  514. <StackPanel>
  515. <TextBlock Text="动态重复精度分析"
  516. FontWeight="Bold"
  517. Margin="0 0 0 5" />
  518. <Grid Margin="0 5 0 0">
  519. <Grid.ColumnDefinitions>
  520. <ColumnDefinition Width="*" />
  521. <ColumnDefinition Width="*" />
  522. </Grid.ColumnDefinitions>
  523. <StackPanel Grid.Column="0">
  524. <TextBlock>
  525. <Run Text="X方向精度: " />
  526. <Run Text="{Binding PrecisionResult.XPrecision, StringFormat={}{0:F3}mm}"
  527. d:Text="0.023mm"
  528. Foreground="#2C3E50"
  529. FontWeight="Bold" />
  530. </TextBlock>
  531. <TextBlock>
  532. <Run Text="Y方向精度: " />
  533. <Run Text="{Binding PrecisionResult.YPrecision, StringFormat={}{0:F3}mm}"
  534. d:Text="0.018mm"
  535. Foreground="#2C3E50"
  536. FontWeight="Bold" />
  537. </TextBlock>
  538. <TextBlock>
  539. <Run Text="角度精度: " />
  540. <Run Text="{Binding PrecisionResult.AnglePrecision, StringFormat={}{0:F2}°}"
  541. d:Text="0.12°"
  542. Foreground="#2C3E50"
  543. FontWeight="Bold" />
  544. </TextBlock>
  545. </StackPanel>
  546. <StackPanel Grid.Column="1">
  547. <TextBlock>
  548. <Run Text="3σ范围: " />
  549. <Run Text="{Binding PrecisionResult.OverallThreeSigmaRange, StringFormat={}±{0:F3}mm}"
  550. d:Text="±0.065mm"
  551. Foreground="#2C3E50"
  552. FontWeight="Bold" />
  553. </TextBlock>
  554. <TextBlock>
  555. <Run Text="CPK: " />
  556. <Run Text="{Binding PrecisionResult.OverallPrecision, StringFormat={}{0:F2}}"
  557. d:Text="1.85"
  558. Foreground="#2C3E50"
  559. FontWeight="Bold" />
  560. </TextBlock>
  561. <TextBlock>
  562. <Run Text="评级: " />
  563. <Run Text="{Binding ProcessRating}"
  564. d:Text="优秀"
  565. Foreground="#27AE60"
  566. FontWeight="Bold" />
  567. </TextBlock>
  568. </StackPanel>
  569. </Grid>
  570. <!-- 趋势图按钮 -->
  571. <Button Content="显示趋势图"
  572. Background="#E67E22"
  573. Foreground="White"
  574. HorizontalAlignment="Right"
  575. Margin="0 10 0 0"
  576. MinWidth="100"
  577. Command="{Binding ShowTrendChartCommand}" />
  578. </StackPanel>
  579. </Border>
  580. </StackPanel>
  581. </Border>
  582. </Grid>
  583. </Border>
  584. </ScrollViewer>
  585. <!-- 右侧图像和轨迹显示区域 -->
  586. <Grid Grid.Column="1">
  587. <Grid.RowDefinitions>
  588. <RowDefinition Height="*" />
  589. <RowDefinition Height="Auto" />
  590. <RowDefinition Height="Auto" />
  591. </Grid.RowDefinitions>
  592. <!-- 图像显示区域 -->
  593. <Border Background="#2C3E50">
  594. <Grid>
  595. <Grid.RowDefinitions>
  596. <RowDefinition Height="*" />
  597. <RowDefinition Height="Auto" />
  598. </Grid.RowDefinitions>
  599. <!-- VisionPro图像显示 -->
  600. <wf:WindowsFormsHost Grid.Row="0">
  601. <vp:CogRecordDisplay x:Name="display"
  602. Dock="Fill" />
  603. </wf:WindowsFormsHost>
  604. <!-- 图像信息栏 -->
  605. <!--<Border Grid.Row="1"
  606. Background="#34495E"
  607. Padding="10">
  608. <Grid>
  609. <Grid.ColumnDefinitions>
  610. <ColumnDefinition Width="*" />
  611. <ColumnDefinition Width="Auto" />
  612. </Grid.ColumnDefinitions>
  613. <StackPanel Grid.Column="0"
  614. Orientation="Horizontal">
  615. <TextBlock Text="图像信息: "
  616. Foreground="White" />
  617. <TextBlock Text="{Binding ImageInfo}"
  618. d:Text="第15次采集 - 检测成功"
  619. Foreground="#F1C40F"
  620. FontWeight="Bold" />
  621. </StackPanel>
  622. <StackPanel Grid.Column="1"
  623. Orientation="Horizontal">
  624. <TextBlock Text="检测时间: "
  625. Foreground="White" />
  626. <TextBlock Text="{Binding DetectTime, StringFormat={}{0:F3}s}"
  627. d:Text="0.123s"
  628. Foreground="#F1C40F"
  629. FontWeight="Bold"
  630. Width="60" />
  631. </StackPanel>
  632. </Grid>
  633. </Border>-->
  634. </Grid>
  635. </Border>
  636. <!-- 轨迹可视化区域 -->
  637. <!--<Border Grid.Row="1"
  638. Background="#ECF0F1"
  639. Padding="10"
  640. BorderBrush="#BDC3C7"
  641. BorderThickness="0 1 0 0">
  642. <StackPanel>
  643. <TextBlock Text="机器人轨迹可视化"
  644. FontWeight="Bold"
  645. Margin="0 0 0 5" />
  646. <Grid>
  647. <Grid.ColumnDefinitions>
  648. <ColumnDefinition Width="*" />
  649. <ColumnDefinition Width="Auto" />
  650. </Grid.ColumnDefinitions>
  651. -->
  652. <!-- 简化轨迹图 -->
  653. <!--
  654. <Canvas x:Name="trajectoryCanvas"
  655. Height="100"
  656. Background="White"
  657. Margin="0 5 0 0">
  658. -->
  659. <!-- A点标记 -->
  660. <!--
  661. <Ellipse Canvas.Left="50"
  662. Canvas.Top="50"
  663. Width="12"
  664. Height="12"
  665. Fill="#3498DB"
  666. Stroke="#2C3E50"
  667. StrokeThickness="1">
  668. <Ellipse.ToolTip>
  669. <ToolTip>
  670. <StackPanel>
  671. <TextBlock Text="A点 - 起始位置"
  672. FontWeight="Bold" />
  673. <TextBlock Text="{Binding PointA}" />
  674. </StackPanel>
  675. </ToolTip>
  676. </Ellipse.ToolTip>
  677. </Ellipse>
  678. <TextBlock Canvas.Left="45"
  679. Canvas.Top="65"
  680. Text="A"
  681. FontWeight="Bold"
  682. Foreground="#2C3E50" />
  683. -->
  684. <!-- B点标记 -->
  685. <!--
  686. <Ellipse Canvas.Left="200"
  687. Canvas.Top="50"
  688. Width="12"
  689. Height="12"
  690. Fill="#E74C3C"
  691. Stroke="#2C3E50"
  692. StrokeThickness="1">
  693. <Ellipse.ToolTip>
  694. <ToolTip>
  695. <StackPanel>
  696. <TextBlock Text="B点 - 拍照位置"
  697. FontWeight="Bold" />
  698. <TextBlock Text="{Binding PointB}" />
  699. </StackPanel>
  700. </ToolTip>
  701. </Ellipse.ToolTip>
  702. </Ellipse>
  703. <TextBlock Canvas.Left="195"
  704. Canvas.Top="65"
  705. Text="B"
  706. FontWeight="Bold"
  707. Foreground="#2C3E50" />
  708. -->
  709. <!-- 移动轨迹线 -->
  710. <!--
  711. <Line x:Name="trajectoryLine"
  712. X1="56"
  713. Y1="56"
  714. X2="194"
  715. Y2="56"
  716. Stroke="#7F8C8D"
  717. StrokeThickness="2"
  718. StrokeDashArray="5,3" />
  719. -->
  720. <!-- 当前位置标记 -->
  721. <!--
  722. <Ellipse x:Name="currentPositionMarker"
  723. Canvas.Left="125"
  724. Canvas.Top="50"
  725. Width="8"
  726. Height="8"
  727. Fill="#27AE60"
  728. Stroke="White"
  729. StrokeThickness="1"
  730. Visibility="Visible">
  731. <Ellipse.ToolTip>
  732. <ToolTip>
  733. <StackPanel>
  734. <TextBlock Text="当前位置"
  735. FontWeight="Bold" />
  736. <TextBlock Text="{Binding CurrentPosition}" />
  737. </StackPanel>
  738. </ToolTip>
  739. </Ellipse.ToolTip>
  740. </Ellipse>
  741. </Canvas>
  742. -->
  743. <!-- 轨迹控制 -->
  744. <!--
  745. <StackPanel Grid.Column="1"
  746. Orientation="Vertical"
  747. Margin="10 0 0 0">
  748. <CheckBox Content="显示轨迹"
  749. IsChecked="{Binding ShowTrajectory, Mode=TwoWay}"
  750. Margin="0 0 0 5" />
  751. <CheckBox Content="实时更新"
  752. IsChecked="{Binding RealTimeUpdate, Mode=TwoWay}"
  753. Margin="0 0 0 5" />
  754. <Button Content="重置视图"
  755. MinWidth="80"
  756. Height="25"
  757. Command="{Binding ResetTrajectoryViewCommand}" />
  758. </StackPanel>
  759. </Grid>
  760. </StackPanel>
  761. </Border>-->
  762. <!-- 底部按钮 -->
  763. <StackPanel Grid.Row="2"
  764. Orientation="Horizontal"
  765. VerticalAlignment="Center"
  766. HorizontalAlignment="Right"
  767. Margin="0 5 5 5">
  768. <Button Height="30"
  769. MinWidth="100"
  770. Content="{lex:Loc 确定}"
  771. materialDesign:ButtonAssist.CornerRadius="10"
  772. ToolTip="{lex:Loc 确定}"
  773. Command="{Binding ConfirmCommand}" />
  774. <Button Height="30"
  775. Margin="10,0"
  776. MinWidth="100"
  777. materialDesign:ButtonAssist.CornerRadius="10"
  778. ToolTip="{lex:Loc 取消}"
  779. Content="{lex:Loc 取消}"
  780. Command="{Binding CancelCommand}" />
  781. </StackPanel>
  782. </Grid>
  783. <!-- 消息提示 -->
  784. <materialDesign:Snackbar Grid.ColumnSpan="2"
  785. Opacity="0.8"
  786. HorizontalContentAlignment="Center"
  787. FontSize="14"
  788. MessageQueue="{Binding MessageQueue}"
  789. VerticalAlignment="Bottom" />
  790. </Grid>
  791. </UserControl>