My son, Mark, was home from Uni this week and so we put him to work on the new Unit Conversion Engine.
So we managed to get quite a few Measurement Types converted (no pun intended) across. Rather than as in ESBPCS where we have collections of routines, some of which were then accessed in non-visual components, our new approach is a class-based one. Internally, each Class is storing the value in the associated SI Unit – and then the Value can be set and accessed in various units for the given Measurement Types.
Now you do have to create these new Measurement Classes (rather than a “Static” approach), because the unit names are being stored in a Generic Dictionary. In ESBPCS, we had different String Units – so if you wanted to switch from English International to English US (so as to switch from “metres” to “meters”), you swapped the language file and rebuilt ESBPCS (and the ESBPCS Installer made this easier). By using this Dictionary Approach, you can now have available all the Language options – and via events even set up custom strings (or just replace one you don’t like).
But wait there’s more – we are also adding Unit Abbreviations 🙂
Plus we adding Unit Testing for each unit type (that is measurement unit) – and so are ending up with a much more robust engine, that will make expanding it easier.