VisionDynamicAccuracyAnalyzer.xaml 47 KB

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