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