jhoek / UncommonSense.CBreeze

C#/PowerShell API for the Dynamics NAV C/AL object text format
MIT License
6 stars 4 forks source link

PageControls have an ID, but are not necessarily sorted by ID #14

Closed jhoek closed 9 years ago

jhoek commented 9 years ago

Dictionary<TKey, TValue> maintains the insertion order when enumerating contents, but lacks an Insert method, in other words, there's no way to insert a page control between two existing controls. Note that the order of the controls in the page definition determines that order on the screen, so insertion may be required.

Some collections follow the ID order (e.g. objects), for others the insertion order is more important (e.g. page controls) and may differ from the dictionary key order. Perhaps we could use https://msdn.microsoft.com/en-us/library/system.collections.specialized.ordereddictionary(v=vs.100).aspx, but sadly, it's not generic.

Simple List instead of Dictionary?

jhoek commented 9 years ago

System.Web.Util namespace in System.Web.Extensions.dll contains a generic OrderedDictionary. System.Runtime.Collections also contains an internal OrderedDictionary<TKey, TValue>.

jhoek commented 9 years ago

Changed this for page controls, but more collections remain. Also, be sure to actually introduce an Insert() method.

jhoek commented 9 years ago

windows_8_1

The marked items are likely to be the collections where this is relevant: collections where the actual sort order may differ from sort order according to the dictionary key (typically ID).

jhoek commented 9 years ago

Revised all use of collections. Made my changes in branch collection-types. If these changes work OK, they need to be implemented in the fdb in order to update the master branch; if they don't, just delete the collection-types branch.