@@ -157,11 +157,18 @@ public void ExitWindow(DPIWindow window)
157157 public class DPDefaultWindow : DPIWindow
158158 {
159159 public bool FullTable ;
160+ public CABViewControlUnits LoadUnits = CABViewControlUnits . KILO_LBS ;
160161 public DPDefaultWindow ( DistributedPowerInterface dpi , CabViewControl control ) : base ( dpi , 640 , 240 )
161162 {
162163 var param = ( control as CVCScreen ) . CustomParameters ;
163164 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 ) ;
165172 AddToLayout ( DPITable , new Point ( 0 , 0 ) ) ;
166173 }
167174 }
@@ -360,6 +367,7 @@ public class DPITable : DPIWindow
360367 readonly int RowHeight = 34 ;
361368 readonly int ColLength = 88 ;
362369 public bool FullTable = true ;
370+ public CABViewControlUnits LoadUnits ;
363371
364372 // Change text color
365373 readonly Dictionary < string , Color > ColorCodeCtrl = new Dictionary < string , Color >
@@ -378,11 +386,12 @@ public class DPITable : DPIWindow
378386
379387 protected string [ ] FirstColumn = { "ID" , "Throttle" , "Load" , "BP" , "Flow" , "Remote" , "ER" , "BC" , "MR" } ;
380388
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 )
382390 {
383391 DPI = dpi ;
384392 FullScreen = fullScreen ;
385393 FullTable = fullTable ;
394+ LoadUnits = loadUnits ;
386395 BackgroundColor = DPI . BlackWhiteTheme ? Color . Black : ColorBackground ;
387396 SetFont ( ) ;
388397 string text = "" ;
@@ -459,7 +468,7 @@ public override void PrepareFrame(DPIStatus dpiStatus)
459468 {
460469 if ( dpUId != ( train . Cars [ i ] as MSTSLocomotive ) . DPUnitID )
461470 {
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 ' ) ;
463472 var fence = ( ( dpUnitId != ( dpUnitId = train . Cars [ i ] . RemoteControlGroup ) ) ? "| " : " " ) ;
464473 tempStatus [ k , 0 ] = fence + status [ 0 ] . Split ( '(' ) . First ( ) ;
465474 for ( var j = 1 ; j < status . Length ; j ++ )
0 commit comments