@@ -311,12 +311,14 @@ public enum CABViewControlUnits
311
311
LBS
312
312
}
313
313
314
- public static class DiscreteStates
314
+ public enum DiscreteStates
315
315
{
316
- public const string Lever = "lever" ;
317
- public const string TwoState = "twostate" ;
318
- public const string TriState = "tristate" ;
319
- public const string MultiState = "multistate" ;
316
+ LEVER ,
317
+ TWO_STATE ,
318
+ TRI_STATE ,
319
+ MULTI_STATE ,
320
+ COMBINED_CONTROL ,
321
+ CAB_SIGNAL_DISPLAY
320
322
}
321
323
322
324
public class CabViewControls : List < CabViewControl >
@@ -330,14 +332,14 @@ public CabViewControls(STFReader stf, string basepath)
330
332
new STFReader . TokenProcessor ( "ortsanimateddisplay" , ( ) => { Add ( new CVCAnimatedDisplay ( stf , basepath ) ) ; } ) ,
331
333
new STFReader . TokenProcessor ( "dial" , ( ) => { Add ( new CVCDial ( stf , basepath ) ) ; } ) ,
332
334
new STFReader . TokenProcessor ( "gauge" , ( ) => { Add ( new CVCGauge ( stf , basepath ) ) ; } ) ,
333
- new STFReader . TokenProcessor ( DiscreteStates . Lever , ( ) => { Add ( new CVCDiscrete ( stf , basepath , DiscreteStates . Lever ) ) ; } ) ,
334
- new STFReader . TokenProcessor ( DiscreteStates . TwoState , ( ) => { Add ( new CVCDiscrete ( stf , basepath , DiscreteStates . TwoState ) ) ; } ) ,
335
- new STFReader . TokenProcessor ( DiscreteStates . TriState , ( ) => { Add ( new CVCDiscrete ( stf , basepath , DiscreteStates . TriState ) ) ; } ) ,
336
- new STFReader . TokenProcessor ( DiscreteStates . MultiState , ( ) => { Add ( new CVCDiscrete ( stf , basepath , DiscreteStates . MultiState ) ) ; } ) ,
335
+ new STFReader . TokenProcessor ( "lever" , ( ) => { Add ( new CVCDiscrete ( stf , basepath , DiscreteStates . LEVER ) ) ; } ) ,
336
+ new STFReader . TokenProcessor ( "twostate" , ( ) => { Add ( new CVCDiscrete ( stf , basepath , DiscreteStates . TWO_STATE ) ) ; } ) ,
337
+ new STFReader . TokenProcessor ( "tristate" , ( ) => { Add ( new CVCDiscrete ( stf , basepath , DiscreteStates . TRI_STATE ) ) ; } ) ,
338
+ new STFReader . TokenProcessor ( "multistate" , ( ) => { Add ( new CVCDiscrete ( stf , basepath , DiscreteStates . MULTI_STATE ) ) ; } ) ,
337
339
new STFReader . TokenProcessor ( "multistatedisplay" , ( ) => { Add ( new CVCMultiStateDisplay ( stf , basepath ) ) ; } ) ,
338
- new STFReader . TokenProcessor ( "cabsignaldisplay" , ( ) => { Add ( new CVCSignal ( stf , basepath ) ) ; } ) ,
340
+ new STFReader . TokenProcessor ( "cabsignaldisplay" , ( ) => { Add ( new CVCSignal ( stf , basepath , DiscreteStates . CAB_SIGNAL_DISPLAY ) ) ; } ) ,
339
341
new STFReader . TokenProcessor ( "digital" , ( ) => { Add ( new CVCDigital ( stf , basepath ) ) ; } ) ,
340
- new STFReader . TokenProcessor ( "combinedcontrol" , ( ) => { Add ( new CVCDiscrete ( stf , basepath ) ) ; } ) ,
342
+ new STFReader . TokenProcessor ( "combinedcontrol" , ( ) => { Add ( new CVCDiscrete ( stf , basepath , DiscreteStates . COMBINED_CONTROL ) ) ; } ) ,
341
343
new STFReader . TokenProcessor ( "firebox" , ( ) => { Add ( new CVCFirebox ( stf , basepath ) ) ; } ) ,
342
344
new STFReader . TokenProcessor ( "dialclock" , ( ) => { ProcessDialClock ( stf , basepath ) ; } ) ,
343
345
new STFReader . TokenProcessor ( "digitalclock" , ( ) => { Add ( new CVCDigitalClock ( stf , basepath ) ) ; } ) ,
@@ -853,7 +855,7 @@ public class CVCDiscrete : CVCWithFrames
853
855
private int numPositions ;
854
856
private bool canFill = true ;
855
857
856
- public CVCDiscrete ( STFReader stf , string basepath , string discreteStates = null )
858
+ public CVCDiscrete ( STFReader stf , string basepath , DiscreteStates discreteStates )
857
859
{
858
860
// try
859
861
{
@@ -1160,20 +1162,20 @@ public CVCDiscrete(STFReader stf, string basepath, string discreteStates = null)
1160
1162
1161
1163
switch ( discreteStates )
1162
1164
{
1163
- case DiscreteStates . TriState :
1165
+ case DiscreteStates . TRI_STATE :
1164
1166
MaxValue = 2.0f ; // So that LocomotiveViewerExtensions.GetWebControlValueList() returns right value to web server
1165
1167
break ;
1166
1168
default :
1167
1169
break ;
1168
1170
}
1169
1171
}
1170
- // catch (Exception error)
1171
- // {
1172
- // if (error is STFException) // Parsing error, so pass it on
1173
- // throw;
1174
- // else // Unexpected error, so provide a hint
1175
- // throw new STFException(stf, "Problem with NumPositions/NumValues/NumFrames/ScaleRange");
1176
- // } // End of Need check the Values collection for validity
1172
+ // catch (Exception error)
1173
+ // {
1174
+ // if (error is STFException) // Parsing error, so pass it on
1175
+ // throw;
1176
+ // else // Unexpected error, so provide a hint
1177
+ // throw new STFException(stf, "Problem with NumPositions/NumValues/NumFrames/ScaleRange");
1178
+ // } // End of Need check the Values collection for validity
1177
1179
} // End of Constructor
1178
1180
}
1179
1181
#endregion
@@ -1310,8 +1312,8 @@ protected void ParseCustomParameters(STFReader stf)
1310
1312
#region other controls
1311
1313
public class CVCSignal : CVCDiscrete
1312
1314
{
1313
- public CVCSignal ( STFReader inf , string basepath )
1314
- : base ( inf , basepath )
1315
+ public CVCSignal ( STFReader inf , string basepath , DiscreteStates discreteStates )
1316
+ : base ( inf , basepath , discreteStates )
1315
1317
{
1316
1318
FramesCount = 8 ;
1317
1319
FramesX = 4 ;
@@ -1325,5 +1327,4 @@ public CVCSignal(STFReader inf, string basepath)
1325
1327
}
1326
1328
}
1327
1329
#endregion
1328
- }
1329
-
1330
+ }
0 commit comments