VisionDynamicAccuracyAnalyzer.xaml 43 KB

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