VisionDynamicAccuracyAnalyzer.xaml 40 KB

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