This repository has been archived by the owner on Jul 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathMainWindow.xaml
219 lines (214 loc) · 17.5 KB
/
MainWindow.xaml
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<Window x:Class="CreateKnxProd.MainWindow"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CreateKnxProd"
xmlns:lc="clr-namespace:CreateKnxProd.Converter"
xmlns:model="clr-namespace:CreateKnxProd.Model"
xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
xmlns:lex="http://wpflocalizeextension.codeplex.com"
lex:ResxLocalizationProvider.DefaultAssembly="CreateKnxProd"
lex:ResxLocalizationProvider.DefaultDictionary="Ressources"
mc:Ignorable="d"
d:DataContext ="{d:DesignInstance {x:Type local:MainWindowViewModel}, IsDesignTimeCreatable=True}"
Title="{lex:Loc WindowTitle}" Height="450" Width="800">
<Window.Resources>
<lc:EnableTBoolTypeConverter x:Key="EnableBoolConverter"/>
<lc:ObjectVisibilityConverter x:Key="ObjectVisibilityConverter"/>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<ToolBarTray>
<ToolBar>
<Button Content="{lex:Loc New}" Command="{Binding CreateNewCommand}"/>
<Button Content="{lex:Loc Open}" Command="{Binding OpenCommand}"/>
<Button Content="{lex:Loc Close}" Command="{Binding CloseCommand}"/>
<Button Content="{lex:Loc Save}" Command="{Binding SaveCommand}"/>
<Button Content="{lex:Loc SaveAs}" Command="{Binding SaveAsCommand}"/>
<Button Content="{lex:Loc Export}" Command="{Binding ExportCommand}"/>
</ToolBar>
</ToolBarTray>
<TabControl Grid.Row="1" IsEnabled="{Binding EditEnabled}">
<TabItem Header="{lex:Loc Common}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Margin="3" Text="{lex:Loc Name}" Grid.Column="1" Grid.Row="0"/>
<TextBox Margin="3" Text="{Binding HardwareName, UpdateSourceTrigger=PropertyChanged}" Grid.Column="2" Grid.Row="0" Width="200"/>
<TextBlock Margin="3" Text="{lex:Loc HardwareVersion}" Grid.Column="1" Grid.Row="1"/>
<TextBox Margin="3" Text="{Binding HardwareVersion, UpdateSourceTrigger=PropertyChanged}" Grid.Column="2" Grid.Row="1" Width="200"/>
<TextBlock Margin="3" Text="{lex:Loc SerialNumber}" Grid.Column="1" Grid.Row="2"/>
<TextBox Margin="3" Text="{Binding HardwareSerial, UpdateSourceTrigger=PropertyChanged}" Grid.Column="2" Grid.Row="2" Width="200"/>
<TextBlock Margin="3" Text="{lex:Loc ProductName}" Grid.Column="1" Grid.Row="3"/>
<TextBox Margin="3" Text="{Binding ProductName, UpdateSourceTrigger=PropertyChanged}" Grid.Column="2" Grid.Row="3" Width="200"/>
<TextBlock Margin="3" Text="{lex:Loc OrderNumber}" Grid.Column="1" Grid.Row="4"/>
<TextBox Margin="3" Text="{Binding OrderNumber, UpdateSourceTrigger=PropertyChanged}" Grid.Column="2" Grid.Row="4" Width="200"/>
<TextBlock Margin="3" Text="{lex:Loc ApplicationName}" Grid.Column="1" Grid.Row="5"/>
<TextBox Margin="3" Text="{Binding ApplicationName, UpdateSourceTrigger=PropertyChanged}" Grid.Column="2" Grid.Row="5" Width="200"/>
<TextBlock Margin="3" Text="{lex:Loc ApplicationVersion}" Grid.Column="1" Grid.Row="6"/>
<TextBox Margin="3" Text="{Binding ApplicationVersion, UpdateSourceTrigger=PropertyChanged}" Grid.Column="2" Grid.Row="6" Width="200"/>
<TextBlock Margin="3" Text="{lex:Loc ApplicationNumber}" Grid.Column="1" Grid.Row="7"/>
<TextBox Margin="3" Text="{Binding ApplicationNumber, UpdateSourceTrigger=PropertyChanged}" Grid.Column="2" Grid.Row="7" Width="200"/>
<TextBlock Margin="3" Text="{lex:Loc MediumType}" Grid.Column="1" Grid.Row="8"/>
<ComboBox Margin="3" SelectedValuePath="Tag" SelectedValue="{Binding MediumType, UpdateSourceTrigger=PropertyChanged}" Grid.Column="2" Grid.Row="8" Width="200">
<ComboBoxItem Content="{lex:Loc IP}" Tag="MT-5"/>
<ComboBoxItem Content="{lex:Loc TP}" Tag="MT-0"/>
<ComboBoxItem Content="{lex:Loc RF}" Tag="MT-2"/>
</ComboBox>
<TextBlock Margin="3" Text="{lex:Loc ReplacesVersions}" Grid.Column="1" Grid.Row="9"/>
<TextBox Margin="3" Grid.Column="2" Grid.Row="9" Text="{Binding ReplacesVersions, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Margin="3" Text="{lex:Loc IsSecureEnabled}" Grid.Column="1" Grid.Row="10"/>
<CheckBox Margin="3" Grid.Column="2" Grid.Row="10" IsChecked="{Binding IsSecureEnabled}"/>
<TextBlock Margin="3" Text="{lex:Loc MaxSecurityIndividualAddressEntries}" Grid.Column="1" Grid.Row="11"/>
<TextBox Margin="3" Text="{Binding MaxSecurityIndividualAddressEntries, UpdateSourceTrigger=PropertyChanged}" Grid.Column="2" Grid.Row="11" Width="200"/>
<TextBlock Margin="3" Text="{lex:Loc MaxSecurityGroupKeyTableEntries}" Grid.Column="1" Grid.Row="12"/>
<TextBox Margin="3" Text="{Binding MaxSecurityGroupKeyTableEntries, UpdateSourceTrigger=PropertyChanged}" Grid.Column="2" Grid.Row="12" Width="200"/>
<TextBlock Margin="3" Text="{lex:Loc IsRailMounted}" Grid.Column="1" Grid.Row="13"/>
<CheckBox Margin="3" Grid.Column="2" Grid.Row="13" IsChecked="{Binding IsRailMounted}" />
<TextBlock Margin="3" Text="{lex:Loc BusCurrent}" Grid.Column="1" Grid.Row="14"/>
<TextBox Margin="3" Grid.Column="2" Grid.Row="14" Text="{Binding BusCurrent}" />
</Grid>
</TabItem>
<TabItem Header="{lex:Loc ParameterBlock}">
<DataGrid ItemsSource="{Binding ParameterBlock }" AutoGenerateColumns="False"
CanUserDeleteRows="True" dd:DragDrop.IsDragSource="True" dd:DragDrop.IsDropTarget="True">
<DataGrid.Columns>
<DataGridTextColumn Header="{lex:Loc Name}" Binding="{Binding Name, UpdateSourceTrigger=PropertyChanged}" />
<DataGridTextColumn Header="{lex:Loc Text}" Binding="{Binding Text, UpdateSourceTrigger=PropertyChanged}" />
</DataGrid.Columns>
</DataGrid>
</TabItem>
<TabItem Header="{lex:Loc ParameterTypes}">
<DataGrid ItemsSource="{Binding ParameterTypes }" AutoGenerateColumns="False"
CanUserDeleteRows="True" dd:DragDrop.IsDragSource="True" dd:DragDrop.IsDropTarget="True">
<DataGrid.Columns>
<DataGridTextColumn Header="{lex:Loc Name}" Binding="{Binding Name, UpdateSourceTrigger=PropertyChanged}" />
<DataGridComboBoxColumn Header="{lex:Loc Type}" SelectedItemBinding="{Binding Type, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{x:Static model:EnumExtension.GetEnumParameterTypTypes}" />
<DataGridTextColumn Header="{lex:Loc SizeInByte}" Binding="{Binding SizeInByte}" IsReadOnly="True"/>
</DataGrid.Columns>
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<StackPanel.Resources>
<DataTemplate DataType="{x:Type model:ParameterType_TTypeText}">
</DataTemplate>
<DataTemplate DataType="{x:Type model:ParameterType_TTypeFloat}">
</DataTemplate>
<DataTemplate DataType="{x:Type model:ParameterType_TTypeNumber}">
</DataTemplate>
<DataTemplate DataType="{x:Type model:ParameterType_TTypeRestriction}">
</DataTemplate>
</StackPanel.Resources>
<!--<ContentPresenter Content="{Binding Item}">-->
<StackPanel Orientation="Horizontal" Visibility="{Binding TypeText, Converter={StaticResource ObjectVisibilityConverter}}">
<TextBlock Text="{lex:Loc CharacterCount}" Margin="5"/>
<TextBox Width="50" Margin="5" Text="{Binding TypeText.SizeInByte, UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Visibility="{Binding TypeFloat, Converter={StaticResource ObjectVisibilityConverter}}">
<TextBlock Text="{lex:Loc Minimum}" Margin="5"/>
<TextBox Width="50" Margin="5" Text="{Binding TypeFloat.MinInclusive, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="{lex:Loc Maximum}" Margin="5"/>
<TextBox Width="50" Margin="5" Text="{Binding TypeFloat.MaxInclusive, UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Visibility="{Binding TypeNumber, Converter={StaticResource ObjectVisibilityConverter}}">
<TextBlock Text="{lex:Loc Minimum}" Margin="5"/>
<TextBox Width="50" Margin="5" Text="{Binding TypeNumber.MinInclusive, UpdateSourceTrigger=PropertyChanged}"/>
<TextBlock Text="{lex:Loc Maximum}" Margin="5"/>
<TextBox Width="50" Margin="5" Text="{Binding TypeNumber.MaxInclusive, UpdateSourceTrigger=PropertyChanged}"/>
</StackPanel>
<DataGrid ItemsSource="{Binding TypeRestriction.Enumeration}" Margin="5" AutoGenerateColumns="False"
dd:DragDrop.IsDragSource="True" dd:DragDrop.IsDropTarget="True" Visibility="{Binding TypeRestriction, Converter={StaticResource ObjectVisibilityConverter}}">
<DataGrid.Columns>
<DataGridTextColumn Header="{lex:Loc Value}" Binding="{Binding Value, UpdateSourceTrigger=PropertyChanged}" />
<DataGridTextColumn Header="{lex:Loc Text}" Binding="{Binding Text, UpdateSourceTrigger=PropertyChanged}" Width="200"/>
</DataGrid.Columns>
</DataGrid>
</StackPanel>
</DataTemplate>
</DataGrid.RowDetailsTemplate>
</DataGrid>
</TabItem>
<TabItem Header="{lex:Loc Parameters}">
<DataGrid ItemsSource="{Binding Parameters }" AutoGenerateColumns="False"
dd:DragDrop.IsDragSource="True" dd:DragDrop.IsDropTarget="True">
<DataGrid.Columns>
<DataGridComboBoxColumn Header="{lex:Loc Block}" SelectedItemBinding="{Binding Block, UpdateSourceTrigger=PropertyChanged}"
DisplayMemberPath="Name">
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="ItemsSource" Value="{Binding Path=DataContext.ParameterBlock, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" />
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="ItemsSource" Value="{Binding Path=DataContext.ParameterBlock, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" />
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
</DataGridComboBoxColumn>
<DataGridTextColumn Header="{lex:Loc Name}" Binding="{Binding Name, UpdateSourceTrigger=PropertyChanged}" />
<DataGridComboBoxColumn Header="{lex:Loc Type}" SelectedItemBinding="{Binding Type, UpdateSourceTrigger=PropertyChanged}"
DisplayMemberPath="Name">
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="ItemsSource" Value="{Binding Path=DataContext.ParameterTypes, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" />
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="ItemsSource" Value="{Binding Path=DataContext.ParameterTypes, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" />
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
</DataGridComboBoxColumn>
<DataGridTextColumn Header="{lex:Loc Text}" Binding="{Binding Text, UpdateSourceTrigger=PropertyChanged}"/>
<DataGridTextColumn Header="{lex:Loc Value}" Binding="{Binding Value, UpdateSourceTrigger=PropertyChanged}"/>
</DataGrid.Columns>
</DataGrid>
</TabItem>
<TabItem Header="{lex:Loc ComObjects}">
<DataGrid ItemsSource="{Binding ComObjects }" AutoGenerateColumns="False"
dd:DragDrop.IsDragSource="True" dd:DragDrop.IsDropTarget="True">
<DataGrid.Columns>
<DataGridTextColumn Header="{lex:Loc Text}" Binding="{Binding Text, UpdateSourceTrigger=PropertyChanged}" />
<DataGridTextColumn Header="{lex:Loc FunctionText}" Binding="{Binding FunctionText, UpdateSourceTrigger=PropertyChanged}" />
<DataGridComboBoxColumn Header="{lex:Loc Size}" SelectedItemBinding="{Binding ObjectSize, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{x:Static model:EnumExtension.GetEnumComObjectSize_T}" />
<DataGridCheckBoxColumn Header="{lex:Loc CFlag}" Binding="{Binding CommunicationFlag, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource EnableBoolConverter}}" />
<DataGridCheckBoxColumn Header="{lex:Loc RFlag}" Binding="{Binding ReadFlag, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource EnableBoolConverter}}" />
<DataGridCheckBoxColumn Header="{lex:Loc WFlag}" Binding="{Binding WriteFlag, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource EnableBoolConverter}}" />
<DataGridCheckBoxColumn Header="{lex:Loc TFlag}" Binding="{Binding TransmitFlag, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource EnableBoolConverter}}" />
<DataGridCheckBoxColumn Header="{lex:Loc UFlag}" Binding="{Binding UpdateFlag, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource EnableBoolConverter}}" />
<DataGridComboBoxColumn Header="{lex:Loc Priority}" SelectedItemBinding="{Binding Priority, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{x:Static model:EnumExtension.GetEnumComObjectPriority_T}" />
</DataGrid.Columns>
</DataGrid>
</TabItem>
</TabControl>
</Grid>
</Window>