public RobotIdentificationModel(RobotIdentification pIdentification) { id = Convert.ToString(pIdentification.Id); type = Enum.GetName(typeof(IdentificationType), ((IdentificationType)Enum.Parse(typeof(IdentificationType), pIdentification.Type))); subtype = Enum.GetName(typeof(RobotType), ((RobotType)Enum.Parse(typeof(RobotType), pIdentification.Subtype))); roletype = Enum.GetName(typeof(RoleType), ((RoleType)Enum.Parse(typeof(RoleType), pIdentification.Roletype))); }
/// <summary> /// Create an object of an robot for a json command. /// </summary> /// <param name="pId">Id of the robot in communication.</param> public Robot(RobotIdentification pIdentification, bool pActive, Position pPosition, double pSpeed, double pUltrasonic, double pGyro) : base(pActive) { identification = pIdentification; position = pPosition; speed = pSpeed; ultrasonic = pUltrasonic; gyro = pGyro; }
public RobotViewModel(Robot pRobot) { identification = pRobot.Identification; position = pRobot.Position; speed = pRobot.Speed; ultrasonic = Convert.ToString(pRobot.Ultrasonic); gyro = Convert.ToString(pRobot.Gyro); switch ((RobotType)Enum.Parse(typeof(RobotType), pRobot.Identification.Subtype)) { case RobotType.ThreeWheelDrive: imageUrl = "FleeAndCatch_Logo.png"; break; default: imageUrl = "FleeAndCatch_Logo.png"; break; } }