@@ -50,6 +50,8 @@ protected override ControlLayout Layout(ControlLayout layout)
50
50
51
51
TrainCar trainCar = Viewer . PlayerTrain . Cars [ CarPosition ] ;
52
52
BrakeSystem brakeSystem = ( trainCar as MSTSWagon ) . BrakeSystem ;
53
+ MSTSLocomotive locomotive = trainCar as MSTSLocomotive ;
54
+ MSTSWagon wagon = trainCar as MSTSWagon ;
53
55
54
56
BrakeSystem rearBrakeSystem = null ;
55
57
if ( CarPosition + 1 < Viewer . PlayerTrain . Cars . Count )
@@ -58,11 +60,14 @@ protected override ControlLayout Layout(ControlLayout layout)
58
60
rearBrakeSystem = ( rearTrainCar as MSTSWagon ) . BrakeSystem ;
59
61
}
60
62
63
+ bool isElectricDieselLocomotive = ( Viewer . PlayerTrain . Cars [ CarPosition ] is MSTSElectricLocomotive ) || ( Viewer . PlayerTrain . Cars [ CarPosition ] is MSTSDieselLocomotive ) ;
64
+
61
65
var vbox = base . Layout ( layout ) . AddLayoutVertical ( ) ;
62
- vbox . Add ( ID = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , Viewer . Catalog . GetString ( "Car ID" ) + " " + ( CarPosition >= Viewer . PlayerTrain . Cars . Count ? " " : Viewer . PlayerTrain . Cars [ CarPosition ] . CarID ) , LabelAlignment . Center ) ) ;
66
+ vbox . Add ( ID = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , Viewer . Catalog . GetString ( "Car ID" ) + " " + ( CarPosition >= Viewer . PlayerTrain . Cars . Count ? " " : Viewer . PlayerTrain . Cars [ CarPosition ] . CarID ) , LabelAlignment . Center ) ) ;
63
67
ID . Color = Color . Red ;
64
68
vbox . AddHorizontalSeparator ( ) ;
65
69
70
+ // Handbrake
66
71
string buttonHandbrakeText = "" ;
67
72
if ( ( trainCar as MSTSWagon ) . GetTrainHandbrakeStatus ( ) )
68
73
buttonHandbrakeText = Viewer . Catalog . GetString ( "Unset Handbrake" ) ;
@@ -71,15 +76,38 @@ protected override ControlLayout Layout(ControlLayout layout)
71
76
vbox . Add ( buttonHandbrake = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , buttonHandbrakeText , LabelAlignment . Center ) ) ;
72
77
vbox . AddHorizontalSeparator ( ) ;
73
78
74
- vbox . Add ( buttonTogglePower = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , Viewer . Catalog . GetString ( "Toggle Power" ) , LabelAlignment . Center ) ) ;
79
+ // Power Supply
80
+ if ( locomotive != null )
81
+ if ( locomotive . LocomotivePowerSupply . MainPowerSupplyOn )
82
+ vbox . Add ( buttonTogglePower = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , Viewer . Catalog . GetString ( "Power Off" ) , LabelAlignment . Center ) ) ;
83
+ else
84
+ vbox . Add ( buttonTogglePower = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , Viewer . Catalog . GetString ( "Power On" ) , LabelAlignment . Center ) ) ;
85
+ else
86
+ vbox . Add ( buttonTogglePower = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , Viewer . Catalog . GetString ( "Power On" ) , LabelAlignment . Center ) ) ;
75
87
vbox . AddHorizontalSeparator ( ) ;
76
- vbox . Add ( buttonToggleMU = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , Viewer . Catalog . GetString ( "Toggle MU Connection" ) , LabelAlignment . Center ) ) ;
88
+
89
+ // MU Connection
90
+ if ( ( locomotive != null ) && ( locomotive . RemoteControlGroup >= 0 ) )
91
+ vbox . Add ( buttonToggleMU = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , Viewer . Catalog . GetString ( "Disconnect MU Connection" ) , LabelAlignment . Center ) ) ;
92
+ else
93
+ vbox . Add ( buttonToggleMU = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , Viewer . Catalog . GetString ( "Connect MU Connection" ) , LabelAlignment . Center ) ) ;
77
94
vbox . AddHorizontalSeparator ( ) ;
78
- vbox . Add ( buttonToggleBatterySwitch = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , Viewer . Catalog . GetString ( "Toggle Battery Switch" ) , LabelAlignment . Center ) ) ;
95
+
96
+ // Battery Switch
97
+ if ( ( wagon != null ) && ( wagon . PowerSupply is IPowerSupply ) && ( wagon . PowerSupply . BatterySwitch . On ) )
98
+ vbox . Add ( buttonToggleBatterySwitch = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , Viewer . Catalog . GetString ( "Battery Switch Off" ) , LabelAlignment . Center ) ) ;
99
+ else
100
+ vbox . Add ( buttonToggleBatterySwitch = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , Viewer . Catalog . GetString ( "Battery Switch On" ) , LabelAlignment . Center ) ) ;
79
101
vbox . AddHorizontalSeparator ( ) ;
80
- vbox . Add ( buttonToggleElectricTrainSupplyCable = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , Viewer . Catalog . GetString ( "Toggle Electric Train Supply Connection" ) , LabelAlignment . Center ) ) ;
102
+
103
+ // Electric Train Supply Connection
104
+ if ( ( wagon . PowerSupply != null ) && wagon . PowerSupply . FrontElectricTrainSupplyCableConnected )
105
+ vbox . Add ( buttonToggleElectricTrainSupplyCable = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , Viewer . Catalog . GetString ( "Disonnect Electric Train Supply" ) , LabelAlignment . Center ) ) ;
106
+ else
107
+ vbox . Add ( buttonToggleElectricTrainSupplyCable = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , Viewer . Catalog . GetString ( "Connect Electric Train Supply" ) , LabelAlignment . Center ) ) ;
81
108
vbox . AddHorizontalSeparator ( ) ;
82
109
110
+ // Front Brake Hose
83
111
string buttonToggleFronBrakeHoseText = "" ;
84
112
if ( brakeSystem . FrontBrakeHoseConnected )
85
113
buttonToggleFronBrakeHoseText = Viewer . Catalog . GetString ( "Disconnect Front Brake Hose" ) ;
@@ -88,6 +116,7 @@ protected override ControlLayout Layout(ControlLayout layout)
88
116
vbox . Add ( buttonToggleFrontBrakeHose = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , buttonToggleFronBrakeHoseText , LabelAlignment . Center ) ) ;
89
117
vbox . AddHorizontalSeparator ( ) ;
90
118
119
+ // Rear Brake Hose
91
120
string buttonToggleRearBrakeHoseText = "" ;
92
121
if ( ( ( CarPosition + 1 ) < Viewer . PlayerTrain . Cars . Count ) && ( rearBrakeSystem . FrontBrakeHoseConnected ) )
93
122
buttonToggleRearBrakeHoseText = Viewer . Catalog . GetString ( "Disconnect Rear Brake Hose" ) ;
@@ -96,6 +125,7 @@ protected override ControlLayout Layout(ControlLayout layout)
96
125
vbox . Add ( buttonToggleRearBrakeHose = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , buttonToggleRearBrakeHoseText , LabelAlignment . Center ) ) ;
97
126
vbox . AddHorizontalSeparator ( ) ;
98
127
128
+ // Front Angle Cock
99
129
string buttonToggleAngleCockAText = "" ;
100
130
if ( brakeSystem . AngleCockAOpen )
101
131
buttonToggleAngleCockAText = Viewer . Catalog . GetString ( "Close Front Angle Cock" ) ;
@@ -104,6 +134,7 @@ protected override ControlLayout Layout(ControlLayout layout)
104
134
vbox . Add ( buttonToggleAngleCockA = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , buttonToggleAngleCockAText , LabelAlignment . Center ) ) ;
105
135
vbox . AddHorizontalSeparator ( ) ;
106
136
137
+ // Rear Angle Cock
107
138
string buttonToggleAngleCockBText = "" ;
108
139
if ( brakeSystem . AngleCockBOpen )
109
140
buttonToggleAngleCockBText = Viewer . Catalog . GetString ( "Close Rear Angle Cock" ) ;
@@ -112,6 +143,7 @@ protected override ControlLayout Layout(ControlLayout layout)
112
143
vbox . Add ( buttonToggleAngleCockB = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , buttonToggleAngleCockBText , LabelAlignment . Center ) ) ;
113
144
vbox . AddHorizontalSeparator ( ) ;
114
145
146
+ // Bleed Off Valve
115
147
string buttonToggleBleedOffValveAText = "" ;
116
148
if ( brakeSystem . BleedOffValveOpen )
117
149
buttonToggleBleedOffValveAText = Viewer . Catalog . GetString ( "Close Bleed Off Valve" ) ;
@@ -120,29 +152,63 @@ protected override ControlLayout Layout(ControlLayout layout)
120
152
vbox . Add ( buttonToggleBleedOffValve = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , buttonToggleBleedOffValveAText , LabelAlignment . Center ) ) ;
121
153
vbox . AddHorizontalSeparator ( ) ;
122
154
155
+ // Close button
123
156
vbox . Add ( buttonClose = new Label ( vbox . RemainingWidth , Owner . TextFontDefault . Height , Viewer . Catalog . GetString ( "Close window" ) , LabelAlignment . Center ) ) ;
124
157
158
+ // add click controls
159
+
160
+ // Handbrake
125
161
if ( ( trainCar as MSTSWagon ) . HandBrakePresent )
126
162
buttonHandbrake . Click += new Action < Control , Point > ( buttonHandbrake_Click ) ;
127
163
else
128
164
buttonHandbrake . Color = Color . Gray ;
129
- buttonTogglePower . Click += new Action < Control , Point > ( buttonTogglePower_Click ) ;
130
- buttonToggleMU . Click += new Action < Control , Point > ( buttonToggleMU_Click ) ;
131
- buttonToggleBatterySwitch . Click += new Action < Control , Point > ( buttonToggleBatterySwitch_Click ) ;
132
- buttonToggleElectricTrainSupplyCable . Click += new Action < Control , Point > ( buttonToggleElectricTrainSupplyCable_Click ) ;
133
165
166
+ // Power Supply
167
+ if ( isElectricDieselLocomotive )
168
+ buttonTogglePower . Click += new Action < Control , Point > ( buttonTogglePower_Click ) ;
169
+ else
170
+ buttonTogglePower . Color = Color . Gray ;
171
+
172
+ // MU Connection
173
+ if ( isElectricDieselLocomotive )
174
+ buttonToggleMU . Click += new Action < Control , Point > ( buttonToggleMU_Click ) ;
175
+ else
176
+ buttonToggleMU . Color = Color . Gray ;
177
+
178
+ // Battery Switch
179
+ if ( ( wagon != null ) && ( wagon . PowerSupply is IPowerSupply ) )
180
+ buttonToggleBatterySwitch . Click += new Action < Control , Point > ( buttonToggleBatterySwitch_Click ) ;
181
+ else
182
+ buttonToggleBatterySwitch . Color = Color . Gray ;
183
+
184
+ // Electric Train Supply Connection
185
+ if ( ( wagon != null ) && ( wagon . PowerSupply != null ) )
186
+ buttonToggleElectricTrainSupplyCable . Click += new Action < Control , Point > ( buttonToggleElectricTrainSupplyCable_Click ) ;
187
+ else
188
+ buttonToggleElectricTrainSupplyCable . Color = Color . Gray ;
189
+
190
+ // Front Brake Hose
134
191
if ( CarPosition > 0 )
135
192
buttonToggleFrontBrakeHose . Click += new Action < Control , Point > ( buttonToggleFrontBrakeHose_Click ) ;
136
193
else
137
194
buttonToggleFrontBrakeHose . Color = Color . Gray ;
195
+
196
+ // Rear Brake Hose
138
197
if ( CarPosition < ( Viewer . PlayerTrain . Cars . Count - 1 ) )
139
198
buttonToggleRearBrakeHose . Click += new Action < Control , Point > ( buttonToggleRearBrakeHose_Click ) ;
140
199
else
141
200
buttonToggleRearBrakeHose . Color = Color . Gray ;
142
201
202
+ // Front Angle Cock
143
203
buttonToggleAngleCockA . Click += new Action < Control , Point > ( buttonToggleAngleCockA_Click ) ;
204
+
205
+ // Rear Angle Cock
144
206
buttonToggleAngleCockB . Click += new Action < Control , Point > ( buttonToggleAngleCockB_Click ) ;
207
+
208
+ // Bleed Off Valve
145
209
buttonToggleBleedOffValve . Click += new Action < Control , Point > ( buttonToggleBleedOffValve_Click ) ;
210
+
211
+ // Close button
146
212
buttonClose . Click += new Action < Control , Point > ( buttonClose_Click ) ;
147
213
148
214
return vbox ;
0 commit comments