public UltravioletPage()
        {
            Model = new UltravioletModel
            {
                IsSupported = UltravioletSensor.IsSupported,
                SensorCount = UltravioletSensor.Count
            };

            InitializeComponent();

            if (Model.IsSupported)
            {
                Ultraviolet              = new UltravioletSensor();
                Ultraviolet.DataUpdated += Ultraviolet_DataUpdated;

                canvas.ChartScale = 200;
                canvas.Series     = new List <Series>()
                {
                    new Series()
                    {
                        Color         = SKColors.Red,
                        Name          = "UltravioletIndex",
                        FormattedText = "Ultraviolet Index={0}",
                    },
                };
            }
        }
 /// <summary>
 /// Constructor of UltravioletSensorAdapter.
 /// </summary>
 public UltravioletSensorAdapter()
 {
     sensor = new UltravioletSensor
     {
         Interval    = 100,
         PausePolicy = SensorPausePolicy.None
     };
 }
 /// <summary>
 /// Initializes ultraviolet sensor service.
 /// </summary>
 public UltravioletSensorService()
 {
     _ultravioletSensor = new UltravioletSensor();
 }
Ejemplo n.º 4
0
        private void initCampaignDataSources()
        {
            #region Assign sensor model references
            accelerometerModel = new AccelerometerModel
            {
                IsSupported = Accelerometer.IsSupported,
                SensorCount = Accelerometer.Count
            };
            gravityModel = new GravityModel
            {
                IsSupported = GravitySensor.IsSupported,
                SensorCount = GravitySensor.Count
            };
            gyroscopeModel = new GyroscopeModel
            {
                IsSupported = Gyroscope.IsSupported,
                SensorCount = Gyroscope.Count
            };
            hRMModel = new HRMModel
            {
                IsSupported = HeartRateMonitor.IsSupported,
                SensorCount = HeartRateMonitor.Count
            };
            humidityModel = new HumidityModel
            {
                IsSupported = HumiditySensor.IsSupported,
                SensorCount = HumiditySensor.Count
            };
            lightModel = new LightModel
            {
                IsSupported = LightSensor.IsSupported,
                SensorCount = LightSensor.Count
            };
            linearAccelerationModel = new LinearAccelerationModel
            {
                IsSupported = LinearAccelerationSensor.IsSupported,
                SensorCount = LinearAccelerationSensor.Count
            };
            magnetometerModel = new MagnetometerModel
            {
                IsSupported = Magnetometer.IsSupported,
                SensorCount = Magnetometer.Count
            };
            orientationModel = new OrientationModel
            {
                IsSupported = OrientationSensor.IsSupported,
                SensorCount = OrientationSensor.Count
            };
            pressureModel = new PressureModel
            {
                IsSupported = PressureSensor.IsSupported,
                SensorCount = PressureSensor.Count
            };
            proximityModel = new ProximityModel
            {
                IsSupported = ProximitySensor.IsSupported,
                SensorCount = ProximitySensor.Count
            };
            temperatureModel = new TemperatureModel
            {
                IsSupported = TemperatureSensor.IsSupported,
                SensorCount = TemperatureSensor.Count
            };
            ultravioletModel = new UltravioletModel
            {
                IsSupported = UltravioletSensor.IsSupported,
                SensorCount = UltravioletSensor.Count
            };
            #endregion

            #region Assign sensor references and sensor measurement event handlers
            if (accelerometerModel.IsSupported)
            {
                accelerometer                  = new Accelerometer();
                accelerometer.PausePolicy      = SensorPausePolicy.None;
                accelerometer.Interval         = Tools.DEFAULT_SENSOR_SAMPLING_INTERVAL;
                accelerometer.DataUpdated     += storeAccelerometerDataCallback;
                sensorMap[Tools.ACCELEROMETER] = accelerometer;
            }
            if (gravityModel.IsSupported)
            {
                gravity                  = new GravitySensor();
                gravity.PausePolicy      = SensorPausePolicy.None;
                gravity.Interval         = Tools.DEFAULT_SENSOR_SAMPLING_INTERVAL;
                gravity.DataUpdated     += storeGravitySensorDataCallback;
                sensorMap[Tools.GRAVITY] = gravity;
            }
            if (gyroscopeModel.IsSupported)
            {
                gyroscope                  = new Gyroscope();
                gyroscope.PausePolicy      = SensorPausePolicy.None;
                gyroscope.Interval         = Tools.DEFAULT_SENSOR_SAMPLING_INTERVAL;
                gyroscope.DataUpdated     += storeGyroscopeDataCallback;
                sensorMap[Tools.GYROSCOPE] = gyroscope;
            }
            if (hRMModel.IsSupported)
            {
                hRM                  = new HeartRateMonitor();
                hRM.PausePolicy      = SensorPausePolicy.None;
                hRM.Interval         = Tools.DEFAULT_SENSOR_SAMPLING_INTERVAL;
                hRM.DataUpdated     += storeHeartRateMonitorDataCallback;
                sensorMap[Tools.HRM] = hRM;
            }
            if (humidityModel.IsSupported)
            {
                humidity                  = new HumiditySensor();
                humidity.PausePolicy      = SensorPausePolicy.None;
                humidity.Interval         = Tools.DEFAULT_SENSOR_SAMPLING_INTERVAL;
                humidity.DataUpdated     += storeHumiditySensorDataCallback;
                sensorMap[Tools.HUMIDITY] = humidity;
            }
            if (lightModel.IsSupported)
            {
                light                  = new LightSensor();
                light.PausePolicy      = SensorPausePolicy.None;
                light.Interval         = Tools.DEFAULT_SENSOR_SAMPLING_INTERVAL;
                light.DataUpdated     += storeLightSensorDataCallback;
                sensorMap[Tools.LIGHT] = light;
            }
            if (linearAccelerationModel.IsSupported)
            {
                linearAcceleration                  = new LinearAccelerationSensor();
                linearAcceleration.PausePolicy      = SensorPausePolicy.None;
                linearAcceleration.Interval         = Tools.DEFAULT_SENSOR_SAMPLING_INTERVAL;
                linearAcceleration.DataUpdated     += storeLinearAccelerationSensorDataCallback;
                sensorMap[Tools.LINEARACCELERATION] = linearAcceleration;
            }
            if (magnetometerModel.IsSupported)
            {
                magnetometer                  = new Magnetometer();
                magnetometer.PausePolicy      = SensorPausePolicy.None;
                magnetometer.Interval         = Tools.DEFAULT_SENSOR_SAMPLING_INTERVAL;
                magnetometer.DataUpdated     += storeMagnetometerDataCallback;
                sensorMap[Tools.MAGNETOMETER] = magnetometer;
            }
            if (orientationModel.IsSupported)
            {
                orientation                  = new OrientationSensor();
                orientation.PausePolicy      = SensorPausePolicy.None;
                orientation.Interval         = Tools.DEFAULT_SENSOR_SAMPLING_INTERVAL;
                orientation.DataUpdated     += storeOrientationSensorDataCallback;
                sensorMap[Tools.ORIENTATION] = orientation;
            }
            if (pressureModel.IsSupported)
            {
                pressure                  = new PressureSensor();
                pressure.PausePolicy      = SensorPausePolicy.None;
                pressure.Interval         = Tools.DEFAULT_SENSOR_SAMPLING_INTERVAL;
                pressure.DataUpdated     += storePressureSensorDataCallback;
                sensorMap[Tools.PRESSURE] = pressure;
            }
            if (proximityModel.IsSupported)
            {
                proximity                  = new ProximitySensor();
                proximity.PausePolicy      = SensorPausePolicy.None;
                proximity.Interval         = Tools.DEFAULT_SENSOR_SAMPLING_INTERVAL;
                proximity.DataUpdated     += storeProximitySensorDataCallback;
                sensorMap[Tools.PROXIMITY] = proximity;
            }
            if (temperatureModel.IsSupported)
            {
                temperature                  = new TemperatureSensor();
                temperature.PausePolicy      = SensorPausePolicy.None;
                temperature.Interval         = Tools.DEFAULT_SENSOR_SAMPLING_INTERVAL;
                temperature.DataUpdated     += storeTemperatureSensorDataCallback;
                sensorMap[Tools.TEMPERATURE] = temperature;
            }
            if (ultravioletModel.IsSupported)
            {
                ultraviolet                  = new UltravioletSensor();
                ultraviolet.PausePolicy      = SensorPausePolicy.None;
                ultraviolet.Interval         = Tools.DEFAULT_SENSOR_SAMPLING_INTERVAL;
                ultraviolet.DataUpdated     += storeUltravioletSensorDataCallback;
                sensorMap[Tools.ULTRAVIOLET] = ultraviolet;
            }
            #endregion

            loadCampaignSettings();
        }