LIN Schedule

This commit is contained in:
2025-10-09 21:34:42 +08:00
parent 1c622d8244
commit a3ef37e64a
9 changed files with 583 additions and 176 deletions

View File

@@ -1,4 +1,4 @@
<UserControl
<UserControl
x:Class="CapMachine.Wpf.Views.DialogLINSchConfigView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -8,6 +8,7 @@
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="1000"
Height="800"
mc:Ignorable="d">
@@ -31,7 +32,7 @@
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
<!--<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
<Button
Margin="10,0"
Command="{Binding OpCmd}"
@@ -52,7 +53,8 @@
Text="新增" />
</StackPanel>
</Button>
<!--<Button
-->
<!--<Button
Margin="10,0"
Command="{Binding CopyCmd}"
FontWeight="Bold"
@@ -71,6 +73,7 @@
Text="复制" />
</StackPanel>
</Button>-->
<!--
<Button
Margin="10,0"
Command="{Binding OpCmd}"
@@ -92,13 +95,35 @@
Text="删除" />
</StackPanel>
</Button>
</StackPanel>
</StackPanel>-->
<StackPanel
Margin="30,0"
HorizontalAlignment="Right"
Orientation="Horizontal">
<TextBlock
<Button
Margin="10,0"
Command="{Binding OpCmd}"
CommandParameter="LoadSch"
FontWeight="Bold"
Foreground="Green"
Style="{StaticResource MaterialDesignFlatAccentBgButton}">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="0,0,5,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="14"
Foreground="Green"
Text="&#xe63b;" />
<TextBlock
VerticalAlignment="Center"
FontSize="14"
Text="下载" />
</StackPanel>
</Button>
<!--<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
@@ -116,75 +141,50 @@
FontSize="20"
ItemsSource="{Binding SendOrderCbxItems}"
SelectedValue="{Binding CurSendOrder, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="Key" />
SelectedValuePath="Key" />-->
</StackPanel>
<Grid Grid.Row="1">
<DataGrid
x:Name="MainDatagrid"
<Border
Margin="5"
AutoGenerateColumns="False"
CanUserAddRows="False"
HeadersVisibility="Column"
ItemsSource="{Binding ListLINScheduleConfigDto}"
SelectionMode="Extended"
SelectionUnit="FullRow">
<DataGrid.Columns>
<!--<DataGridTextColumn
Binding="{Binding Index}"
Header="序号"
IsReadOnly="True" />-->
<DataGridTemplateColumn Width="260" Header="消息名">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox
DisplayMemberPath="Text"
ItemsSource="{Binding Source={StaticResource Proxy}, Path=Data.MsgCbxItems}"
SelectedValue="{Binding MsgName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="Key" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
Width="100"
Binding="{Binding Cycle}"
Header="周期" />
<!--<DataGridTemplateColumn Width="200" Header="发送方式">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox
DisplayMemberPath="Text"
ItemsSource="{Binding Source={StaticResource Proxy}, Path=Data.SendOrderCbxItems}"
SelectedValue="{Binding OrderSend, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="Key" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
<DataGridTemplateColumn Width="160" Header="调度器序号">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox
DisplayMemberPath="Text"
ItemsSource="{Binding Source={StaticResource Proxy}, Path=Data.SchTabIndexCbxItems}"
SelectedValue="{Binding SchTabIndex, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="Key" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--<DataGridCheckBoxColumn Binding="{Binding IsEnable}" Header="是否启用" />-->
</DataGrid.Columns>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<prism:InvokeCommandAction Command="{Binding GridSelectionChangedCmd}" CommandParameter="{Binding ElementName=MainDatagrid, Path=SelectedItem}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</DataGrid>
Padding="6"
BorderBrush="#D0D0D0"
BorderThickness="1"
CornerRadius="4">
<TreeView ItemsSource="{Binding SchTabTree}">
<TreeView.ItemTemplate>
<!-- 父节点模板:不使用 DataType避免类型解析 -->
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Text=" " />
<TextBlock
FontSize="20"
FontWeight="Bold"
Text="{Binding SchTabName}" />
</StackPanel>
<!-- 子节点模板:文本显示 -->
<HierarchicalDataTemplate.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock
FontSize="16"
Foreground="DimGray"
Text="• " />
<TextBlock FontSize="16" Foreground="DimGray">
<Run Text="{Binding MsgName}" />
<Run Text=" (Index: " />
<Run Text="{Binding MsgNameIndex}" />
<Run Text=")" />
</TextBlock>
</StackPanel>
</DataTemplate>
</HierarchicalDataTemplate.ItemTemplate>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</Border>
</Grid>
<StackPanel