CNC树形结构的优化
This commit is contained in:
@@ -64,7 +64,15 @@ namespace XplorePlane.ViewModels.Cnc
|
|||||||
public bool IsPauseDialog => _model is PauseDialogNode;
|
public bool IsPauseDialog => _model is PauseDialogNode;
|
||||||
public bool IsWaitDelay => _model is WaitDelayNode;
|
public bool IsWaitDelay => _model is WaitDelayNode;
|
||||||
public bool IsCompleteProgram => _model is CompleteProgramNode;
|
public bool IsCompleteProgram => _model is CompleteProgramNode;
|
||||||
|
public bool IsPositionChild => _model is InspectionModuleNode or InspectionMarkerNode;
|
||||||
public bool IsMotionSnapshotNode => _model is ReferencePointNode or SaveNodeNode or SaveNodeWithImageNode or SavePositionNode;
|
public bool IsMotionSnapshotNode => _model is ReferencePointNode or SaveNodeNode or SaveNodeWithImageNode or SavePositionNode;
|
||||||
|
public string RelationTag => _model switch
|
||||||
|
{
|
||||||
|
SavePositionNode => "位置",
|
||||||
|
InspectionModuleNode => "检测模块",
|
||||||
|
InspectionMarkerNode => "检测标记",
|
||||||
|
_ => string.Empty
|
||||||
|
};
|
||||||
|
|
||||||
public double XM
|
public double XM
|
||||||
{
|
{
|
||||||
@@ -504,7 +512,9 @@ namespace XplorePlane.ViewModels.Cnc
|
|||||||
RaisePropertyChanged(nameof(IsPauseDialog));
|
RaisePropertyChanged(nameof(IsPauseDialog));
|
||||||
RaisePropertyChanged(nameof(IsWaitDelay));
|
RaisePropertyChanged(nameof(IsWaitDelay));
|
||||||
RaisePropertyChanged(nameof(IsCompleteProgram));
|
RaisePropertyChanged(nameof(IsCompleteProgram));
|
||||||
|
RaisePropertyChanged(nameof(IsPositionChild));
|
||||||
RaisePropertyChanged(nameof(IsMotionSnapshotNode));
|
RaisePropertyChanged(nameof(IsMotionSnapshotNode));
|
||||||
|
RaisePropertyChanged(nameof(RelationTag));
|
||||||
RaisePropertyChanged(nameof(XM));
|
RaisePropertyChanged(nameof(XM));
|
||||||
RaisePropertyChanged(nameof(YM));
|
RaisePropertyChanged(nameof(YM));
|
||||||
RaisePropertyChanged(nameof(ZT));
|
RaisePropertyChanged(nameof(ZT));
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
<SolidColorBrush x:Key="PanelBorder" Color="#CDCBCB" />
|
<SolidColorBrush x:Key="PanelBorder" Color="#CDCBCB" />
|
||||||
<SolidColorBrush x:Key="SeparatorBrush" Color="#E5E5E5" />
|
<SolidColorBrush x:Key="SeparatorBrush" Color="#E5E5E5" />
|
||||||
<SolidColorBrush x:Key="HeaderBg" Color="#F7F7F7" />
|
<SolidColorBrush x:Key="HeaderBg" Color="#F7F7F7" />
|
||||||
|
<SolidColorBrush x:Key="TreeParentBg" Color="#F6F8FB" />
|
||||||
|
<SolidColorBrush x:Key="TreeChildBg" Color="#FBFCFE" />
|
||||||
|
<SolidColorBrush x:Key="TreeAccentBrush" Color="#2E6FA3" />
|
||||||
|
<SolidColorBrush x:Key="TreeChildLineBrush" Color="#B9CDE0" />
|
||||||
<FontFamily x:Key="UiFont">Microsoft YaHei UI</FontFamily>
|
<FontFamily x:Key="UiFont">Microsoft YaHei UI</FontFamily>
|
||||||
|
|
||||||
<Style x:Key="TreeItemStyle" TargetType="TreeViewItem">
|
<Style x:Key="TreeItemStyle" TargetType="TreeViewItem">
|
||||||
@@ -109,7 +113,7 @@
|
|||||||
FontFamily="{StaticResource UiFont}"
|
FontFamily="{StaticResource UiFont}"
|
||||||
FontSize="10"
|
FontSize="10"
|
||||||
Foreground="#666666"
|
Foreground="#666666"
|
||||||
Text="模块节点下会自动显示标记、等待、消息等子节点。"
|
Text="保存位置节点下会自动显示检测标记和检测模块,清晰表达当前检测位置与检测内容的父子关系。"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
@@ -124,97 +128,133 @@
|
|||||||
SelectedItemChanged="CncTreeView_SelectedItemChanged">
|
SelectedItemChanged="CncTreeView_SelectedItemChanged">
|
||||||
<TreeView.Resources>
|
<TreeView.Resources>
|
||||||
<HierarchicalDataTemplate DataType="{x:Type vm:CncNodeViewModel}" ItemsSource="{Binding Children}">
|
<HierarchicalDataTemplate DataType="{x:Type vm:CncNodeViewModel}" ItemsSource="{Binding Children}">
|
||||||
<Grid x:Name="NodeRoot" MinHeight="34">
|
<Border
|
||||||
<Grid.ColumnDefinitions>
|
x:Name="NodeCard"
|
||||||
<ColumnDefinition Width="30" />
|
Margin="0,1,0,1"
|
||||||
<ColumnDefinition Width="*" />
|
Padding="0"
|
||||||
<ColumnDefinition Width="Auto" />
|
Background="Transparent"
|
||||||
</Grid.ColumnDefinitions>
|
BorderBrush="Transparent"
|
||||||
|
BorderThickness="1"
|
||||||
|
CornerRadius="4">
|
||||||
|
<Grid x:Name="NodeRoot" MinHeight="28">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="18" />
|
||||||
|
<ColumnDefinition Width="24" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<Border
|
<Grid Grid.Column="0">
|
||||||
Grid.Column="0"
|
<Border
|
||||||
Width="22"
|
x:Name="ChildStem"
|
||||||
Height="22"
|
Width="2"
|
||||||
HorizontalAlignment="Center"
|
Margin="8,0,0,0"
|
||||||
VerticalAlignment="Center"
|
HorizontalAlignment="Left"
|
||||||
Background="Transparent"
|
Background="{StaticResource TreeChildLineBrush}"
|
||||||
CornerRadius="4">
|
Visibility="Collapsed" />
|
||||||
<Image
|
<Border
|
||||||
Width="15"
|
x:Name="ChildBranch"
|
||||||
Height="15"
|
Width="10"
|
||||||
Source="{Binding Icon}"
|
Height="2"
|
||||||
Stretch="Uniform" />
|
Margin="8,0,0,0"
|
||||||
</Border>
|
HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Background="{StaticResource TreeChildLineBrush}"
|
||||||
|
Visibility="Collapsed" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<StackPanel
|
<Border
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="4,0,0,0"
|
Width="18"
|
||||||
VerticalAlignment="Center"
|
Height="18"
|
||||||
Orientation="Horizontal">
|
HorizontalAlignment="Center"
|
||||||
<TextBlock
|
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
FontFamily="{StaticResource UiFont}"
|
Background="Transparent"
|
||||||
FontSize="10.5"
|
CornerRadius="4">
|
||||||
Foreground="#888888"
|
<Image
|
||||||
Text="{Binding Index, StringFormat='[{0}] '}" />
|
Width="14"
|
||||||
<TextBlock
|
Height="14"
|
||||||
VerticalAlignment="Center"
|
Source="{Binding Icon}"
|
||||||
FontFamily="{StaticResource UiFont}"
|
Stretch="Uniform" />
|
||||||
FontSize="11.5"
|
</Border>
|
||||||
Text="{Binding Name}" />
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<StackPanel
|
<StackPanel
|
||||||
x:Name="NodeActions"
|
Grid.Column="2"
|
||||||
Grid.Column="2"
|
Margin="3,0,0,0"
|
||||||
Margin="0,0,2,0"
|
VerticalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
Orientation="Horizontal">
|
||||||
Orientation="Horizontal"
|
<TextBlock
|
||||||
Visibility="Collapsed">
|
VerticalAlignment="Center"
|
||||||
<Button
|
FontFamily="{StaticResource UiFont}"
|
||||||
Width="20"
|
FontSize="10.5"
|
||||||
Height="20"
|
Foreground="#888888"
|
||||||
Margin="1,0"
|
Text="{Binding Index, StringFormat='[{0}] '}" />
|
||||||
Background="White"
|
<TextBlock
|
||||||
BorderBrush="#CDCBCB"
|
VerticalAlignment="Center"
|
||||||
BorderThickness="1"
|
FontFamily="{StaticResource UiFont}"
|
||||||
Command="{Binding DataContext.MoveNodeUpCommand, RelativeSource={RelativeSource AncestorType=TreeView}}"
|
FontSize="11.5"
|
||||||
CommandParameter="{Binding}"
|
FontWeight="SemiBold"
|
||||||
Content="上"
|
Text="{Binding Name}" />
|
||||||
Cursor="Hand"
|
</StackPanel>
|
||||||
FontSize="10"
|
|
||||||
ToolTip="上移" />
|
<StackPanel
|
||||||
<Button
|
x:Name="NodeActions"
|
||||||
Width="20"
|
Grid.Column="3"
|
||||||
Height="20"
|
Margin="0,0,2,0"
|
||||||
Margin="1,0"
|
VerticalAlignment="Center"
|
||||||
Background="White"
|
Orientation="Horizontal"
|
||||||
BorderBrush="#CDCBCB"
|
Visibility="Collapsed">
|
||||||
BorderThickness="1"
|
<Button
|
||||||
Command="{Binding DataContext.MoveNodeDownCommand, RelativeSource={RelativeSource AncestorType=TreeView}}"
|
Width="20"
|
||||||
CommandParameter="{Binding}"
|
Height="20"
|
||||||
Content="下"
|
Margin="1,0"
|
||||||
Cursor="Hand"
|
Background="White"
|
||||||
FontSize="10"
|
BorderBrush="#CDCBCB"
|
||||||
ToolTip="下移" />
|
BorderThickness="1"
|
||||||
<Button
|
Command="{Binding DataContext.MoveNodeUpCommand, RelativeSource={RelativeSource AncestorType=TreeView}}"
|
||||||
Width="20"
|
CommandParameter="{Binding}"
|
||||||
Height="20"
|
Content="↑"
|
||||||
Margin="1,0"
|
Cursor="Hand"
|
||||||
Background="White"
|
FontSize="10"
|
||||||
BorderBrush="#E05050"
|
ToolTip="上移" />
|
||||||
BorderThickness="1"
|
<Button
|
||||||
Command="{Binding DataContext.DeleteNodeCommand, RelativeSource={RelativeSource AncestorType=TreeView}}"
|
Width="20"
|
||||||
Content="删"
|
Height="20"
|
||||||
Cursor="Hand"
|
Margin="1,0"
|
||||||
FontSize="10"
|
Background="White"
|
||||||
ToolTip="删除" />
|
BorderBrush="#CDCBCB"
|
||||||
</StackPanel>
|
BorderThickness="1"
|
||||||
</Grid>
|
Command="{Binding DataContext.MoveNodeDownCommand, RelativeSource={RelativeSource AncestorType=TreeView}}"
|
||||||
|
CommandParameter="{Binding}"
|
||||||
|
Content="↓"
|
||||||
|
Cursor="Hand"
|
||||||
|
FontSize="10"
|
||||||
|
ToolTip="下移" />
|
||||||
|
<Button
|
||||||
|
Width="20"
|
||||||
|
Height="20"
|
||||||
|
Margin="1,0"
|
||||||
|
Background="White"
|
||||||
|
BorderBrush="#E05050"
|
||||||
|
BorderThickness="1"
|
||||||
|
Command="{Binding DataContext.DeleteNodeCommand, RelativeSource={RelativeSource AncestorType=TreeView}}"
|
||||||
|
Content="×"
|
||||||
|
Cursor="Hand"
|
||||||
|
FontSize="10"
|
||||||
|
ToolTip="删除" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
<DataTemplate.Triggers>
|
<DataTemplate.Triggers>
|
||||||
<Trigger SourceName="NodeRoot" Property="IsMouseOver" Value="True">
|
<Trigger SourceName="NodeRoot" Property="IsMouseOver" Value="True">
|
||||||
<Setter TargetName="NodeActions" Property="Visibility" Value="Visible" />
|
<Setter TargetName="NodeActions" Property="Visibility" Value="Visible" />
|
||||||
|
<Setter TargetName="NodeCard" Property="Background" Value="#F3F7FB" />
|
||||||
|
<Setter TargetName="NodeCard" Property="BorderBrush" Value="#D7E4F1" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
|
<DataTrigger Binding="{Binding IsPositionChild}" Value="True">
|
||||||
|
<Setter TargetName="ChildStem" Property="Visibility" Value="Visible" />
|
||||||
|
<Setter TargetName="ChildBranch" Property="Visibility" Value="Visible" />
|
||||||
|
</DataTrigger>
|
||||||
</DataTemplate.Triggers>
|
</DataTemplate.Triggers>
|
||||||
</HierarchicalDataTemplate>
|
</HierarchicalDataTemplate>
|
||||||
</TreeView.Resources>
|
</TreeView.Resources>
|
||||||
@@ -237,7 +277,7 @@
|
|||||||
<TextBlock Style="{StaticResource LabelStyle}" Text="名称" />
|
<TextBlock Style="{StaticResource LabelStyle}" Text="名称" />
|
||||||
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.Name, UpdateSourceTrigger=PropertyChanged}" />
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.Name, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
|
||||||
<UniformGrid Columns="2" Margin="0,0,0,8">
|
<UniformGrid Margin="0,0,0,8" Columns="2">
|
||||||
<StackPanel Margin="0,0,6,0">
|
<StackPanel Margin="0,0,6,0">
|
||||||
<TextBlock Style="{StaticResource LabelStyle}" Text="索引" />
|
<TextBlock Style="{StaticResource LabelStyle}" Text="索引" />
|
||||||
<TextBox Style="{StaticResource EditorBox}" IsReadOnly="True" Text="{Binding SelectedNode.Index, Mode=OneWay}" />
|
<TextBox Style="{StaticResource EditorBox}" IsReadOnly="True" Text="{Binding SelectedNode.Index, Mode=OneWay}" />
|
||||||
@@ -345,7 +385,7 @@
|
|||||||
|
|
||||||
<GroupBox
|
<GroupBox
|
||||||
Style="{StaticResource CompactGroupBox}"
|
Style="{StaticResource CompactGroupBox}"
|
||||||
Header="标记参数"
|
Header="检测标记"
|
||||||
Visibility="{Binding SelectedNode.IsInspectionMarker, Converter={StaticResource BoolToVisibilityConverter}}">
|
Visibility="{Binding SelectedNode.IsInspectionMarker, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||||
<StackPanel Margin="8,8,8,6">
|
<StackPanel Margin="8,8,8,6">
|
||||||
<TextBlock Style="{StaticResource LabelStyle}" Text="标记类型" />
|
<TextBlock Style="{StaticResource LabelStyle}" Text="标记类型" />
|
||||||
|
|||||||
Reference in New Issue
Block a user