Files
Shi.Ji e31d3560bb 添加 MX-PD-盘古 项目文件
将 MX-PD-盘古 - new 目录下的所有文件添加到主仓库
2026-05-18 11:43:09 +08:00

460 lines
30 KiB
XML

<UserControl x:Class="MainShell.Recipe.View.MarkTeachView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:behavior="clr-namespace:MainShell.Common.ControlAttribute"
mc:Ignorable="d"
d:DesignHeight="450"
d:DesignWidth="800">
<UserControl.Resources>
<SolidColorBrush x:Key="MarkTeachPageBackgroundBrush" Color="#F4F7FB"/>
<SolidColorBrush x:Key="MarkTeachCardBackgroundBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="MarkTeachCardBorderBrush" Color="#D6E0EA"/>
<SolidColorBrush x:Key="MarkTeachHeaderBackgroundBrush" Color="#EEF3F8"/>
<SolidColorBrush x:Key="MarkTeachHeaderForegroundBrush" Color="#2E5FA7"/>
<SolidColorBrush x:Key="MarkTeachBodyTextBrush" Color="#425466"/>
<SolidColorBrush x:Key="MarkTeachMutedTextBrush" Color="#6B7B8D"/>
<SolidColorBrush x:Key="MarkTeachNumberBrush" Color="#264B86"/>
<SolidColorBrush x:Key="MarkTeachTabSelectedBrush" Color="#E8F0FC"/>
<SolidColorBrush x:Key="MarkTeachTabHoverBrush" Color="#F4F8FE"/>
<SolidColorBrush x:Key="MarkTeachTabNormalBrush" Color="#D6DDE7"/>
<Style x:Key="MarkTeachSectionGroupStyle" TargetType="GroupBox">
<Setter Property="BorderBrush" Value="{StaticResource MarkTeachCardBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Background" Value="{StaticResource MarkTeachCardBackgroundBrush}"/>
<Setter Property="Margin" Value="0,0,0,12"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupBox">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Background="{StaticResource MarkTeachHeaderBackgroundBrush}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="0,0,0,1"
Padding="12,8">
<ContentPresenter ContentSource="Header" HorizontalAlignment="Center"/>
</Border>
<ContentPresenter Grid.Row="1"
Margin="12,12,12,12"
ContentSource="Content"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding}"
FontSize="15"
FontWeight="Bold"
Foreground="{StaticResource MarkTeachHeaderForegroundBrush}"/>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="MarkTeachFieldLabelStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource MarkTeachBodyTextBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Margin" Value="0,0,0,6"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="MarkTeachReadOnlyTextBoxStyle" TargetType="TextBox">
<Setter Property="Height" Value="34"/>
<Setter Property="Padding" Value="12,0"/>
<Setter Property="BorderBrush" Value="{StaticResource MarkTeachCardBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Background" Value="White"/>
<Setter Property="Foreground" Value="#2F3E4E"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<Style x:Key="MarkTeachInputTextBoxStyle" TargetType="TextBox" BasedOn="{StaticResource MarkTeachReadOnlyTextBoxStyle}">
<Setter Property="Height" Value="38"/>
<Setter Property="MinWidth" Value="96"/>
</Style>
<Style x:Key="MarkTeachPrimaryActionButtonStyle" TargetType="Button" BasedOn="{StaticResource MarkPrimaryActionButtonStyle}">
<Setter Property="Height" Value="38"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Style>
<Style x:Key="MarkTeachOutlineActionButtonStyle" TargetType="Button" BasedOn="{StaticResource MarkOutlineActionButtonStyle}">
<Setter Property="Height" Value="38"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Style>
<Style x:Key="MarkTeachNeutralActionButtonStyle" TargetType="Button" BasedOn="{StaticResource MarkNeutralActionButtonStyle}">
<Setter Property="Height" Value="38"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Style>
<Style x:Key="MarkTeachDangerOutlineButtonStyle" TargetType="Button" BasedOn="{StaticResource MarkDangerOutlineButtonStyle}">
<Setter Property="Height" Value="38"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Style>
<Style x:Key="MarkTeachHintTextStyle" TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Foreground" Value="{StaticResource MarkTeachBodyTextBrush}"/>
<Setter Property="LineHeight" Value="22"/>
</Style>
<Style x:Key="MarkTeachCaptionStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource MarkTeachMutedTextBrush}"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Margin" Value="0,0,0,10"/>
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
<Style x:Key="MarkTeachInlineCaptionStyle" TargetType="TextBlock" BasedOn="{StaticResource MarkTeachCaptionStyle}">
<Setter Property="Margin" Value="0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="MarkTeachStatTitleStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource MarkTeachMutedTextBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Style>
<Style x:Key="MarkTeachStatValueStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="24"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Foreground" Value="{StaticResource MarkTeachNumberBrush}"/>
</Style>
<Style x:Key="MarkTeachTabItemStyle" TargetType="TabItem">
<Setter Property="Padding" Value="34,12"/>
<Setter Property="Foreground" Value="{StaticResource MarkTeachBodyTextBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Background" Value="{StaticResource MarkTeachTabNormalBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource MarkTeachCardBorderBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Border x:Name="TabBorder"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="0,2,1,0"
Margin="0,0,1,0"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"
ContentSource="Header"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="TabBorder" Property="Background" Value="White"/>
<Setter TargetName="TabBorder" Property="BorderBrush" Value="{StaticResource MarkTeachHeaderForegroundBrush}"/>
<Setter Property="Foreground" Value="{StaticResource MarkTeachHeaderForegroundBrush}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="TabBorder" Property="Background" Value="{StaticResource MarkTeachTabHoverBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid Background="{StaticResource MarkTeachPageBackgroundBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.Row="1"
Margin="12"
Background="White"
BorderBrush="{StaticResource MarkTeachCardBorderBrush}"
BorderThickness="1">
<TabControl Background="Transparent"
BorderThickness="0"
Padding="0"
ItemContainerStyle="{StaticResource MarkTeachTabItemStyle}">
<TabItem Header="{DynamicResource MarkTeachTabTeach}">
<ScrollViewer VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<Grid Margin="20,16,20,12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<GroupBox Grid.Row="0"
Style="{StaticResource MarkTeachSectionGroupStyle}"
Header="{DynamicResource MakeModel}">
<StackPanel>
<TextBlock Text="{DynamicResource MarkTeachTeachSectionHint}"
Style="{StaticResource MarkTeachCaptionStyle}"/>
<WrapPanel Orientation="Horizontal">
<Button Style="{StaticResource MarkTeachPrimaryActionButtonStyle}"
Content="{DynamicResource VisionParSet}"
Command="{Binding VisionParSetCmd}"
Margin="0,0,10,0"/>
<Button Style="{StaticResource MarkTeachOutlineActionButtonStyle}"
Content="{DynamicResource MarkModel}"
Command="{Binding MarkModelCmd}"
Margin="0"/>
</WrapPanel>
</StackPanel>
</GroupBox>
<GroupBox Grid.Row="1"
Style="{StaticResource MarkTeachSectionGroupStyle}"
Header="{DynamicResource MarkTeachOperationsHeader}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WrapPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,12">
<Button Content="{DynamicResource AddMark}"
Style="{StaticResource MarkTeachPrimaryActionButtonStyle}"
Command="{Binding AddMarkCmd}"
Margin="0,0,10,10"/>
<Button Content="{DynamicResource DeleteMark}"
Style="{StaticResource MarkTeachDangerOutlineButtonStyle}"
Command="{Binding DeleteMarkCmd}"
Margin="0,0,10,10"/>
<Button Content="{DynamicResource TeachPos}"
Style="{StaticResource MarkTeachNeutralActionButtonStyle}"
Command="{Binding TeachMarkCmd}"
Margin="0,0,10,10"/>
<Button Content="{DynamicResource MoveToCurrentPos}"
Style="{StaticResource MarkTeachNeutralActionButtonStyle}"
Command="{Binding MoveToMarkCmd}"
Margin="0,0,10,10"/>
<CheckBox Content="{DynamicResource MarkTeachReferenceTeach}"
IsChecked="{Binding IsTeachPose, UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Center"
Margin="8,0,2,10"/>
</WrapPanel>
<DataGrid Grid.Row="1"
Margin="0"
MinHeight="180"
ItemsSource="{Binding MarkDatas}"
SelectedItem="{Binding SelectedMarkData}"
AutoGenerateColumns="False"
CanUserAddRows="False">
<DataGrid.Resources>
<Style x:Key="NumericOnlyEditingTextBoxStyle" TargetType="TextBox">
<Setter Property="behavior:ControlBehavior.IsNumericOnly" Value="True"/>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTemplateColumn Header="{DynamicResource InUse}" Width="58">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsChecked="{Binding IsEnabled, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="{DynamicResource MarkTeachBaseX}" Width="*" Binding="{Binding BasePos.X}" EditingElementStyle="{StaticResource NumericOnlyEditingTextBoxStyle}"/>
<DataGridTextColumn Header="{DynamicResource MarkTeachBaseY}" Width="*" Binding="{Binding BasePos.Y}" EditingElementStyle="{StaticResource NumericOnlyEditingTextBoxStyle}"/>
<DataGridTextColumn Header="{DynamicResource MarkTeachCameraX}" Width="*" Binding="{Binding CameraPos.X}" EditingElementStyle="{StaticResource NumericOnlyEditingTextBoxStyle}"/>
<DataGridTextColumn Header="{DynamicResource MarkTeachCameraY}" Width="*" Binding="{Binding CameraPos.Y}" EditingElementStyle="{StaticResource NumericOnlyEditingTextBoxStyle}"/>
<DataGridComboBoxColumn Width="2*" TextBinding="{Binding TemplateName}" Header="{DynamicResource MarkTeachTemplateName}">
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding DataContext.AvailableTemplates, RelativeSource={RelativeSource AncestorType=UserControl}}" />
<Setter Property="DisplayMemberPath" Value="TemplateName"/>
<Setter Property="SelectedIndex" Value="0"/>
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
</DataGridComboBoxColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</GroupBox>
<Border Grid.Row="2"
Padding="12,10"
Background="#F8FBFF"
BorderBrush="{StaticResource MarkTeachCardBorderBrush}"
BorderThickness="1">
<TextBlock Text="{DynamicResource MarkTeachTeachBottomHint}"
Style="{StaticResource MarkTeachHintTextStyle}"/>
</Border>
</Grid>
</ScrollViewer>
</TabItem>
<TabItem Header="{DynamicResource MarkTeachTabCoordinate}">
<ScrollViewer VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<Grid Margin="20,16,20,12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<GroupBox Grid.Row="0"
Style="{StaticResource MarkTeachSectionGroupStyle}"
Header="{DynamicResource MarkTeachCoordinateSourceHeader}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130"/>
<ColumnDefinition Width="14"/>
<ColumnDefinition Width="130"/>
<ColumnDefinition Width="14"/>
<ColumnDefinition Width="96"/>
<ColumnDefinition Width="14"/>
<ColumnDefinition Width="96"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0"
Grid.ColumnSpan="8"
Text="{DynamicResource MarkTeachCoordinateActionHint}"
Style="{StaticResource MarkTeachCaptionStyle}"/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="{DynamicResource MarkTeachPitchX}" Style="{StaticResource MarkTeachFieldLabelStyle}"/>
<TextBlock Grid.Row="1" Grid.Column="2" Text="{DynamicResource MarkTeachPitchY}" Style="{StaticResource MarkTeachFieldLabelStyle}"/>
<TextBlock Grid.Row="1" Grid.Column="4" Text="{DynamicResource MarkTeachRows}" Style="{StaticResource MarkTeachFieldLabelStyle}"/>
<TextBlock Grid.Row="1" Grid.Column="6" Text="{DynamicResource MarkTeachCols}" Style="{StaticResource MarkTeachFieldLabelStyle}"/>
<TextBox Grid.Row="2" Grid.Column="0"
Style="{StaticResource MarkTeachInputTextBoxStyle}"
Text="{Binding CoordinateGenerationState.PitchX, UpdateSourceTrigger=PropertyChanged}"
behavior:ControlBehavior.IsNumericOnly="True"/>
<TextBox Grid.Row="2" Grid.Column="2"
Style="{StaticResource MarkTeachInputTextBoxStyle}"
Text="{Binding CoordinateGenerationState.PitchY, UpdateSourceTrigger=PropertyChanged}"
behavior:ControlBehavior.IsNumericOnly="True"/>
<TextBox Grid.Row="2" Grid.Column="4"
Style="{StaticResource MarkTeachInputTextBoxStyle}"
Text="{Binding CoordinateGenerationState.Rows, UpdateSourceTrigger=PropertyChanged}"
behavior:ControlBehavior.IsNumericOnly="True"/>
<TextBox Grid.Row="2" Grid.Column="6"
Style="{StaticResource MarkTeachInputTextBoxStyle}"
Text="{Binding CoordinateGenerationState.Cols, UpdateSourceTrigger=PropertyChanged}"
behavior:ControlBehavior.IsNumericOnly="True"/>
<StackPanel Grid.Row="3"
Grid.ColumnSpan="8"
Margin="0,14,0,0">
<TextBlock Text="{DynamicResource MarkTeachCoordinateActionHeader}"
Style="{StaticResource MarkTeachFieldLabelStyle}"
Margin="0,0,0,8"/>
<WrapPanel HorizontalAlignment="Left"
Orientation="Horizontal">
<Button Content="{DynamicResource MarkTeachGenerateCoordinates}"
Style="{StaticResource MarkTeachPrimaryActionButtonStyle}"
Command="{Binding GenerateCoordinatesCmd}"
Margin="0,0,10,10"/>
<Button Content="{DynamicResource MarkTeachImportCoordinates}"
Style="{StaticResource MarkTeachOutlineActionButtonStyle}"
Command="{Binding ImportCoordinatesCmd}"
Margin="0,0,10,10"/>
<Button Content="{DynamicResource MarkCoordinatePreviewOpen}"
Style="{StaticResource MarkTeachOutlineActionButtonStyle}"
Command="{Binding ShowCoordinatePreviewCmd}"
Margin="0,0,10,10"/>
<Button Content="{DynamicResource MarkTeachClearCoordinates}"
Style="{StaticResource MarkTeachDangerOutlineButtonStyle}"
Command="{Binding ClearCoordinatesCmd}"
Margin="0,0,0,10"/>
</WrapPanel>
</StackPanel>
</Grid>
</GroupBox>
<GroupBox Grid.Row="1"
Style="{StaticResource MarkTeachSectionGroupStyle}"
Header="{DynamicResource MarkTeachCoordinateDetailsHeader}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0"
Margin="0,0,0,12"
Orientation="Horizontal"
HorizontalAlignment="Right">
<TextBlock Text="{DynamicResource MarkTeachCoordinateCurrentDisplayCount}"
Style="{StaticResource MarkTeachInlineCaptionStyle}"/>
<TextBlock Text="{Binding CoordinatePreviewPoints.Count}"
Foreground="{StaticResource MarkTeachHeaderForegroundBrush}"
FontWeight="Bold"
VerticalAlignment="Center"/>
</StackPanel>
<Grid Grid.Row="1">
<DataGrid Margin="0"
MinHeight="320"
ItemsSource="{Binding CoordinatePreviewPoints}"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserDeleteRows="False"
IsReadOnly="True">
<DataGrid.Columns>
<DataGridTextColumn Header="{DynamicResource MarkTeachCoordinateIndex}" Width="78" Binding="{Binding Index}"/>
<DataGridTextColumn Header="{DynamicResource MarkTeachCoordinatePointName}" Width="2*" Binding="{Binding PointName}"/>
<DataGridTextColumn Header="{DynamicResource MarkTeachCoordinateRowHeader}" Width="*" Binding="{Binding Row}"/>
<DataGridTextColumn Header="{DynamicResource MarkTeachCoordinateColHeader}" Width="*" Binding="{Binding Col}"/>
<DataGridTextColumn Header="{DynamicResource MarkTeachCoordinateTheoryX}" Width="*" Binding="{Binding TheoryX, StringFormat={}{0:0.####}}"/>
<DataGridTextColumn Header="{DynamicResource MarkTeachCoordinateTheoryY}" Width="*" Binding="{Binding TheoryY, StringFormat={}{0:0.####}}"/>
</DataGrid.Columns>
</DataGrid>
<TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{DynamicResource MarkTeachCoordinateEmptyHint}"
Foreground="#C1C8D2"
FontSize="18"
IsHitTestVisible="False">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding CoordinatePreviewPoints.Count}" Value="0">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</Grid>
</GroupBox>
</Grid>
</ScrollViewer>
</TabItem>
</TabControl>
</Border>
</Grid>
</UserControl>