Ejemplo n.º 1
0
        public VolumeDisplay(Element element, AnomalousMvcContext context, RocketWidget rocketWidget)
        {
            String volumeName = element.GetAttributeString("target");

            this.context      = context;
            this.element      = element;
            this.rocketWidget = rocketWidget;

            if (VolumeController.tryGetCalculator(volumeName, out calculator))
            {
                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 volume measurement named '{0}'. The volume will not be displayed.", volumeName);
                element.InnerRml = String.Format("Cannot find volume '{0}' in scene.", volumeName);
            }
        }