周立功的CAN /FD实现
This commit is contained in:
331
CapMachine.Wpf/Views/DialogZlgCanLinRwConfigView.xaml
Normal file
331
CapMachine.Wpf/Views/DialogZlgCanLinRwConfigView.xaml
Normal file
@@ -0,0 +1,331 @@
|
||||
<UserControl
|
||||
x:Class="CapMachine.Wpf.Views.DialogZlgCanLinRwConfigView"
|
||||
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:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:CapMachine.Wpf.Views"
|
||||
xmlns:localEx="clr-namespace:CapMachine.Wpf"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:vm="clr-namespace:CapMachine.Wpf.ViewModels"
|
||||
Width="1900"
|
||||
Height="900"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<localEx:BindingProxy x:Key="Proxy" Data="{Binding}" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.3*" />
|
||||
<ColumnDefinition Width="15" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid Grid.Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="15" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GroupBox Grid.Row="0">
|
||||
<GroupBox.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Foreground="White"
|
||||
Text="" />
|
||||
<TextBlock FontSize="18" Foreground="White">写入配置</TextBlock>
|
||||
</StackPanel>
|
||||
</GroupBox.Header>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Margin="5"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Command="{Binding RemoveWriteCmd}"
|
||||
Content="从写入移除"
|
||||
Foreground="White"
|
||||
IsEnabled="{Binding IsEditable}" />
|
||||
</StackPanel>
|
||||
|
||||
<DataGrid
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
HeadersVisibility="Column"
|
||||
ItemsSource="{Binding WriteConfigs}"
|
||||
SelectedItem="{Binding SelectedWriteConfig, Mode=TwoWay}"
|
||||
SelectionMode="Single"
|
||||
SelectionUnit="FullRow">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="180" Header="名称">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox
|
||||
DisplayMemberPath="Text"
|
||||
IsEditable="True"
|
||||
IsEnabled="{Binding Source={StaticResource Proxy}, Path=Data.IsEditable}"
|
||||
ItemsSource="{Binding Source={StaticResource Proxy}, Path=Data.WriteNameCbxItems}"
|
||||
SelectedValue="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedValuePath="Text" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn
|
||||
Width="200"
|
||||
Binding="{Binding MsgFrameName}"
|
||||
Header="消息名称"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="200"
|
||||
Binding="{Binding SignalName}"
|
||||
Header="信号名称"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding DefautValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Header="默认值" />
|
||||
<DataGridTemplateColumn Width="200" Header="规则名称">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox
|
||||
DisplayMemberPath="Name"
|
||||
IsEnabled="{Binding Source={StaticResource Proxy}, Path=Data.IsEditable}"
|
||||
ItemsSource="{Binding Source={StaticResource Proxy}, Path=Data.LogicRuleDtos}"
|
||||
SelectedValue="{Binding LogicRuleId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedValuePath="Id" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Grid.Row="2">
|
||||
<GroupBox.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Foreground="White"
|
||||
Text="" />
|
||||
<TextBlock FontSize="18" Foreground="White">读取配置</TextBlock>
|
||||
</StackPanel>
|
||||
</GroupBox.Header>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Margin="5"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Command="{Binding RemoveReadCmd}"
|
||||
Content="从读取移除"
|
||||
Foreground="White"
|
||||
IsEnabled="{Binding IsEditable}" />
|
||||
</StackPanel>
|
||||
|
||||
<DataGrid
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
HeadersVisibility="Column"
|
||||
ItemsSource="{Binding ReadConfigs}"
|
||||
SelectedItem="{Binding SelectedReadConfig, Mode=TwoWay}"
|
||||
SelectionMode="Single"
|
||||
SelectionUnit="FullRow">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="180" Header="名称">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox
|
||||
DisplayMemberPath="Text"
|
||||
IsEditable="True"
|
||||
IsEnabled="{Binding Source={StaticResource Proxy}, Path=Data.IsEditable}"
|
||||
ItemsSource="{Binding Source={StaticResource Proxy}, Path=Data.ReadNameCbxItems}"
|
||||
SelectedValue="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedValuePath="Text" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn
|
||||
Width="200"
|
||||
Binding="{Binding MsgFrameName}"
|
||||
Header="消息名称"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="200"
|
||||
Binding="{Binding SignalName}"
|
||||
Header="信号名称"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding DefautValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Header="默认值" />
|
||||
<DataGridTemplateColumn Width="200" Header="规则名称">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox
|
||||
DisplayMemberPath="Name"
|
||||
IsEnabled="{Binding Source={StaticResource Proxy}, Path=Data.IsEditable}"
|
||||
ItemsSource="{Binding Source={StaticResource Proxy}, Path=Data.LogicRuleDtos}"
|
||||
SelectedValue="{Binding LogicRuleId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedValuePath="Id" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
|
||||
<GroupBox Grid.Column="2">
|
||||
<GroupBox.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Foreground="White"
|
||||
Text="" />
|
||||
<TextBlock FontSize="18" Foreground="White">信号集合</TextBlock>
|
||||
</StackPanel>
|
||||
</GroupBox.Header>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBox
|
||||
Grid.Row="0"
|
||||
Margin="5"
|
||||
VerticalContentAlignment="Center"
|
||||
Text="{Binding SignalFilterText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Margin="5"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Command="{Binding AddToWriteCmd}"
|
||||
Content="添加到写入"
|
||||
Foreground="White"
|
||||
IsEnabled="{Binding IsEditable}" />
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Command="{Binding AddToReadCmd}"
|
||||
Content="添加到读取"
|
||||
Foreground="White"
|
||||
IsEnabled="{Binding IsEditable}" />
|
||||
</StackPanel>
|
||||
|
||||
<TreeView
|
||||
x:Name="SignalTreeView"
|
||||
Grid.Row="2"
|
||||
Margin="5"
|
||||
ItemsSource="{Binding SignalTree}">
|
||||
<TreeView.Resources>
|
||||
<HierarchicalDataTemplate DataType="{x:Type vm:DialogZlgCanLinRwConfigViewModel+SignalFrameNode}" ItemsSource="{Binding Signals}">
|
||||
<TextBlock FontWeight="Bold" Text="{Binding FrameName}" />
|
||||
</HierarchicalDataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type vm:DialogZlgCanLinRwConfigViewModel+SignalCandidate}">
|
||||
<Grid>
|
||||
<Grid.Style>
|
||||
<Style TargetType="Grid">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding AddedInfo}" Value="1">
|
||||
<Setter Property="Background" Value="LightGreen" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding AddedInfo}" Value="2">
|
||||
<Setter Property="Background" Value="SkyBlue" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding AddedInfo}" Value="3">
|
||||
<Setter Property="Background" Value="Orange" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Grid.Style>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="180" />
|
||||
<ColumnDefinition Width="160" />
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding MsgName}" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding SignalName}" />
|
||||
<TextBlock Grid.Column="2" Text="{Binding Name}" />
|
||||
<TextBlock
|
||||
Grid.Column="3"
|
||||
Text="{Binding Desc}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</TreeView.Resources>
|
||||
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectedItemChanged">
|
||||
<prism:InvokeCommandAction Command="{Binding SignalTreeSelectionChangedCmd}" CommandParameter="{Binding ElementName=SignalTreeView, Path=SelectedItem}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TreeView>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="10,10"
|
||||
Command="{Binding SaveCmd}"
|
||||
Content="保存"
|
||||
Foreground="White"
|
||||
IsEnabled="{Binding IsEditable}" />
|
||||
<Button
|
||||
Margin="10,0"
|
||||
Command="{Binding CancelCmd}"
|
||||
Content="取消"
|
||||
Foreground="White" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user