HomeView.xaml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <UserControl x:Class="TeamAAS.Views.HomeView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:hc="https://handyorg.github.io/handycontrol"
  5. xmlns:log="clr-namespace:TeamAAS.Logging.Controls;assembly=TeamAAS.Global"
  6. xmlns:loc="clr-namespace:TeamAAS.Localization">
  7. <Grid Margin="16,12">
  8. <Grid.ColumnDefinitions>
  9. <ColumnDefinition Width="65*"/>
  10. <ColumnDefinition Width="420"/>
  11. </Grid.ColumnDefinitions>
  12. <!-- Left: Camera Display + Product Selection -->
  13. <Grid Grid.Column="0" Margin="0,0,8,0">
  14. <Grid.RowDefinitions>
  15. <RowDefinition Height="Auto"/>
  16. <RowDefinition Height="*"/>
  17. </Grid.RowDefinitions>
  18. <!-- Product Selection Bar -->
  19. <Border Grid.Row="0" Background="{DynamicResource SecondaryRegionBrush}"
  20. CornerRadius="8" Padding="12,8" Margin="0,0,0,8">
  21. <DockPanel VerticalAlignment="Center">
  22. <!-- 左侧:产品选择 -->
  23. <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
  24. <TextBlock Text="{loc:Translate '产品选择:'}" VerticalAlignment="Center"
  25. Foreground="{DynamicResource SecondaryTextBrush}" Margin="0,0,8,0"/>
  26. <ComboBox Width="180" ItemsSource="{Binding Products}" SelectedItem="{Binding SelectedProduct}"
  27. hc:InfoElement.Placeholder="{loc:Translate '选择产品'}"/>
  28. <Button Content="{loc:Translate '加载'}" Command="{Binding LoadProductCommand}"
  29. Style="{StaticResource ButtonPrimary}" Margin="8,0,0,0" Padding="16,4"/>
  30. <Button Content="{loc:Translate '▶ 运行'}" Command="{Binding RunCommand}" IsEnabled="{Binding CanRun}"
  31. Margin="12,0,0,0" Padding="16,4" Cursor="Hand"
  32. Background="#4CAF50" BorderThickness="0" Foreground="White"
  33. ToolTip="{loc:Translate '循环运行当前产品的所有流程'}"/>
  34. <Button Content="{loc:Translate '■ 停止'}" Command="{Binding StopCommand}" IsEnabled="{Binding CanStop}"
  35. Margin="8,0,0,0" Padding="16,4" Cursor="Hand"
  36. Background="#F44336" BorderThickness="0" Foreground="White"
  37. ToolTip="{loc:Translate '停止当前产品的所有流程'}"/>
  38. <TextBlock VerticalAlignment="Center" Margin="16,0,0,0"
  39. Foreground="{DynamicResource SecondaryTextBrush}">
  40. <Run Text="{loc:Translate '当前运行产品: '}"/><Run Text="{Binding RunProductName, Mode=OneWay}" FontWeight="Bold"/>
  41. </TextBlock>
  42. </StackPanel>
  43. </DockPanel>
  44. </Border>
  45. <!-- 视觉画面区:当前引擎的多画面视图(画面框数量/布局在设置里配置,双击框放大) -->
  46. <Border Grid.Row="1" Background="{DynamicResource SecondaryRegionBrush}" CornerRadius="8">
  47. <Grid>
  48. <TextBlock Text="{loc:Translate '相机画面显示区'}" HorizontalAlignment="Center" VerticalAlignment="Center"
  49. FontSize="24" Foreground="{DynamicResource SecondaryTextBrush}">
  50. <TextBlock.Style>
  51. <Style TargetType="TextBlock">
  52. <Setter Property="Visibility" Value="Collapsed"/>
  53. <Style.Triggers>
  54. <DataTrigger Binding="{Binding EngineMainView}" Value="{x:Null}">
  55. <Setter Property="Visibility" Value="Visible"/>
  56. </DataTrigger>
  57. </Style.Triggers>
  58. </Style>
  59. </TextBlock.Style>
  60. </TextBlock>
  61. <ContentControl Content="{Binding EngineMainView}" Focusable="False"/>
  62. </Grid>
  63. </Border>
  64. </Grid>
  65. <!-- Right: Stats + Logs -->
  66. <Grid Grid.Column="1" Margin="8,0,0,0">
  67. <Grid.RowDefinitions>
  68. <RowDefinition Height="Auto"/>
  69. <RowDefinition Height="*"/>
  70. </Grid.RowDefinitions>
  71. <!-- Production Stats -->
  72. <Border Grid.Row="0" Background="{DynamicResource RegionBrush}" CornerRadius="8"
  73. Padding="16,12" Margin="0,0,0,8">
  74. <Grid>
  75. <Grid.RowDefinitions>
  76. <RowDefinition Height="Auto"/>
  77. <RowDefinition Height="Auto"/>
  78. <RowDefinition Height="Auto"/>
  79. </Grid.RowDefinitions>
  80. <Grid Grid.Row="0">
  81. <Grid.ColumnDefinitions>
  82. <ColumnDefinition Width="*"/>
  83. <ColumnDefinition Width="*"/>
  84. </Grid.ColumnDefinitions>
  85. <StackPanel Grid.Column="0" HorizontalAlignment="Center">
  86. <TextBlock Text="{loc:Translate '累计运行'}" Foreground="{DynamicResource SecondaryTextBrush}" FontSize="12"/>
  87. <TextBlock Text="{Binding Stats.TotalCount}" FontSize="28" FontWeight="Bold" Foreground="{DynamicResource PrimaryTextBrush}"/>
  88. </StackPanel>
  89. <StackPanel Grid.Column="1" HorizontalAlignment="Center">
  90. <TextBlock Text="{loc:Translate '成功次数'}" Foreground="{DynamicResource SecondaryTextBrush}" FontSize="12"/>
  91. <TextBlock Text="{Binding Stats.OkCount}" FontSize="28" FontWeight="Bold" Foreground="{DynamicResource PrimaryBrush}"/>
  92. </StackPanel>
  93. </Grid>
  94. <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,8,0,0">
  95. <TextBlock Text="UPH: " Foreground="{DynamicResource SecondaryTextBrush}" FontSize="13"/>
  96. <TextBlock Text="{Binding Stats.UphText}" FontSize="13" FontWeight="Bold" Foreground="{DynamicResource PrimaryTextBrush}"/>
  97. <TextBlock Text=" | CT: " Foreground="{DynamicResource SecondaryTextBrush}" FontSize="13"/>
  98. <TextBlock Text="{Binding Stats.CtText}" FontSize="13" FontWeight="Bold" Foreground="{DynamicResource PrimaryTextBrush}"/>
  99. </StackPanel>
  100. <Button Grid.Row="2" Content="{loc:Translate '清零'}" HorizontalAlignment="Center" Margin="0,8,0,0"
  101. Padding="20,4" FontSize="12" Command="{Binding ResetStatisticsCommand}"/>
  102. </Grid>
  103. </Border>
  104. <!-- Running Logs -->
  105. <Border Grid.Row="1" Background="{DynamicResource RegionBrush}" CornerRadius="8" Padding="12">
  106. <log:LogView MaxEntries="500"/>
  107. </Border>
  108. </Grid>
  109. </Grid>
  110. </UserControl>