Exemple #1
0
        public MeasurementDisplay(Element element, AnomalousMvcContext context, RocketWidget rocketWidget)
        {
            this.context      = context;
            this.element      = element;
            this.rocketWidget = rocketWidget;

            String target = element.GetAttributeString("target");

            if (MeasurementController.tryGetCalculator(target, out measurement))
            {
                switch (element.GetAttributeString("units"))
                {
                case "percent":
                    context.OnLoopUpdate += Context_OnLoopUpdatePercent;
                    break;

                case "centimeters":
                    context.OnLoopUpdate += Context_OnLoopUpdateCm;
                    break;

                case "millimeters":
                default:
                    context.OnLoopUpdate += Context_OnLoopUpdateMm;
                    break;
                }
            }
            else
            {
                Log.Warning("Could not find a measurement named '{0}'. The measurement will not be displayed.", target);
                element.InnerRml = String.Format("Cannot find measurement '{0}' in scene.", target);
            }
        }