VisionDynamicAccuracyAnalyzer.xaml 42 KB

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