示例#1
0
        private Unit[] BuildUnits(object data)
        {
            JSObject[] children = DataNodeWrapper.GetNodeChildren(data);
            int        l        = children.Length;

            Unit[] units = new Unit[l];
            for (int i = 0; i < l; i++)
            {
                JSObject childData     = children[i];
                string   name          = DataNodeWrapper.GetAttribute(childData, DataNodeWrapper.NAME_CAPS);
                string   minValue      = DataNodeWrapper.GetAttribute(childData, DataNodeWrapper.MINIMUMVALUE);
                string   maxValue      = DataNodeWrapper.GetAttribute(childData, DataNodeWrapper.MAXIMUMVALUE);
                string   decimalDigits = DataNodeWrapper.GetAttribute(childData, DataNodeWrapper.DECIMALDIGITS);
                string   interval      = DataNodeWrapper.GetAttribute(childData, DataNodeWrapper.INTERVAL);
                units[i] = Spinner.CreateUnit(name,
                                              BuildUnitAbbreviations(DataNodeWrapper.GetNodeChildren(childData)),
                                              Double.Parse(minValue),
                                              Double.Parse(maxValue),
                                              Int32.Parse(decimalDigits),
                                              Double.Parse(interval));
            }
            return(units);
        }