@@ -157,11 +157,18 @@ public void ExitWindow(DPIWindow window)
157
157
public class DPDefaultWindow : DPIWindow
158
158
{
159
159
public bool FullTable ;
160
+ public CABViewControlUnits LoadUnits = CABViewControlUnits . KILO_LBS ;
160
161
public DPDefaultWindow ( DistributedPowerInterface dpi , CabViewControl control ) : base ( dpi , 640 , 240 )
161
162
{
162
163
var param = ( control as CVCScreen ) . CustomParameters ;
163
164
if ( param . ContainsKey ( "fulltable" ) ) bool . TryParse ( param [ "fulltable" ] , out FullTable ) ;
164
- DPITable DPITable = new DPITable ( FullTable , fullScreen : true , dpi : dpi ) ;
165
+ if ( param . ContainsKey ( "loadunits" ) )
166
+ {
167
+ string sUnits = param [ "loadunits" ] . ToUpper ( ) ;
168
+ sUnits = sUnits . Replace ( '/' , '_' ) ;
169
+ CABViewControlUnits . TryParse ( sUnits , out LoadUnits ) ;
170
+ }
171
+ DPITable DPITable = new DPITable ( FullTable , LoadUnits , fullScreen : true , dpi : dpi ) ;
165
172
AddToLayout ( DPITable , new Point ( 0 , 0 ) ) ;
166
173
}
167
174
}
@@ -360,6 +367,7 @@ public class DPITable : DPIWindow
360
367
readonly int RowHeight = 34 ;
361
368
readonly int ColLength = 88 ;
362
369
public bool FullTable = true ;
370
+ public CABViewControlUnits LoadUnits ;
363
371
364
372
// Change text color
365
373
readonly Dictionary < string , Color > ColorCodeCtrl = new Dictionary < string , Color >
@@ -378,11 +386,12 @@ public class DPITable : DPIWindow
378
386
379
387
protected string [ ] FirstColumn = { "ID" , "Throttle" , "Load" , "BP" , "Flow" , "Remote" , "ER" , "BC" , "MR" } ;
380
388
381
- public DPITable ( bool fullTable , bool fullScreen , DistributedPowerInterface dpi ) : base ( dpi , 640 , fullTable ? 230 : 162 )
389
+ public DPITable ( bool fullTable , CABViewControlUnits loadUnits , bool fullScreen , DistributedPowerInterface dpi ) : base ( dpi , 640 , fullTable ? 230 : 162 )
382
390
{
383
391
DPI = dpi ;
384
392
FullScreen = fullScreen ;
385
393
FullTable = fullTable ;
394
+ LoadUnits = loadUnits ;
386
395
BackgroundColor = DPI . BlackWhiteTheme ? Color . Black : ColorBackground ;
387
396
SetFont ( ) ;
388
397
string text = "" ;
@@ -459,7 +468,7 @@ public override void PrepareFrame(DPIStatus dpiStatus)
459
468
{
460
469
if ( dpUId != ( train . Cars [ i ] as MSTSLocomotive ) . DPUnitID )
461
470
{
462
- var status = ( train . Cars [ i ] as MSTSDieselLocomotive ) . GetDpuStatus ( true ) . Split ( '\t ' ) ;
471
+ var status = ( train . Cars [ i ] as MSTSDieselLocomotive ) . GetDpuStatus ( true , LoadUnits ) . Split ( '\t ' ) ;
463
472
var fence = ( ( dpUnitId != ( dpUnitId = train . Cars [ i ] . RemoteControlGroup ) ) ? "| " : " " ) ;
464
473
tempStatus [ k , 0 ] = fence + status [ 0 ] . Split ( '(' ) . First ( ) ;
465
474
for ( var j = 1 ; j < status . Length ; j ++ )
0 commit comments