Exemple #1
0
        /// <summary>
        /// Opens a system dialog box to request user permission to access sensor data.
        /// </summary>
        /// <param name="parentWindow">HWND handle to a window that can act as a parent to the permissions dialog box.</param>
        /// <param name="modal">Speficifies whether the window should be modal.</param>
        /// <param name="sensors">The sensors for which to request permission.</param>
        public static void RequestPermission(IntPtr parentWindow, bool modal, params Sensor[] sensors)
        {
            if (sensors == null || sensors.Length == 0)
            {
                throw new ArgumentNullException("sensors", "Sensors collection must not be null or empty.");
            }

            ISensorCollection sensorCollection = new SensorCollection();

            foreach (Sensor sensor in sensors)
            {
                sensorCollection.Add((ISensor)sensor.InnerObject);
            }

            _sensorMgr.RequestPermissions(parentWindow, sensorCollection, modal);
        }