#初步CNC编辑界面

This commit is contained in:
zhengxuan.zhang
2026-04-21 13:19:53 +08:00
parent b966e0b8e8
commit 8beed66ef0
3 changed files with 43 additions and 81 deletions
@@ -11,25 +11,23 @@
<UserControl.Resources>
<SolidColorBrush x:Key="PanelBg" Color="White" />
<SolidColorBrush x:Key="PanelBorder" Color="#cdcbcb" />
<SolidColorBrush x:Key="PanelBorder" Color="#CDCBCB" />
<SolidColorBrush x:Key="SeparatorBrush" Color="#E0E0E0" />
<SolidColorBrush x:Key="AccentBlue" Color="#E3F0FF" />
<FontFamily x:Key="CsdFont">Microsoft YaHei UI</FontFamily>
<!-- 节点项样式 -->
<Style x:Key="PipelineNodeItemStyle" TargetType="ListBoxItem">
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="0" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
<!-- 工具栏按钮样式 -->
<Style x:Key="ToolbarBtn" TargetType="Button">
<Setter Property="Width" Value="28" />
<Setter Property="Width" Value="52" />
<Setter Property="Height" Value="28" />
<Setter Property="Margin" Value="2,0" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="#cdcbcb" />
<Setter Property="BorderBrush" Value="#CDCBCB" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="FontFamily" Value="Microsoft YaHei UI" />
<Setter Property="FontSize" Value="11" />
@@ -44,21 +42,13 @@
CornerRadius="4">
<Grid>
<Grid.RowDefinitions>
<!-- Row 0: 工具栏 -->
<RowDefinition Height="Auto" />
<!-- Row 2: 流水线节点列表 -->
<RowDefinition Height="2*" MinHeight="180" />
<!-- Row 3: 分隔线 -->
<RowDefinition Height="Auto" />
<!-- Row 4: 参数面板 -->
<RowDefinition Height="2*" MinHeight="80" />
<!-- Row 5: 状态栏 -->
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- 标题栏:流水线名称 + 设备选择 -->
<!-- 工具栏 -->
<Border
Grid.Row="0"
Padding="6,4"
@@ -76,51 +66,23 @@
Command="{Binding SavePipelineCommand}"
Content="保存"
Style="{StaticResource ToolbarBtn}"
ToolTip="保存流水线" />
ToolTip="保存当前检测模块流水线" />
<Button
Width="43"
Width="60"
Command="{Binding SaveAsPipelineCommand}"
Content="另存为"
Style="{StaticResource ToolbarBtn}"
ToolTip="另存为" />
ToolTip="导出当前检测模块流水线" />
<Button
Width="43"
Width="52"
Command="{Binding LoadPipelineCommand}"
Content="加载"
Style="{StaticResource ToolbarBtn}"
ToolTip="加载流水线" />
<!--
<Button
Width="64"
Command="{Binding LoadImageCommand}"
Content="加载图像"
Style="{StaticResource ToolbarBtn}"
ToolTip="加载输入图像" />
<Button
Command="{Binding ExecutePipelineCommand}"
Content="▶"
Style="{StaticResource ToolbarBtn}"
ToolTip="执行流水线" />
<Button
Command="{Binding CancelExecutionCommand}"
Content="■"
Style="{StaticResource ToolbarBtn}"
ToolTip="取消执行" />
<Button
Command="{Binding DeletePipelineCommand}"
Content="🗑"
Style="{StaticResource ToolbarBtn}"
ToolTip="工具箱" />
-->
ToolTip="流水线模板加载到当前检测模块" />
</StackPanel>
</Grid>
</Border>
<!-- 流水线节点列表(拖拽目标) -->
<ListBox
x:Name="PipelineListBox"
Grid.Row="1"
@@ -139,7 +101,6 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- 连接线列:上半段 + 下半段 -->
<Line
x:Name="TopLine"
HorizontalAlignment="Center"
@@ -160,7 +121,6 @@
Y1="0"
Y2="14" />
<!-- 算子图标 -->
<Border
Grid.Column="0"
Width="28"
@@ -178,7 +138,6 @@
Text="{Binding IconPath}" />
</Border>
<!-- 算子名称 -->
<TextBlock
Grid.Column="1"
Margin="6,0,0,0"
@@ -187,7 +146,6 @@
FontSize="12"
Text="{Binding DisplayName}" />
<!-- 操作按钮:上移 / 下移 / 删除(悬停显示) -->
<StackPanel
x:Name="NodeActions"
Grid.Column="2"
@@ -200,11 +158,11 @@
Height="22"
Margin="1,0"
Background="Transparent"
BorderBrush="#cdcbcb"
BorderBrush="#CDCBCB"
BorderThickness="1"
Command="{Binding DataContext.MoveNodeUpCommand, RelativeSource={RelativeSource AncestorType=ListBox}}"
CommandParameter="{Binding}"
Content=""
Content=""
Cursor="Hand"
FontSize="10"
ToolTip="上移" />
@@ -213,11 +171,11 @@
Height="22"
Margin="1,0"
Background="Transparent"
BorderBrush="#cdcbcb"
BorderBrush="#CDCBCB"
BorderThickness="1"
Command="{Binding DataContext.MoveNodeDownCommand, RelativeSource={RelativeSource AncestorType=ListBox}}"
CommandParameter="{Binding}"
Content=""
Content=""
Cursor="Hand"
FontSize="10"
ToolTip="下移" />
@@ -230,7 +188,7 @@
BorderThickness="1"
Command="{Binding DataContext.RemoveOperatorCommand, RelativeSource={RelativeSource AncestorType=ListBox}}"
CommandParameter="{Binding}"
Content=""
Content=""
Cursor="Hand"
FontSize="10"
ToolTip="删除" />
@@ -247,13 +205,12 @@
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!-- 分隔线 -->
<Rectangle
Grid.Row="2"
Height="1"
Fill="{StaticResource SeparatorBrush}" />
<!-- 参数面板 -->
<ScrollViewer
Grid.Row="3"
HorizontalScrollBarVisibility="Disabled"
@@ -284,14 +241,14 @@
<TextBox
Grid.Column="1"
Padding="4,2"
BorderBrush="#cdcbcb"
BorderBrush="#CDCBCB"
BorderThickness="1"
FontFamily="Microsoft YaHei UI"
FontSize="11"
Text="{Binding Value, UpdateSourceTrigger=PropertyChanged}">
<TextBox.Style>
<Style TargetType="TextBox">
<Setter Property="BorderBrush" Value="#cdcbcb" />
<Setter Property="BorderBrush" Value="#CDCBCB" />
<Setter Property="Background" Value="White" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsValueValid}" Value="False">
@@ -309,7 +266,6 @@
</StackPanel>
</ScrollViewer>
<!-- 状态栏 -->
<Border
Grid.Row="4"
Padding="6,4"