示例#1
0
        private void SendTrackResistance(float grade)
        {
            UInt16 gradeToTransmit;

            if (!useAsModel)
            {
                var boundedGrade = Math.Min(Math.Max(grade, minSimulatedGrade), maxSimulatedGrade);
                gradeToTransmit = Consts.ConvertGrade(boundedGrade);
            }
            else
            {
                gradeToTransmit = Consts.ConvertGrade(grade);
            }

            var command = new ControlTrackResistancePage
            {
                Grade = gradeToTransmit
            };

            simulator.SendTrackResistance(command);
        }