Ejemplo n.º 1
0
 /// <summary>
 /// Starts reading data from the motion sensor.
 /// This method throws an exception if <see cref="Microsoft.Devices.Sensors.Motion.IsSupported"/>
 /// is false.
 /// </summary>
 /// <exception cref="InvalidOperationException">Thrown if motion sensor is not supported</exception>
 public void Start()
 {
     if (!IsRunning)
     {
         if (Microsoft.Devices.Sensors.Motion.IsSupported)
         {
             motion = new Microsoft.Devices.Sensors.Motion();
             motion.CurrentValueChanged += motion_CurrentValueChanged;
             motion.Start();
             IsRunning = true;
         }
         else
         {
             throw new InvalidOperationException("Motion sensor not supported on this device");
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Starts reading data from the motion sensor.
 /// This method throws an exception if <see cref="Microsoft.Devices.Sensors.Motion.IsSupported"/>
 /// is false.
 /// </summary>
 /// <exception cref="InvalidOperationException">Thrown if motion sensor is not supported</exception>
 public void Start()
 {
     if (!IsRunning)
     {
         if (Microsoft.Devices.Sensors.Motion.IsSupported)
         {
             motion = new Microsoft.Devices.Sensors.Motion();
             motion.CurrentValueChanged += motion_CurrentValueChanged;
             motion.Start();
             IsRunning = true;
         }
         else
         {
             throw new InvalidOperationException("Motion sensor not supported on this device");
         }
     }
 }