Ejemplo n.º 1
0
 public static ThingPayload FromThingByType(Thing thing)
 {
     if (thing is Device)
     {
         return(DevicePayload.FromDevice((Device)thing));
     }
     if (thing is Item)
     {
         return(ItemPayload.FromItem((Item)thing));
     }
     return(ThingPayload.FromThing(thing));
 }
Ejemplo n.º 2
0
        public static ItemPayload FromItem(Item item)
        {
            var payload = new ItemPayload();

            ThingPayload.CopyFromThing(payload, item);
            var slot = item.ParentSlot;

            if (slot != null)
            {
                payload.parentSlotReferenceId = slot.Parent.ReferenceId.ToString();
                payload.parentSlotId          = slot.SlotId;
            }
            payload.quantityText = item.GetQuantityText();
            return(payload);
        }