Gurux.DLMS.Objects.GXDLMSObject.GetUIDataType C# (CSharp) Méthode

GetUIDataType() public méthode

Returns UI data type of selected index.
public GetUIDataType ( int index ) : DataType
index int Attribute index of the object.
Résultat DataType
        public virtual DataType GetUIDataType(int index)
        {
            GXDLMSAttributeSettings att = GetAttribute(index, null);
            return att.UIType;
        }

Usage Example

 void UpdateObject(GXDLMSObject it, GXDLMSCategory item)
 {
     item.ShortName = (UInt16)it.ShortName;
     item.LogicalName = it.LogicalName;
     if (it.ShortName != 0)
     {
         item.Name = string.Format("0x{0} {1} {2}", it.ShortName.ToString("X4"), it.LogicalName, it.Description);
     }
     else
     {
         item.Name = it.LogicalName + " " + it.Description;
     }
     //Update description.
     item.Description = it.Description;
     //Update atribute index.
     for (int pos = 2; pos != (it as IGXDLMSBase).GetAttributeCount() + 1; ++pos)
     {
         string name = (it as IGXDLMSBase).GetNames()[pos - 1];
         object value = it.GetValues()[pos - 1];
         GXDLMSProperty prop;
         if (((pos == 2 || pos == 3) && it.ObjectType == ObjectType.DemandRegister) || 
             (pos == 2 && it.ObjectType == ObjectType.ExtendedRegister))
         {
             prop = new GXDLMSRegister();
             prop.ObjectType = it.ObjectType;
             prop.LogicalName = it.LogicalName;
             prop.ShortName = it.ShortName;
             prop.Name = name;
             prop.AttributeOrdinal = pos;
         }
         else
         {
             prop = new GXDLMSProperty(it.ObjectType, it.LogicalName, it.ShortName, name, pos);
         }
         item.Properties.Add(prop);
         prop.DLMSType = it.GetDataType(pos);
         //Update scaler and unit.
         if ((pos == 4 && it.ObjectType == ObjectType.DemandRegister) ||
             (pos == 3 && it.ObjectType == ObjectType.ExtendedRegister))
         {
             prop.ValueType = DataType.String;
         }
         else
         {
             if (value is Enum)
             {
                 prop.ForcePresetValues = true;
                 foreach (object val in Enum.GetValues(value.GetType()))
                 {
                     prop.Values.Add(new GXValueItem(val.ToString(), (int)val));
                 }
             }
             else
             {
                 prop.ValueType = it.GetUIDataType(pos);
                 if (prop.ValueType == DataType.None)
                 {
                     prop.ValueType = it.GetDataType(pos);
                 }
             }
         }
         prop.AccessMode = (Gurux.Device.AccessMode)it.GetAccess(pos);
     }            
 }
All Usage Examples Of Gurux.DLMS.Objects.GXDLMSObject::GetUIDataType