-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
268 lines (231 loc) · 18.3 KB
/
MainWindow.xaml
File metadata and controls
268 lines (231 loc) · 18.3 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
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<Window x:Class="FieldEditor.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FieldEditor"
xmlns:oxy="http://oxyplot.org/wpf"
mc:Ignorable="d" Background="AliceBlue"
Height="720" Width="1300" WindowStartupLocation="CenterScreen" WindowState="Maximized" Title="FieldEditor">
<Window.Resources>
<Style x:Key="ColumnElementStyle" TargetType="TextBlock">
<Setter Property="Margin" Value="10,0,10,0" />
</Style>
<Style x:Key="DataGridContentCellCentering" TargetType="DataGridCell">
<Style.Resources>
<Style TargetType="ContentPresenter">
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
</Style.Resources>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="{x:Type Button}"/>
<Style TargetType="{x:Type Label}"/>
<Style TargetType="{x:Type Border}"/>
<Style TargetType="{x:Type CheckBox}"/>
<Style TargetType="{x:Type DataGrid}"/>
<Style TargetType="{x:Type ToolTip}"/>
<Style TargetType="{x:Type TextBlock}"/>
<Style TargetType="{x:Type StackPanel}"/>
<Style TargetType="{x:Type GroupBox}"/>
<Style TargetType="{x:Type ScrollBar}"/>
<Style TargetType="{x:Type TabControl}"/>
<Style TargetType="{x:Type TabItem}"/>
<Style TargetType="{x:Type TextBox}"/>
<Style TargetType="{x:Type oxy:TrackerControl}">
<Setter Property="LineStroke" Value="Red" />
</Style>
</Window.Resources>
<Grid Margin="10,10,10,10" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.7*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<DockPanel Margin="0,0,5,5" Grid.Column="0" Grid.Row="0" VerticalAlignment="Top" HorizontalAlignment="Stretch">
<Label Content="Field: " HorizontalAlignment="Left" VerticalAlignment="Center"></Label>
<ComboBox x:Name="BeamComboBox" HorizontalAlignment="Left" ItemsSource="{Binding DataGridBeam, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=True}" DisplayMemberPath="BeamId" Height="30" Width="100" VerticalAlignment="Center" VerticalContentAlignment="Center" SelectionChanged="BeamComboBox_SelectionChanged" SourceUpdated="DataGridControlPoints_SourceUpdated" IsSynchronizedWithCurrentItem="False"></ComboBox>
<Label Margin="10,0,0,0" Content="Mw plot type:" HorizontalAlignment="Left" VerticalAlignment="Center"></Label>
<ComboBox x:Name="MetersetPlotType" Height="30" Width="100" VerticalAlignment="Center" VerticalContentAlignment="Center" SelectionChanged="MetersetPlotType_SelectionChanged"></ComboBox>
<Button Margin="20,0,0,0" Content="Delete control points" Width="120" Click="Button_Click_3"></Button>
<Button Margin="10,0,0,0" Content="Add control point" Width="110" Click="Button_Click_4"></Button>
<Button Margin="10,0,0,0" Content="Copy MLC" Width="60" Click="Button_Click_7"></Button>
<Button Margin="10,0,0,0" Content="Copy Jaws" Width="60" Click="Button_Click_8"></Button>
<Button Margin="10,0,0,0" Content="Import" Width="60" Click="Button_Click_6"></Button>
<DockPanel HorizontalAlignment="Right" >
<Button Content="Help" Margin="0,0,5,0" Width="40" Click="Button_Click_5"> </Button>
<Button Margin="0,0,0,0" Content="New plan --> Add new fields" Click="Button_Click_1" Height="30" Width="170" Background="LightGreen"></Button>
<Button Margin="5,0,0,0" Content="Copy plan --> Change MLCs/Jaws in-place" Click="Button_Click" Height="30" Width="235" Background="LightGreen"></Button>
</DockPanel>
</DockPanel>
<Grid Margin="0,5,0,0" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<DataGrid x:Name="DataGridControlPoints" VerticalScrollBarVisibility="Visible" Grid.Column="0" Grid.Row="1" IsReadOnly="False" CanUserAddRows="False" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserSortColumns="False" HorizontalAlignment="Stretch" MaxHeight="{Binding RelativeSource={RelativeSource AncestorType={x:Type Grid}}, Path=ActualHeight}" VerticalAlignment="Top" Width="Auto" AutoGenerateColumns="False" ItemsSource="{Binding Path=SelectedItem.Datatable, ElementName=BeamComboBox}" SelectionChanged="DataGridControlPoints_SelectionChanged" PreviewKeyDown="DataGridControlPoints_PreviewKeyDown" SourceUpdated="DataGridControlPoints_SourceUpdated">
<DataGrid.Columns>
<DataGridTextColumn Header="Index" Width="60" IsReadOnly="True" Binding="{Binding Index, Mode=TwoWay, NotifyOnSourceUpdated=True}" ElementStyle="{StaticResource ColumnElementStyle}">
<DataGridTextColumn.EditingElementStyle>
<Style TargetType="TextBox">
<EventSetter Event="TextChanged" Handler="OnTextChanged" />
</Style>
</DataGridTextColumn.EditingElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Gantry" Width="150" IsReadOnly="False" Binding="{Binding Gantry, Mode=TwoWay, NotifyOnSourceUpdated=True}" ElementStyle="{StaticResource ColumnElementStyle}">
<DataGridTextColumn.EditingElementStyle>
<Style TargetType="TextBox">
<EventSetter Event="TextChanged" Handler="OnTextChanged" />
</Style>
</DataGridTextColumn.EditingElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="Meterset" Width="150" IsReadOnly="False" Binding="{Binding MetersetWeight, Mode=TwoWay, NotifyOnSourceUpdated=True}" ElementStyle="{StaticResource ColumnElementStyle}">
<DataGridTextColumn.EditingElementStyle>
<Style TargetType="TextBox">
<EventSetter Event="TextChanged" Handler="OnTextChanged" />
</Style>
</DataGridTextColumn.EditingElementStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<Grid Grid.Column="1" Grid.Row="1" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<DataGrid x:Name="DataGridJaws" Margin="5,0,0,0" Grid.Column="0" Grid.Row="0" IsReadOnly="False" CanUserAddRows="False" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserSortColumns="False" HorizontalAlignment="Stretch" MaxHeight="{Binding RelativeSource={RelativeSource AncestorType={x:Type Grid}}, Path=ActualHeight}" VerticalAlignment="Top" Width="Auto" AutoGenerateColumns="False" ItemsSource="{Binding Path=SelectedItem.JawPositions, ElementName=DataGridControlPoints}" SourceUpdated="DataGridJaws_SourceUpdated">
<DataGrid.Columns>
<DataGridTextColumn Header="JawX1" Width="70" IsReadOnly="False" Binding="{Binding JawX1, Mode=TwoWay, NotifyOnSourceUpdated=True}" ElementStyle="{StaticResource ColumnElementStyle}">
<DataGridTextColumn.EditingElementStyle>
<Style TargetType="TextBox">
<EventSetter Event="TextChanged" Handler="OnTextChanged" />
</Style>
</DataGridTextColumn.EditingElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="JawX2" Width="70" IsReadOnly="False" Binding="{Binding JawX2, Mode=TwoWay, NotifyOnSourceUpdated=True}" ElementStyle="{StaticResource ColumnElementStyle}">
<DataGridTextColumn.EditingElementStyle>
<Style TargetType="TextBox">
<EventSetter Event="TextChanged" Handler="OnTextChanged" />
</Style>
</DataGridTextColumn.EditingElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="JawY1" Width="70" IsReadOnly="False" Binding="{Binding JawY1, Mode=TwoWay, NotifyOnSourceUpdated=True}" ElementStyle="{StaticResource ColumnElementStyle}">
<DataGridTextColumn.EditingElementStyle>
<Style TargetType="TextBox">
<EventSetter Event="TextChanged" Handler="OnTextChanged" />
</Style>
</DataGridTextColumn.EditingElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="JawY2" Width="70" IsReadOnly="False" Binding="{Binding JawY2, Mode=TwoWay, NotifyOnSourceUpdated=True}" ElementStyle="{StaticResource ColumnElementStyle}">
<DataGridTextColumn.EditingElementStyle>
<Style TargetType="TextBox">
<EventSetter Event="TextChanged" Handler="OnTextChanged" />
</Style>
</DataGridTextColumn.EditingElementStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<DataGrid x:Name="DataGridMLC" Margin="5,0,0,0" VerticalScrollBarVisibility="Visible" Grid.Column="0" Grid.Row="1" IsReadOnly="False" CanUserAddRows="False" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserSortColumns="False" HorizontalAlignment="Stretch" MaxHeight="{Binding RelativeSource={RelativeSource AncestorType={x:Type Grid}}, Path=ActualHeight}" VerticalAlignment="Top" Width="Auto" AutoGenerateColumns="False" ItemsSource="{Binding Path=SelectedItem.MLCPositions, ElementName=DataGridControlPoints}" SourceUpdated="DataGridMLC_SourceUpdated" SelectionChanged="DataGridMLC_SelectionChanged" PreviewKeyDown="DataGridMLC_PreviewKeyDown">
<DataGrid.Columns>
<DataGridTextColumn Header="Num" Width="50" IsReadOnly="True" Binding="{Binding Num, Mode=TwoWay, NotifyOnSourceUpdated=True}" ElementStyle="{StaticResource ColumnElementStyle}">
<DataGridTextColumn.EditingElementStyle>
<Style TargetType="TextBox">
<EventSetter Event="TextChanged" Handler="OnTextChanged" />
</Style>
</DataGridTextColumn.EditingElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="MLC1" Width="115" IsReadOnly="False" Binding="{Binding MLC1, Mode=TwoWay, NotifyOnSourceUpdated=True}" ElementStyle="{StaticResource ColumnElementStyle}">
<DataGridTextColumn.EditingElementStyle>
<Style TargetType="TextBox">
<EventSetter Event="TextChanged" Handler="OnTextChanged" />
</Style>
</DataGridTextColumn.EditingElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="MLC2" Width="115" IsReadOnly="False" Binding="{Binding MLC2, Mode=TwoWay, NotifyOnSourceUpdated=True}" ElementStyle="{StaticResource ColumnElementStyle}">
<DataGridTextColumn.EditingElementStyle>
<Style TargetType="TextBox">
<EventSetter Event="TextChanged" Handler="OnTextChanged" />
</Style>
</DataGridTextColumn.EditingElementStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
<Grid Margin="5,0,0,0" Grid.Column="2" Grid.Row="0" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.7*"/>
<RowDefinition Height="0.3*"/>
</Grid.RowDefinitions>
<TabControl Grid.Row="0" Grid.Column="0" TabStripPlacement="Bottom" Background="{DynamicResource {x:Static SystemColors.InactiveBorderBrushKey}}">
<TabItem Header="Aperture">
<Grid x:Name="PlotApertureTab">
<oxy:PlotView x:Name="PlotAperture" Width="200" Height="200" IsMouseWheelEnabled="True" PreviewMouseWheel="PlotAperture_PreviewMouseWheel" VerticalAlignment="Top"/>
</Grid>
</TabItem>
<TabItem Header="Meterset">
<Grid x:Name="PlotMetersetTab">
<oxy:PlotView x:Name="PlotMeterset" Width="200" Height="200" IsMouseWheelEnabled="False" VerticalAlignment="Top"/>
</Grid>
</TabItem>
<TabItem Header="MLC position">
<Grid x:Name="PlotMLCPositionTab">
<oxy:PlotView x:Name="PlotMLCPosition" Width="200" Height="200" IsMouseWheelEnabled="False" VerticalAlignment="Top"/>
</Grid>
</TabItem>
</TabControl>
<Grid Margin="0,5,0,0" Grid.Column="2" Grid.Row="1" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="Apply to selection:" FontWeight="Bold"/>
<DockPanel Grid.Row="1" HorizontalAlignment="Left">
<Label Content="Parameter:"/>
<ComboBox Width="100" x:Name="ComboBoxSelectionParameter" VerticalContentAlignment="Center"></ComboBox>
<Label Content="Action:"/>
<ComboBox Width="100" x:Name="ComboBoxSelectionAction" VerticalContentAlignment="Center"></ComboBox>
<Label Content="Value:"/>
<TextBox Width="100" x:Name="TextBoxSelectionValue" VerticalContentAlignment="Center" TextChanged="OnTextChanged"/>
<Button Margin="5,0,0,0" Content="Apply" Click="Button_Click_2" VerticalContentAlignment="Center" Width="50"></Button>
</DockPanel>
</Grid>
</Grid>
</Grid>
</Grid>
</Grid>
</Grid>
</Window>