VisionDynamicAccuracyAnalyzer.xaml 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852
  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="False" />
  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, Mode=TwoWay}"
  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. <Grid Margin="0 10 0 0">
  241. <Grid.ColumnDefinitions>
  242. <ColumnDefinition Width="*" />
  243. <ColumnDefinition Width="*" />
  244. <ColumnDefinition Width="*" />
  245. <ColumnDefinition Width="*" />
  246. </Grid.ColumnDefinitions>
  247. <!-- 重复次数 -->
  248. <StackPanel Grid.Column="0">
  249. <TextBlock Text="重复次数:" />
  250. <mah:NumericUpDown Value="{Binding RepeatCount, Mode=TwoWay}"
  251. Minimum="1"
  252. Maximum="1000"
  253. d:Value="50"
  254. TextAlignment="Center"
  255. HorizontalContentAlignment="Center"
  256. HorizontalAlignment="Stretch"
  257. IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}" />
  258. </StackPanel>
  259. <!-- 移动速度 -->
  260. <StackPanel Grid.Column="1"
  261. Margin="10,0,0,0">
  262. <TextBlock Text="移动速度(%):" />
  263. <mah:NumericUpDown Value="{Binding MoveSpeed, Mode=TwoWay}"
  264. Minimum="1"
  265. Maximum="100"
  266. d:Value="50"
  267. TextAlignment="Center"
  268. HorizontalContentAlignment="Center"
  269. HorizontalAlignment="Stretch"
  270. IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}" />
  271. </StackPanel>
  272. <!-- A点延时 -->
  273. <StackPanel Grid.Column="2"
  274. Margin="10,0,0,0">
  275. <TextBlock Text="A点延时(ms):"/>
  276. <mah:NumericUpDown Value="{Binding ADelay, Mode=TwoWay}"
  277. Minimum="50"
  278. d:Value="300"
  279. TextAlignment="Center"
  280. HorizontalContentAlignment="Center"
  281. HorizontalAlignment="Stretch"
  282. IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}" />
  283. </StackPanel>
  284. <!-- B点延时 -->
  285. <StackPanel Grid.Column="3"
  286. Margin="10,0,0,0">
  287. <TextBlock Text="B点延时(ms):" />
  288. <mah:NumericUpDown Value="{Binding BDelay, Mode=TwoWay}"
  289. Minimum="50"
  290. d:Value="500"
  291. TextAlignment="Center"
  292. HorizontalContentAlignment="Center"
  293. HorizontalAlignment="Stretch"
  294. IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}" />
  295. </StackPanel>
  296. </Grid>
  297. </StackPanel>
  298. </Border>
  299. <!-- 测试控制区域 -->
  300. <Border Grid.Row="2"
  301. Background="#ECF0F1"
  302. Padding="10">
  303. <StackPanel>
  304. <TextBlock Style="{StaticResource TitleStyle}"
  305. Text="测试控制" />
  306. <WrapPanel HorizontalAlignment="Center"
  307. Margin="0 10 0 0">
  308. <CheckBox Content="启用拍照"
  309. Foreground="Black"
  310. Style="{StaticResource MaterialDesignCheckBox}"
  311. VerticalAlignment="Center"
  312. IsChecked="{Binding IsTakePhoto}"
  313. Margin="10,0"
  314. FontSize="15" />
  315. <Button Content="单次测试"
  316. Background="#3498DB"
  317. Foreground="White"
  318. MinWidth="100"
  319. Height="35"
  320. FontWeight="Bold"
  321. Command="{Binding SingleTestCommand}"
  322. IsEnabled="{Binding IsRunning, Converter={StaticResource InvertBooleanConverter}}" />
  323. <Button Content="连续测试"
  324. Background="#27AE60"
  325. Foreground="White"
  326. MinWidth="100"
  327. Height="35"
  328. FontWeight="Bold"
  329. Command="{Binding StartTestCommand}" />
  330. <Button Content="停止"
  331. Background="#E74C3C"
  332. Foreground="White"
  333. MinWidth="100"
  334. Height="35"
  335. Command="{Binding StopTestCommand}" />
  336. <Button Content="暂停"
  337. Background="#F39C12"
  338. Foreground="White"
  339. MinWidth="100"
  340. Height="35"
  341. Command="{Binding PauseTestCommand}" />
  342. </WrapPanel>
  343. </StackPanel>
  344. </Border>
  345. <!-- 进度显示 -->
  346. <Border Grid.Row="3"
  347. Background="White"
  348. Padding="10">
  349. <StackPanel>
  350. <TextBlock Style="{StaticResource TitleStyle}"
  351. Text="测试进度" />
  352. <Grid Margin="0 10 0 0">
  353. <Grid.RowDefinitions>
  354. <RowDefinition Height="Auto" />
  355. <RowDefinition Height="Auto" />
  356. </Grid.RowDefinitions>
  357. <ProgressBar Grid.Row="0"
  358. Height="25"
  359. Margin="5"
  360. Minimum="0"
  361. Maximum="{Binding RepeatCount}"
  362. Value="{Binding CurrentProgress}"
  363. IsEnabled="False"
  364. d:Maximum="100"
  365. d:Value="50" />
  366. <TextBlock Grid.Row="1"
  367. HorizontalAlignment="Center"
  368. FontSize="12"
  369. Foreground="#7F8C8D"
  370. d:Text="等待开始..."
  371. Text="{Binding Message}" />
  372. </Grid>
  373. <!-- 实时统计信息 -->
  374. <WrapPanel Margin="0 15 0 0"
  375. HorizontalAlignment="Center">
  376. <Border Background="#3498DB"
  377. Padding="10 5"
  378. Margin="5"
  379. CornerRadius="3">
  380. <StackPanel>
  381. <TextBlock Text="当前循环"
  382. Foreground="White"
  383. FontSize="11" />
  384. <TextBlock Text="{Binding CurrentProgress}"
  385. d:Text="1"
  386. Foreground="White"
  387. FontSize="16"
  388. FontWeight="Bold"
  389. HorizontalAlignment="Center" />
  390. </StackPanel>
  391. </Border>
  392. <Border Background="#2ECC71"
  393. Padding="10 5"
  394. Margin="5"
  395. CornerRadius="3">
  396. <StackPanel>
  397. <TextBlock Text="成功率"
  398. Foreground="White"
  399. FontSize="11" />
  400. <TextBlock Text="{Binding SuccessRate, StringFormat={}{0:F1}%}"
  401. d:Text="100%"
  402. Foreground="White"
  403. FontSize="16"
  404. FontWeight="Bold"
  405. HorizontalAlignment="Center" />
  406. </StackPanel>
  407. </Border>
  408. <Border Background="#9B59B6"
  409. Padding="10 5"
  410. Margin="5"
  411. CornerRadius="3">
  412. <StackPanel>
  413. <TextBlock Text="往返时间"
  414. Foreground="White"
  415. FontSize="11" />
  416. <TextBlock Text="{Binding CycleTime, StringFormat={}{0:F2}s}"
  417. d:Text="2.34s"
  418. Foreground="White"
  419. FontSize="16"
  420. FontWeight="Bold"
  421. HorizontalAlignment="Center" />
  422. </StackPanel>
  423. </Border>
  424. </WrapPanel>
  425. </StackPanel>
  426. </Border>
  427. <!-- 测试结果列表 -->
  428. <Border Grid.Row="4"
  429. Background="White"
  430. Padding="10">
  431. <Grid>
  432. <Grid.RowDefinitions>
  433. <RowDefinition Height="Auto" />
  434. <RowDefinition Height="*" />
  435. </Grid.RowDefinitions>
  436. <StackPanel Grid.Row="0"
  437. Orientation="Horizontal">
  438. <TextBlock Style="{StaticResource TitleStyle}"
  439. Text="测试结果列表" />
  440. <TextBlock Margin="10,0,0,0"
  441. VerticalAlignment="Center"
  442. Foreground="#7F8C8D"
  443. Text="(显示最近20次结果)" />
  444. </StackPanel>
  445. <DataGrid x:Name="dgResults"
  446. Grid.Row="1"
  447. Style="{StaticResource DataGridStyle}"
  448. MaxHeight="250"
  449. AutoGenerateColumns="False"
  450. CanUserAddRows="False"
  451. IsReadOnly="True"
  452. ItemsSource="{Binding TestResults}">
  453. <DataGrid.Columns>
  454. <DataGridTextColumn Header="序号"
  455. Binding="{Binding Index}"
  456. MinWidth="50" />
  457. <DataGridTextColumn Header="状态"
  458. Binding="{Binding IsPhotoSuccess}"
  459. MinWidth="60" />
  460. <DataGridTextColumn Header="像素X"
  461. Binding="{Binding PixelX, StringFormat={}{0:F3}}"
  462. MinWidth="70" />
  463. <DataGridTextColumn Header="像素Y"
  464. Binding="{Binding PixelY, StringFormat={}{0:F3}}"
  465. MinWidth="70" />
  466. <DataGridTextColumn Header="角度"
  467. Binding="{Binding AngleU, StringFormat={}{0:F2}}"
  468. MinWidth="60" />
  469. <DataGridTextColumn Header="绝对X"
  470. Binding="{Binding TransformX, StringFormat={}{0:F3}}"
  471. MinWidth="70" />
  472. <DataGridTextColumn Header="绝对Y"
  473. Binding="{Binding TransformY, StringFormat={}{0:F3}}"
  474. MinWidth="70" />
  475. <DataGridTextColumn Header="循环时间"
  476. Binding="{Binding CycleTime, StringFormat={}{0:F2}s}"
  477. MinWidth="80" />
  478. <DataGridTextColumn Header="时间戳"
  479. Binding="{Binding Timestamp}"
  480. MinWidth="120" />
  481. </DataGrid.Columns>
  482. </DataGrid>
  483. </Grid>
  484. </Border>
  485. <!-- 导出和精度分析 -->
  486. <Border Grid.Row="5"
  487. Background="#ECF0F1"
  488. Padding="10">
  489. <StackPanel>
  490. <!-- 导出按钮 -->
  491. <WrapPanel HorizontalAlignment="Right">
  492. <Button Content="导出CSV"
  493. Background="#3498DB"
  494. Foreground="White"
  495. MinWidth="100"
  496. Command="{Binding ExportCSVCommand}" />
  497. <Button Content="生成报告"
  498. Background="#9B59B6"
  499. Foreground="White"
  500. MinWidth="100"
  501. Command="{Binding ExportReportCommand}" />
  502. <Button Content="清空数据"
  503. Background="#95A5A6"
  504. Foreground="White"
  505. MinWidth="100"
  506. Command="{Binding ClearDataCommand}" />
  507. </WrapPanel>
  508. <!-- 动态精度分析 -->
  509. <Border Margin="0 10 0 0"
  510. Background="#F8F9FA"
  511. Padding="10"
  512. CornerRadius="5">
  513. <StackPanel>
  514. <TextBlock Text="动态重复精度分析"
  515. FontWeight="Bold"
  516. Margin="0 0 0 5" />
  517. <Grid Margin="0 5 0 0">
  518. <Grid.ColumnDefinitions>
  519. <ColumnDefinition Width="*" />
  520. <ColumnDefinition Width="*" />
  521. </Grid.ColumnDefinitions>
  522. <StackPanel Grid.Column="0">
  523. <TextBlock>
  524. <Run Text="X方向精度: " />
  525. <Run Text="{Binding PrecisionResult.XPrecision, StringFormat={}{0:F3}mm}"
  526. d:Text="0.023mm"
  527. Foreground="#2C3E50"
  528. FontWeight="Bold" />
  529. </TextBlock>
  530. <TextBlock>
  531. <Run Text="Y方向精度: " />
  532. <Run Text="{Binding PrecisionResult.YPrecision, StringFormat={}{0:F3}mm}"
  533. d:Text="0.018mm"
  534. Foreground="#2C3E50"
  535. FontWeight="Bold" />
  536. </TextBlock>
  537. <TextBlock>
  538. <Run Text="角度精度: " />
  539. <Run Text="{Binding PrecisionResult.AnglePrecision, StringFormat={}{0:F2}°}"
  540. d:Text="0.12°"
  541. Foreground="#2C3E50"
  542. FontWeight="Bold" />
  543. </TextBlock>
  544. </StackPanel>
  545. <StackPanel Grid.Column="1">
  546. <TextBlock>
  547. <Run Text="3σ范围: " />
  548. <Run Text="{Binding PrecisionResult.OverallThreeSigmaRange, StringFormat={}±{0:F3}mm}"
  549. d:Text="±0.065mm"
  550. Foreground="#2C3E50"
  551. FontWeight="Bold" />
  552. </TextBlock>
  553. <TextBlock>
  554. <Run Text="CPK: " />
  555. <Run Text="{Binding PrecisionResult.OverallPrecision, StringFormat={}{0:F2}}"
  556. d:Text="1.85"
  557. Foreground="#2C3E50"
  558. FontWeight="Bold" />
  559. </TextBlock>
  560. <TextBlock>
  561. <Run Text="评级: " />
  562. <Run Text="{Binding ProcessRating}"
  563. d:Text="优秀"
  564. Foreground="#27AE60"
  565. FontWeight="Bold" />
  566. </TextBlock>
  567. </StackPanel>
  568. </Grid>
  569. <!-- 趋势图按钮 -->
  570. <Button Content="显示趋势图"
  571. Background="#E67E22"
  572. Foreground="White"
  573. HorizontalAlignment="Right"
  574. Margin="0 10 0 0"
  575. MinWidth="100"
  576. Command="{Binding ShowTrendChartCommand}" />
  577. </StackPanel>
  578. </Border>
  579. </StackPanel>
  580. </Border>
  581. </Grid>
  582. </Border>
  583. </ScrollViewer>
  584. <!-- 右侧图像和轨迹显示区域 -->
  585. <Grid Grid.Column="1">
  586. <Grid.RowDefinitions>
  587. <RowDefinition Height="*" />
  588. <RowDefinition Height="Auto" />
  589. <RowDefinition Height="Auto" />
  590. </Grid.RowDefinitions>
  591. <!-- 图像显示区域 -->
  592. <Border Background="#2C3E50">
  593. <Grid>
  594. <Grid.RowDefinitions>
  595. <RowDefinition Height="*" />
  596. <RowDefinition Height="Auto" />
  597. </Grid.RowDefinitions>
  598. <!-- VisionPro图像显示 -->
  599. <wf:WindowsFormsHost Grid.Row="0">
  600. <vp:CogRecordDisplay x:Name="display"
  601. Dock="Fill" />
  602. </wf:WindowsFormsHost>
  603. <!-- 图像信息栏 -->
  604. <!--<Border Grid.Row="1"
  605. Background="#34495E"
  606. Padding="10">
  607. <Grid>
  608. <Grid.ColumnDefinitions>
  609. <ColumnDefinition Width="*" />
  610. <ColumnDefinition Width="Auto" />
  611. </Grid.ColumnDefinitions>
  612. <StackPanel Grid.Column="0"
  613. Orientation="Horizontal">
  614. <TextBlock Text="图像信息: "
  615. Foreground="White" />
  616. <TextBlock Text="{Binding ImageInfo}"
  617. d:Text="第15次采集 - 检测成功"
  618. Foreground="#F1C40F"
  619. FontWeight="Bold" />
  620. </StackPanel>
  621. <StackPanel Grid.Column="1"
  622. Orientation="Horizontal">
  623. <TextBlock Text="检测时间: "
  624. Foreground="White" />
  625. <TextBlock Text="{Binding DetectTime, StringFormat={}{0:F3}s}"
  626. d:Text="0.123s"
  627. Foreground="#F1C40F"
  628. FontWeight="Bold"
  629. Width="60" />
  630. </StackPanel>
  631. </Grid>
  632. </Border>-->
  633. </Grid>
  634. </Border>
  635. <!-- 轨迹可视化区域 -->
  636. <!--<Border Grid.Row="1"
  637. Background="#ECF0F1"
  638. Padding="10"
  639. BorderBrush="#BDC3C7"
  640. BorderThickness="0 1 0 0">
  641. <StackPanel>
  642. <TextBlock Text="机器人轨迹可视化"
  643. FontWeight="Bold"
  644. Margin="0 0 0 5" />
  645. <Grid>
  646. <Grid.ColumnDefinitions>
  647. <ColumnDefinition Width="*" />
  648. <ColumnDefinition Width="Auto" />
  649. </Grid.ColumnDefinitions>
  650. -->
  651. <!-- 简化轨迹图 -->
  652. <!--
  653. <Canvas x:Name="trajectoryCanvas"
  654. Height="100"
  655. Background="White"
  656. Margin="0 5 0 0">
  657. -->
  658. <!-- A点标记 -->
  659. <!--
  660. <Ellipse Canvas.Left="50"
  661. Canvas.Top="50"
  662. Width="12"
  663. Height="12"
  664. Fill="#3498DB"
  665. Stroke="#2C3E50"
  666. StrokeThickness="1">
  667. <Ellipse.ToolTip>
  668. <ToolTip>
  669. <StackPanel>
  670. <TextBlock Text="A点 - 起始位置"
  671. FontWeight="Bold" />
  672. <TextBlock Text="{Binding PointA}" />
  673. </StackPanel>
  674. </ToolTip>
  675. </Ellipse.ToolTip>
  676. </Ellipse>
  677. <TextBlock Canvas.Left="45"
  678. Canvas.Top="65"
  679. Text="A"
  680. FontWeight="Bold"
  681. Foreground="#2C3E50" />
  682. -->
  683. <!-- B点标记 -->
  684. <!--
  685. <Ellipse Canvas.Left="200"
  686. Canvas.Top="50"
  687. Width="12"
  688. Height="12"
  689. Fill="#E74C3C"
  690. Stroke="#2C3E50"
  691. StrokeThickness="1">
  692. <Ellipse.ToolTip>
  693. <ToolTip>
  694. <StackPanel>
  695. <TextBlock Text="B点 - 拍照位置"
  696. FontWeight="Bold" />
  697. <TextBlock Text="{Binding PointB}" />
  698. </StackPanel>
  699. </ToolTip>
  700. </Ellipse.ToolTip>
  701. </Ellipse>
  702. <TextBlock Canvas.Left="195"
  703. Canvas.Top="65"
  704. Text="B"
  705. FontWeight="Bold"
  706. Foreground="#2C3E50" />
  707. -->
  708. <!-- 移动轨迹线 -->
  709. <!--
  710. <Line x:Name="trajectoryLine"
  711. X1="56"
  712. Y1="56"
  713. X2="194"
  714. Y2="56"
  715. Stroke="#7F8C8D"
  716. StrokeThickness="2"
  717. StrokeDashArray="5,3" />
  718. -->
  719. <!-- 当前位置标记 -->
  720. <!--
  721. <Ellipse x:Name="currentPositionMarker"
  722. Canvas.Left="125"
  723. Canvas.Top="50"
  724. Width="8"
  725. Height="8"
  726. Fill="#27AE60"
  727. Stroke="White"
  728. StrokeThickness="1"
  729. Visibility="Visible">
  730. <Ellipse.ToolTip>
  731. <ToolTip>
  732. <StackPanel>
  733. <TextBlock Text="当前位置"
  734. FontWeight="Bold" />
  735. <TextBlock Text="{Binding CurrentPosition}" />
  736. </StackPanel>
  737. </ToolTip>
  738. </Ellipse.ToolTip>
  739. </Ellipse>
  740. </Canvas>
  741. -->
  742. <!-- 轨迹控制 -->
  743. <!--
  744. <StackPanel Grid.Column="1"
  745. Orientation="Vertical"
  746. Margin="10 0 0 0">
  747. <CheckBox Content="显示轨迹"
  748. IsChecked="{Binding ShowTrajectory, Mode=TwoWay}"
  749. Margin="0 0 0 5" />
  750. <CheckBox Content="实时更新"
  751. IsChecked="{Binding RealTimeUpdate, Mode=TwoWay}"
  752. Margin="0 0 0 5" />
  753. <Button Content="重置视图"
  754. MinWidth="80"
  755. Height="25"
  756. Command="{Binding ResetTrajectoryViewCommand}" />
  757. </StackPanel>
  758. </Grid>
  759. </StackPanel>
  760. </Border>-->
  761. <!-- 底部按钮 -->
  762. <StackPanel Grid.Row="2"
  763. Orientation="Horizontal"
  764. VerticalAlignment="Center"
  765. HorizontalAlignment="Right"
  766. Margin="0 5 5 5">
  767. <Button Height="30"
  768. MinWidth="100"
  769. Content="{lex:Loc 确定}"
  770. materialDesign:ButtonAssist.CornerRadius="10"
  771. ToolTip="{lex:Loc 确定}"
  772. Command="{Binding ConfirmCommand}" />
  773. <Button Height="30"
  774. Margin="10,0"
  775. MinWidth="100"
  776. materialDesign:ButtonAssist.CornerRadius="10"
  777. ToolTip="{lex:Loc 取消}"
  778. Content="{lex:Loc 取消}"
  779. Command="{Binding CancelCommand}" />
  780. </StackPanel>
  781. </Grid>
  782. <!-- 消息提示 -->
  783. <materialDesign:Snackbar Grid.ColumnSpan="2"
  784. Opacity="0.8"
  785. HorizontalContentAlignment="Center"
  786. FontSize="14"
  787. MessageQueue="{Binding MessageQueue}"
  788. VerticalAlignment="Bottom" />
  789. </Grid>
  790. </UserControl>