410 lines
25 KiB
XML
410 lines
25 KiB
XML
<UserControl
|
|
x:Class="XplorePlane.Views.Cnc.CncPageView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:local="clr-namespace:XplorePlane.Views.Cnc"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:prism="http://prismlibrary.com/"
|
|
xmlns:vm="clr-namespace:XplorePlane.ViewModels.Cnc"
|
|
d:DesignHeight="760"
|
|
d:DesignWidth="1040"
|
|
prism:ViewModelLocator.AutoWireViewModel="True"
|
|
mc:Ignorable="d">
|
|
|
|
<UserControl.Resources>
|
|
<BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
|
|
<local:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
|
|
|
|
<SolidColorBrush x:Key="PanelBg" Color="White" />
|
|
<SolidColorBrush x:Key="PanelBorder" Color="#cdcbcb" />
|
|
<SolidColorBrush x:Key="SeparatorBrush" Color="#E0E0E0" />
|
|
<SolidColorBrush x:Key="TreeItemHover" Color="#F5F9FF" />
|
|
<SolidColorBrush x:Key="TreeItemSelected" Color="#E8F0FE" />
|
|
|
|
<Style x:Key="ToolbarBtn" TargetType="Button">
|
|
<Setter Property="Height" Value="28" />
|
|
<Setter Property="Margin" Value="2,0" />
|
|
<Setter Property="Padding" Value="6,0" />
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="BorderBrush" Value="#cdcbcb" />
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
<Setter Property="FontFamily" Value="Microsoft YaHei UI" />
|
|
<Setter Property="FontSize" Value="11" />
|
|
<Setter Property="Cursor" Value="Hand" />
|
|
</Style>
|
|
|
|
<Style x:Key="TreeItemStyle" TargetType="TreeViewItem">
|
|
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
|
|
<Setter Property="Padding" Value="0" />
|
|
<Setter Property="Margin" Value="0" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
|
</Style>
|
|
|
|
</UserControl.Resources>
|
|
|
|
<Border
|
|
MinWidth="550"
|
|
Background="{StaticResource PanelBg}"
|
|
BorderBrush="{StaticResource PanelBorder}"
|
|
BorderThickness="1"
|
|
CornerRadius="4">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="280" MinWidth="240" />
|
|
<ColumnDefinition Width="1" />
|
|
<ColumnDefinition Width="*" MinWidth="300" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Grid Grid.Column="0">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<Border
|
|
Grid.Row="0"
|
|
Padding="10,8"
|
|
BorderBrush="{StaticResource SeparatorBrush}"
|
|
BorderThickness="0,0,0,1">
|
|
<StackPanel>
|
|
<TextBlock
|
|
FontFamily="Microsoft YaHei UI"
|
|
FontSize="14"
|
|
FontWeight="SemiBold"
|
|
Text="{Binding ProgramName, TargetNullValue=CNC Program}" />
|
|
<TextBlock
|
|
Margin="0,4,0,0"
|
|
FontFamily="Microsoft YaHei UI"
|
|
FontSize="11"
|
|
Foreground="#666"
|
|
Text="模块节点下会自动归类显示标记/等待/消息节点" />
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<TreeView
|
|
x:Name="CncTreeView"
|
|
Grid.Row="1"
|
|
Background="Transparent"
|
|
BorderThickness="0"
|
|
ItemsSource="{Binding TreeNodes}"
|
|
SelectedItemChanged="CncTreeView_SelectedItemChanged">
|
|
<TreeView.Resources>
|
|
<HierarchicalDataTemplate DataType="{x:Type vm:CncNodeViewModel}" ItemsSource="{Binding Children}">
|
|
<Grid x:Name="NodeRoot" MinHeight="42">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="34" />
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Border
|
|
Grid.Column="0"
|
|
Width="26"
|
|
Height="26"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Background="Transparent"
|
|
BorderBrush="Transparent"
|
|
BorderThickness="0"
|
|
CornerRadius="4">
|
|
<Image
|
|
Width="18"
|
|
Height="18"
|
|
Source="{Binding Icon}"
|
|
Stretch="Uniform" />
|
|
</Border>
|
|
|
|
<StackPanel
|
|
Grid.Column="1"
|
|
Margin="6,0,0,0"
|
|
VerticalAlignment="Center"
|
|
Orientation="Horizontal">
|
|
<TextBlock
|
|
VerticalAlignment="Center"
|
|
FontFamily="Microsoft YaHei UI"
|
|
FontSize="11"
|
|
Foreground="#888"
|
|
Text="{Binding Index, StringFormat='[{0}] '}" />
|
|
<TextBlock
|
|
VerticalAlignment="Center"
|
|
FontFamily="Microsoft YaHei UI"
|
|
FontSize="12"
|
|
Text="{Binding Name}" />
|
|
</StackPanel>
|
|
|
|
<StackPanel
|
|
x:Name="NodeActions"
|
|
Grid.Column="2"
|
|
Margin="0,0,4,0"
|
|
VerticalAlignment="Center"
|
|
Orientation="Horizontal"
|
|
Visibility="Collapsed">
|
|
<Button
|
|
Width="22"
|
|
Height="22"
|
|
Margin="1,0"
|
|
Background="Transparent"
|
|
BorderBrush="#cdcbcb"
|
|
BorderThickness="1"
|
|
Command="{Binding DataContext.MoveNodeUpCommand, RelativeSource={RelativeSource AncestorType=TreeView}}"
|
|
CommandParameter="{Binding}"
|
|
Content="▲"
|
|
Cursor="Hand"
|
|
FontSize="10"
|
|
ToolTip="上移" />
|
|
<Button
|
|
Width="22"
|
|
Height="22"
|
|
Margin="1,0"
|
|
Background="Transparent"
|
|
BorderBrush="#cdcbcb"
|
|
BorderThickness="1"
|
|
Command="{Binding DataContext.MoveNodeDownCommand, RelativeSource={RelativeSource AncestorType=TreeView}}"
|
|
CommandParameter="{Binding}"
|
|
Content="▼"
|
|
Cursor="Hand"
|
|
FontSize="10"
|
|
ToolTip="下移" />
|
|
<Button
|
|
Width="22"
|
|
Height="22"
|
|
Margin="1,0"
|
|
Background="Transparent"
|
|
BorderBrush="#E05050"
|
|
BorderThickness="1"
|
|
Command="{Binding DataContext.DeleteNodeCommand, RelativeSource={RelativeSource AncestorType=TreeView}}"
|
|
Content="✕"
|
|
Cursor="Hand"
|
|
FontSize="10"
|
|
ToolTip="删除" />
|
|
</StackPanel>
|
|
</Grid>
|
|
<DataTemplate.Triggers>
|
|
<Trigger SourceName="NodeRoot" Property="IsMouseOver" Value="True">
|
|
<Setter TargetName="NodeActions" Property="Visibility" Value="Visible" />
|
|
</Trigger>
|
|
</DataTemplate.Triggers>
|
|
</HierarchicalDataTemplate>
|
|
</TreeView.Resources>
|
|
<TreeView.ItemContainerStyle>
|
|
<Style BasedOn="{StaticResource TreeItemStyle}" TargetType="TreeViewItem" />
|
|
</TreeView.ItemContainerStyle>
|
|
</TreeView>
|
|
</Grid>
|
|
|
|
<Rectangle
|
|
Grid.Column="1"
|
|
Width="1"
|
|
Fill="{StaticResource SeparatorBrush}" />
|
|
|
|
<ScrollViewer Grid.Column="2" VerticalScrollBarVisibility="Auto">
|
|
<Grid Margin="18,18,22,18">
|
|
<Grid.Resources>
|
|
<Style x:Key="EditorTitle" TargetType="TextBlock">
|
|
<Setter Property="FontFamily" Value="Microsoft YaHei UI" />
|
|
<Setter Property="FontSize" Value="13" />
|
|
<Setter Property="FontWeight" Value="SemiBold" />
|
|
<Setter Property="Margin" Value="0,0,0,12" />
|
|
</Style>
|
|
<Style x:Key="LabelStyle" TargetType="TextBlock">
|
|
<Setter Property="FontFamily" Value="Microsoft YaHei UI" />
|
|
<Setter Property="FontSize" Value="12" />
|
|
<Setter Property="Foreground" Value="#666" />
|
|
<Setter Property="Margin" Value="0,0,0,4" />
|
|
</Style>
|
|
<Style x:Key="EditorBox" TargetType="TextBox">
|
|
<Setter Property="Height" Value="30" />
|
|
<Setter Property="Padding" Value="8,4" />
|
|
<Setter Property="Margin" Value="0,0,0,12" />
|
|
<Setter Property="BorderBrush" Value="#CFCFCF" />
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
<Setter Property="FontFamily" Value="Microsoft YaHei UI" />
|
|
</Style>
|
|
<Style x:Key="EditorCheck" TargetType="CheckBox">
|
|
<Setter Property="Margin" Value="0,4,0,12" />
|
|
<Setter Property="FontFamily" Value="Microsoft YaHei UI" />
|
|
</Style>
|
|
</Grid.Resources>
|
|
|
|
<StackPanel Visibility="{Binding SelectedNode, Converter={StaticResource NullToVisibilityConverter}}">
|
|
<TextBlock Style="{StaticResource EditorTitle}" Text="节点属性" />
|
|
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="名称" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.Name, UpdateSourceTrigger=PropertyChanged}" />
|
|
|
|
<UniformGrid Columns="2" Margin="0,0,0,12">
|
|
<StackPanel Margin="0,0,12,0">
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="索引" />
|
|
<TextBox Style="{StaticResource EditorBox}" IsReadOnly="True" Text="{Binding SelectedNode.Index, Mode=OneWay}" />
|
|
</StackPanel>
|
|
<StackPanel>
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="类型" />
|
|
<TextBox Style="{StaticResource EditorBox}" IsReadOnly="True" Text="{Binding SelectedNode.NodeTypeDisplay, Mode=OneWay}" />
|
|
</StackPanel>
|
|
</UniformGrid>
|
|
|
|
<GroupBox
|
|
Margin="0,0,0,12"
|
|
Header="运动参数"
|
|
Visibility="{Binding SelectedNode.IsMotionSnapshotNode, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
<UniformGrid Margin="12" Columns="2">
|
|
<StackPanel Margin="0,0,12,0">
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="XM" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.XM, UpdateSourceTrigger=LostFocus}" />
|
|
</StackPanel>
|
|
<StackPanel>
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="YM" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.YM, UpdateSourceTrigger=LostFocus}" />
|
|
</StackPanel>
|
|
<StackPanel Margin="0,0,12,0">
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="ZT" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.ZT, UpdateSourceTrigger=LostFocus}" />
|
|
</StackPanel>
|
|
<StackPanel>
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="ZD" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.ZD, UpdateSourceTrigger=LostFocus}" />
|
|
</StackPanel>
|
|
<StackPanel Margin="0,0,12,0">
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="TiltD" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.TiltD, UpdateSourceTrigger=LostFocus}" />
|
|
</StackPanel>
|
|
<StackPanel>
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="Dist" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.Dist, UpdateSourceTrigger=LostFocus}" />
|
|
</StackPanel>
|
|
</UniformGrid>
|
|
</GroupBox>
|
|
|
|
<GroupBox
|
|
Margin="0,0,0,12"
|
|
Header="射线源"
|
|
Visibility="{Binding SelectedNode.IsReferencePoint, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
<StackPanel Margin="12">
|
|
<CheckBox Style="{StaticResource EditorCheck}" Content="射线源开启" IsChecked="{Binding SelectedNode.IsRayOn}" />
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="电压 (kV)" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.Voltage, UpdateSourceTrigger=LostFocus}" />
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="电流 (uA)" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.Current, UpdateSourceTrigger=LostFocus}" />
|
|
</StackPanel>
|
|
</GroupBox>
|
|
|
|
<GroupBox
|
|
Margin="0,0,0,12"
|
|
Header="采集参数"
|
|
Visibility="{Binding SelectedNode.IsSaveNode, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
<StackPanel Margin="12">
|
|
<CheckBox Style="{StaticResource EditorCheck}" Content="射线源开启" IsChecked="{Binding SelectedNode.IsRayOn}" />
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="电压 (kV)" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.Voltage, UpdateSourceTrigger=LostFocus}" />
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="功率 (W)" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.Power, UpdateSourceTrigger=LostFocus}" />
|
|
<CheckBox Style="{StaticResource EditorCheck}" Content="探测器已连接" IsChecked="{Binding SelectedNode.DetectorConnected}" />
|
|
<CheckBox Style="{StaticResource EditorCheck}" Content="探测器正在采集" IsChecked="{Binding SelectedNode.DetectorAcquiring}" />
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="帧率" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.FrameRate, UpdateSourceTrigger=LostFocus}" />
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="分辨率" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.Resolution, UpdateSourceTrigger=PropertyChanged}" />
|
|
</StackPanel>
|
|
</GroupBox>
|
|
|
|
<GroupBox
|
|
Margin="0,0,0,12"
|
|
Header="采集参数"
|
|
Visibility="{Binding SelectedNode.IsSaveNodeWithImage, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
<StackPanel Margin="12">
|
|
<CheckBox Style="{StaticResource EditorCheck}" Content="射线源开启" IsChecked="{Binding SelectedNode.IsRayOn}" />
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="电压 (kV)" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.Voltage, UpdateSourceTrigger=LostFocus}" />
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="功率 (W)" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.Power, UpdateSourceTrigger=LostFocus}" />
|
|
<CheckBox Style="{StaticResource EditorCheck}" Content="探测器已连接" IsChecked="{Binding SelectedNode.DetectorConnected}" />
|
|
<CheckBox Style="{StaticResource EditorCheck}" Content="探测器正在采集" IsChecked="{Binding SelectedNode.DetectorAcquiring}" />
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="帧率" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.FrameRate, UpdateSourceTrigger=LostFocus}" />
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="分辨率" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.Resolution, UpdateSourceTrigger=PropertyChanged}" />
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="图像文件" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.ImageFileName, UpdateSourceTrigger=PropertyChanged}" />
|
|
</StackPanel>
|
|
</GroupBox>
|
|
|
|
<GroupBox
|
|
Margin="0,0,0,12"
|
|
Header="检测模块"
|
|
Visibility="{Binding SelectedNode.IsInspectionModule, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
<StackPanel Margin="12">
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="Pipeline 名称" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.PipelineName, UpdateSourceTrigger=PropertyChanged}" />
|
|
</StackPanel>
|
|
</GroupBox>
|
|
|
|
<GroupBox
|
|
Margin="0,0,0,12"
|
|
Header="标记参数"
|
|
Visibility="{Binding SelectedNode.IsInspectionMarker, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
<StackPanel Margin="12">
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="标记类型" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.MarkerType, UpdateSourceTrigger=PropertyChanged}" />
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="MarkerX" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.MarkerX, UpdateSourceTrigger=LostFocus}" />
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="MarkerY" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.MarkerY, UpdateSourceTrigger=LostFocus}" />
|
|
</StackPanel>
|
|
</GroupBox>
|
|
|
|
<GroupBox
|
|
Margin="0,0,0,12"
|
|
Header="消息弹窗"
|
|
Visibility="{Binding SelectedNode.IsPauseDialog, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
<StackPanel Margin="12">
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="标题" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.DialogTitle, UpdateSourceTrigger=PropertyChanged}" />
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="消息内容" />
|
|
<TextBox
|
|
MinHeight="80"
|
|
Margin="0,0,0,12"
|
|
Padding="8,6"
|
|
AcceptsReturn="True"
|
|
Text="{Binding SelectedNode.DialogMessage, UpdateSourceTrigger=PropertyChanged}"
|
|
TextWrapping="Wrap" />
|
|
</StackPanel>
|
|
</GroupBox>
|
|
|
|
<GroupBox
|
|
Margin="0,0,0,12"
|
|
Header="等待参数"
|
|
Visibility="{Binding SelectedNode.IsWaitDelay, Converter={StaticResource BoolToVisibilityConverter}}">
|
|
<StackPanel Margin="12">
|
|
<TextBlock Style="{StaticResource LabelStyle}" Text="延时 (ms)" />
|
|
<TextBox Style="{StaticResource EditorBox}" Text="{Binding SelectedNode.DelayMilliseconds, UpdateSourceTrigger=LostFocus}" />
|
|
</StackPanel>
|
|
</GroupBox>
|
|
</StackPanel>
|
|
|
|
<Border
|
|
Padding="24"
|
|
Background="#FAFAFA"
|
|
BorderBrush="#E6E6E6"
|
|
BorderThickness="1"
|
|
CornerRadius="6"
|
|
Visibility="{Binding SelectedNode, Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=Invert}">
|
|
<StackPanel>
|
|
<TextBlock
|
|
FontFamily="Microsoft YaHei UI"
|
|
FontSize="15"
|
|
FontWeight="SemiBold"
|
|
Text="未选择节点" />
|
|
<TextBlock
|
|
Margin="0,8,0,0"
|
|
FontFamily="Microsoft YaHei UI"
|
|
Foreground="#666"
|
|
Text="从左侧树中选择一个节点后,这里会显示并允许编辑该节点的参数。" />
|
|
</StackPanel>
|
|
</Border>
|
|
</Grid>
|
|
</ScrollViewer>
|
|
</Grid>
|
|
</Border>
|
|
</UserControl>
|