Пример #1
0
        public static string GetLocationFriendlyString(Motor.Location location)
        {
            switch (location)
            {
            case Motor.Location.FrontLeft:
                return("Front Left");

            case Motor.Location.FrontRight:
                return("Front Right");

            case Motor.Location.MiddleLeft:
                return("Middle Left");

            case Motor.Location.MiddleRight:
                return("Middle Right");

            case Motor.Location.BackLeft:
                return("Back Left");

            case Motor.Location.BackRight:
                return("Back Right");
            }

            return("");
        }
        public MotorStatusViewModel(Motor.Location motorKey)
        {
            this.motorKey = motorKey;
            motor = StatusUpdater.Instance.RoverStatus.Motors[motorKey];

            motor.DangerousCurrentDetected += new MarsRover.DangerousCurrentDetectedDelegate<Motor>(CurrentStatusChanged);
            motor.WarningCurrentDetected += new MarsRover.WarningCurrentDetectedDelegate<Motor>(CurrentStatusChanged);
            motor.NormalCurrentDetected += new MarsRover.NormalCurrentDetectedDelegate<Motor>(CurrentStatusChanged);

            motor.DangerousTemperatureDetected += new MarsRover.DangerousTemperatureDetectedDelegate<Motor>(TemperatureStatusChanged);
            motor.WarningTemperatureDetected += new MarsRover.WarningTemperatureDetectedDelegate<Motor>(TemperatureStatusChanged);
            motor.NormalTemperatureDetected += new MarsRover.NormalTemperatureDetectedDelegate<Motor>(TemperatureStatusChanged);

            StatusUpdater.Instance.MotorsUpdated += new StatusUpdater.MotorsUpdatedDelegate(UpdateMotor);
        }
        public MotorStatusViewModel(Motor.Location motorKey)
        {
            this.motorKey = motorKey;
            motor         = StatusUpdater.Instance.RoverStatus.Motors[motorKey];

            motor.DangerousCurrentDetected += new MarsRover.DangerousCurrentDetectedDelegate <Motor>(CurrentStatusChanged);
            motor.WarningCurrentDetected   += new MarsRover.WarningCurrentDetectedDelegate <Motor>(CurrentStatusChanged);
            motor.NormalCurrentDetected    += new MarsRover.NormalCurrentDetectedDelegate <Motor>(CurrentStatusChanged);

            motor.DangerousTemperatureDetected += new MarsRover.DangerousTemperatureDetectedDelegate <Motor>(TemperatureStatusChanged);
            motor.WarningTemperatureDetected   += new MarsRover.WarningTemperatureDetectedDelegate <Motor>(TemperatureStatusChanged);
            motor.NormalTemperatureDetected    += new MarsRover.NormalTemperatureDetectedDelegate <Motor>(TemperatureStatusChanged);

            StatusUpdater.Instance.MotorsUpdated += new StatusUpdater.MotorsUpdatedDelegate(UpdateMotor);
        }
Пример #4
0
        //public delegate void

        #endregion

        #region Constructor

        public Motor(Motor.Location location)
        {
            LocationOnRover = location;
            Duty            = 100.0f;
            regex           = "<" + UpdateIdentifier + @";[MFB],[LR],\d+(\.\d{1,3})?,\d+(\.\d{1,3})?>";
        }