VisionDynamicAccuracyAnalyzer.xaml 41 KB

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