CommunicationView.xaml
8.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<Window
x:Class="HHECS.RobotTool.View.CommunicationView.CommunicationView"
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:hc="https://handyorg.github.io/handycontrol"
xmlns:local="clr-namespace:HHECS.RobotTool.View.CommunicationView"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewmodel="clr-namespace:HHECS.RobotTool.ViewModel.CommunicationVM"
Title="通讯配置"
d:DataContext="{d:DesignInstance Type=viewmodel:CommunicationVM}"
d:DesignHeight="450"
d:DesignWidth="800"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<DockPanel>
<StackPanel DockPanel.Dock="Top">
<hc:UniformSpacingPanel Spacing="10">
<hc:ElementGroup
Height="30"
Margin="0,1"
VerticalAlignment="Center"
Layout="Stack">
<Border Padding="6,0" Style="{StaticResource BorderRegion}">
<TextBlock
Width="50"
VerticalAlignment="Center"
Text="编号" />
</Border>
<TextBox MinWidth="150" Text="{Binding Code, UpdateSourceTrigger=PropertyChanged}" />
</hc:ElementGroup>
<hc:ElementGroup
Height="30"
VerticalAlignment="Center"
Layout="Stack">
<Border Padding="6,0" Style="{StaticResource BorderRegion}">
<TextBlock
Width="50"
VerticalAlignment="Center"
Text="名称" />
</Border>
<TextBox MinWidth="150" Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" />
</hc:ElementGroup>
<hc:ElementGroup
Height="30"
VerticalAlignment="Center"
Layout="Stack">
<Border Padding="6,0" Style="{StaticResource BorderRegion}">
<TextBlock
Width="50"
VerticalAlignment="Center"
Text="通讯方式" />
</Border>
<hc:ComboBox
MinWidth="150"
MaxWidth="200"
DisplayMemberPath="Key"
ItemsSource="{Binding CommunicationTypes}"
SelectedValue="{Binding CommunicationType}"
SelectedValuePath="Value"
Style="{StaticResource ComboBoxExtend}" />
</hc:ElementGroup>
</hc:UniformSpacingPanel>
<ToolBar
Margin="0,1"
Padding="4"
HorizontalAlignment="Right">
<hc:UniformSpacingPanel Spacing="5">
<Button
hc:IconElement.Geometry="{StaticResource SearchGeometry}"
Command="{Binding SerachCommand}"
Content="搜索"
Style="{StaticResource ButtonDefault}"
Visibility="{Binding BtnPairs[QueryBtn]}" />
<Button
hc:IconElement.Geometry="{StaticResource AddGeometry}"
Command="{Binding AddCommand}"
Content="新增"
Style="{StaticResource ButtonDefault}"
Visibility="{Binding BtnPairs[CreateBtn]}" />
<Button
hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"
Command="{Binding BatchDeleteCommand}"
CommandParameter="{Binding ElementName=DG, Path=SelectedItems}"
Content="批量删除"
Style="{StaticResource ButtonDanger}"
Visibility="{Binding BtnPairs[BatchDeleteBtn]}" />
</hc:UniformSpacingPanel>
</ToolBar>
</StackPanel>
<hc:Pagination
DataCountPerPage="{Binding PageSize}"
DockPanel.Dock="Bottom"
IsJumpEnabled="True"
MaxPageCount="{Binding MaxPage}"
PageIndex="{Binding PageIndex}">
<hc:Interaction.Triggers>
<hc:EventTrigger EventName="PageUpdated">
<hc:EventToCommand Command="{Binding PageUpdatedCommand}" PassEventArgsToCommand="True" />
</hc:EventTrigger>
</hc:Interaction.Triggers>
</hc:Pagination>
<DataGrid
Name="DG"
hc:DataGridAttach.CanUnselectAllWithBlankArea="True"
AutoGenerateColumns="False"
HeadersVisibility="All"
IsReadOnly="True"
ItemsSource="{Binding CommunicationConfigs}"
RowHeaderWidth="60"
Style="{StaticResource DataGrid.Small}">
<DataGrid.RowHeaderTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=DataGridRow}}" />
</DataTemplate>
</DataGrid.RowHeaderTemplate>
<DataGrid.Columns>
<DataGridTextColumn
Binding="{Binding Id}"
Header="Id"
Visibility="Hidden" />
<DataGridTextColumn Binding="{Binding Code}" Header="编号" />
<DataGridTextColumn Binding="{Binding Name}" Header="名称" />
<DataGridTextColumn Binding="{Binding CommunicationType}" Header="类型" />
<DataGridTextColumn Binding="{Binding IpAddress}" Header="IP地址" />
<DataGridTextColumn Binding="{Binding Port}" Header="端口号" />
<DataGridTextColumn Binding="{Binding Disable}" Header="是否禁用" />
<DataGridTextColumn Binding="{Binding Remark}" Header="备注" />
<DataGridTextColumn Binding="{Binding CreateTIme, StringFormat={}{0:yyyy/MM/dd HH:mm:ss}}" Header="创建时间" />
<DataGridTextColumn Binding="{Binding UpdatedTime, StringFormat={}{0:yyyy/MM/dd HH:mm:ss}}" Header="修改时间" />
<DataGridTemplateColumn Header="操作">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<hc:UniformSpacingPanel Spacing="5">
<Button
hc:IconElement.Geometry="{StaticResource DropperGeometry}"
Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}"
CommandParameter="{Binding Id}"
Content="编辑"
Style="{StaticResource ButtonDefault.Small}"
Visibility="{Binding Path=DataContext.BtnPairs[EditBtn], RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
<Button
hc:IconElement.Geometry="{StaticResource DeleteFillCircleGeometry}"
Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource AncestorType=DataGrid}}"
CommandParameter="{Binding Id}"
Content="删除"
Style="{StaticResource ButtonDanger.Small}"
Visibility="{Binding Path=DataContext.BtnPairs[DeleteBtn], RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" />
</hc:UniformSpacingPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</DockPanel>
</Window>