Inheritance: ILightSensorReading
Ejemplo n.º 1
0
        public static int DispatchReading(float lux)
        {
            var reading = new LightSensorReading(lux, DateTimeOffset.UtcNow);

            OnReadingChanged(reading);

            return(0);
        }
Ejemplo n.º 2
0
        public MainPage()
        {
            InitializeComponent();
            _locator = new Geolocator();
            Loaded += OnControlLoaded;

            _lightSensor = LightSensor.GetDefault();
            if (_lightSensor != null)
            {
                //For now we get a base reading to use to compare later
                _baseReading = _lightSensor.GetCurrentReading();
                //Register for the reading change
                _lightSensor.ReadingChanged += OnLightReadingChanged;
            }

            _accelerometerSensor = Accelerometer.GetDefault();
            if (_accelerometerSensor != null)
            {
                _accelerometerSensor.Shaken += OnShaken;
            }
            _compassSensor = Compass.GetDefault();
            if (_compassSensor != null)
            {
                _compassSensor.ReadingChanged += OnCompassReadingChanged;
            }
            _gyroSensor = Gyrometer.GetDefault();
            if (_gyroSensor != null)
            {
                _gyroSensor.ReadingChanged += OnGyroReadingChanged;
            }
            _inclineSensor = Inclinometer.GetDefault();
            if (_inclineSensor != null)
            {
                _inclineSensor.ReadingChanged += OnInclineReadingChanged;
            }
            _orientationSensor = OrientationSensor.GetDefault();
            if (_orientationSensor != null)
            {
                _orientationSensor.ReadingChanged += OnOrientationReadingChanged;
            }
        }
Ejemplo n.º 3
0
 public void setLightSensorReading(LightSensorReading reading)
 {
     this.lightIntensity = reading.IlluminanceInLux;
 }