优化CNC编辑为2列布局
This commit is contained in:
@@ -21,7 +21,7 @@ namespace XplorePlane.ViewModels
|
||||
{
|
||||
public class MainViewModel : BindableBase
|
||||
{
|
||||
private const double CncEditorHostWidth = 710d;
|
||||
private const double CncEditorHostWidth = 502d;
|
||||
private readonly ILoggerService _logger;
|
||||
private readonly IContainerProvider _containerProvider;
|
||||
private readonly IEventAggregator _eventAggregator;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
xmlns:views="clr-namespace:XplorePlane.Views"
|
||||
xmlns:vm="clr-namespace:XplorePlane.ViewModels.Cnc"
|
||||
d:DesignHeight="760"
|
||||
d:DesignWidth="702"
|
||||
d:DesignWidth="502"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
mc:Ignorable="d">
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
<SolidColorBrush x:Key="PanelBorder" Color="#CDCBCB" />
|
||||
<SolidColorBrush x:Key="SeparatorBrush" Color="#E5E5E5" />
|
||||
<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="#C7D4DF" />
|
||||
<FontFamily x:Key="UiFont">Microsoft YaHei UI</FontFamily>
|
||||
|
||||
@@ -101,8 +98,8 @@
|
||||
</UserControl.Resources>
|
||||
|
||||
<Border
|
||||
Width="702"
|
||||
MinWidth="702"
|
||||
Width="502"
|
||||
MinWidth="502"
|
||||
HorizontalAlignment="Left"
|
||||
Background="{StaticResource PanelBg}"
|
||||
BorderBrush="{StaticResource PanelBorder}"
|
||||
@@ -112,9 +109,7 @@
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition Width="1" />
|
||||
<ColumnDefinition Width="250" />
|
||||
<ColumnDefinition Width="1" />
|
||||
<ColumnDefinition Width="250" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid Grid.Column="0">
|
||||
@@ -248,18 +243,15 @@
|
||||
Stretch="Uniform" />
|
||||
</Border>
|
||||
|
||||
<StackPanel
|
||||
<TextBlock
|
||||
Grid.Column="2"
|
||||
Margin="3,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="{StaticResource UiFont}"
|
||||
FontSize="11"
|
||||
FontWeight="SemiBold"
|
||||
Text="{Binding Name}" />
|
||||
</StackPanel>
|
||||
Text="{Binding Name}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
|
||||
<StackPanel
|
||||
x:Name="NodeActions"
|
||||
@@ -308,7 +300,10 @@
|
||||
Width="1"
|
||||
Fill="{StaticResource SeparatorBrush}" />
|
||||
|
||||
<ScrollViewer Grid.Column="2" VerticalScrollBarVisibility="Auto">
|
||||
<Grid Grid.Column="2">
|
||||
<ScrollViewer
|
||||
x:Name="NodePropertyEditor"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<Grid Margin="10">
|
||||
<StackPanel Visibility="{Binding SelectedNode, Converter={StaticResource NullToVisibilityConverter}}">
|
||||
<TextBlock Style="{StaticResource EditorTitle}" Text="节点属性" />
|
||||
@@ -412,16 +407,6 @@
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox
|
||||
Style="{StaticResource CompactGroupBox}"
|
||||
Header="检测模块"
|
||||
Visibility="{Binding SelectedNode.IsInspectionModule, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<StackPanel Margin="8,8,8,6">
|
||||
<TextBlock Style="{StaticResource LabelStyle}" Text="Pipeline 名称" />
|
||||
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.PipelineName, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox
|
||||
Style="{StaticResource CompactGroupBox}"
|
||||
Header="检测标记"
|
||||
@@ -468,14 +453,22 @@
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
|
||||
<views:PipelineEditorView
|
||||
x:Name="InspectionModulePipelineEditor"
|
||||
Margin="0"
|
||||
Visibility="{Binding EditorVisibility}" />
|
||||
|
||||
<Border
|
||||
Padding="12"
|
||||
x:Name="NodePropertyEmptyState"
|
||||
Margin="12"
|
||||
Padding="16"
|
||||
Background="#FAFAFA"
|
||||
BorderBrush="#E6E6E6"
|
||||
BorderThickness="1"
|
||||
CornerRadius="6"
|
||||
Visibility="{Binding SelectedNode, Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=Invert}">
|
||||
CornerRadius="6">
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
FontFamily="{StaticResource UiFont}"
|
||||
@@ -488,45 +481,7 @@
|
||||
FontFamily="{StaticResource UiFont}"
|
||||
FontSize="10"
|
||||
Foreground="#666666"
|
||||
Text="从左侧树中选择一个节点后,这里会显示可编辑的参数。"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
|
||||
<Rectangle
|
||||
Grid.Column="3"
|
||||
Width="1"
|
||||
Fill="{StaticResource SeparatorBrush}" />
|
||||
|
||||
<Grid Grid.Column="4">
|
||||
<views:PipelineEditorView
|
||||
x:Name="InspectionModulePipelineEditor"
|
||||
Visibility="{Binding EditorVisibility}" />
|
||||
|
||||
<Border
|
||||
x:Name="InspectionModulePipelineEmptyState"
|
||||
Margin="12"
|
||||
Padding="16"
|
||||
Background="#FAFAFA"
|
||||
BorderBrush="#E6E6E6"
|
||||
BorderThickness="1"
|
||||
CornerRadius="6"
|
||||
Visibility="{Binding EmptyStateVisibility}">
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
FontFamily="{StaticResource UiFont}"
|
||||
FontSize="13"
|
||||
FontWeight="SemiBold"
|
||||
Text="未选择检测模块"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock
|
||||
Margin="0,6,0,0"
|
||||
FontFamily="{StaticResource UiFont}"
|
||||
FontSize="10"
|
||||
Foreground="#666666"
|
||||
Text="请选择一个检测模块节点后,在这里拖拽算子并配置参数。"
|
||||
Text="从左侧树中选择一个节点后,这里会显示对应的参数或检测流程。"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
@@ -69,7 +69,6 @@ namespace XplorePlane.Views.Cnc
|
||||
logger);
|
||||
|
||||
InspectionModulePipelineEditor.DataContext = _inspectionModulePipelineViewModel;
|
||||
InspectionModulePipelineEmptyState.DataContext = _inspectionModulePipelineViewModel;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -216,6 +215,10 @@ namespace XplorePlane.Views.Cnc
|
||||
}
|
||||
|
||||
bool isReadOnlyNode = viewModel.SelectedNode?.IsReadOnlyNodeProperties == true;
|
||||
bool showNodeProperties = viewModel.SelectedNode != null && !viewModel.SelectedNode.IsInspectionModule;
|
||||
|
||||
NodePropertyEditor.Visibility = showNodeProperties ? Visibility.Visible : Visibility.Collapsed;
|
||||
NodePropertyEmptyState.Visibility = viewModel.SelectedNode == null ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
foreach (var textBox in FindVisualDescendants<TextBox>(propertyEditorRoot))
|
||||
{
|
||||
@@ -322,15 +325,7 @@ namespace XplorePlane.Views.Cnc
|
||||
|
||||
private DependencyObject FindPropertyEditorRoot()
|
||||
{
|
||||
foreach (var scrollViewer in FindVisualDescendants<ScrollViewer>(this))
|
||||
{
|
||||
if (Grid.GetColumn(scrollViewer) == 2)
|
||||
{
|
||||
return scrollViewer;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return NodePropertyEditor;
|
||||
}
|
||||
|
||||
private static Border FindNodeCard(DependencyObject root)
|
||||
|
||||
Reference in New Issue
Block a user