public override void SetProperty(Property property) { switch (property.Id) { case ModelCode.SEAL_APPLIEDTIME: appliedDateTime = property.AsLong(); break; case ModelCode.SEAL_CONDITION: condition = (SealConditionKind)property.AsEnum(); break; case ModelCode.SEAL_KIND: kind = (SealKind)property.AsEnum(); break; case ModelCode.SEAL_SEALNUMBER: sealNumber = property.AsString(); break; default: base.SetProperty(property); break; } }
public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, System.Type destinationType) { if ((value == null)) { return(null); } SealConditionKind valueCasted = ((SealConditionKind)(value)); if ((valueCasted == SealConditionKind.Missing)) { return("missing"); } if ((valueCasted == SealConditionKind.Open)) { return("open"); } if ((valueCasted == SealConditionKind.Broken)) { return("broken"); } if ((valueCasted == SealConditionKind.Other)) { return("other"); } if ((valueCasted == SealConditionKind.Locked)) { return("locked"); } throw new ArgumentOutOfRangeException("value"); }