Exemplo n.º 1
0
        public DeviceResources(IFactory factory, IDeviceHandle <IHMDDevice, IHMDInfo> handle)
        {
            if (factory == null || handle == null)
            {
                throw new ArgumentNullException();
            }

            Info   = handle.DeviceInfo;
            Device = handle.CreateDevice();
            Sensor = Device.Sensor;
            Fusion = factory.CreateSensorFusion(Sensor);

            if (Info == null)
            {
                throw new ArgumentNullException();
            }
            if (Device == null)
            {
                throw new ArgumentNullException();
            }
            if (Sensor == null)
            {
                throw new ArgumentNullException();
            }

            Key = new DeviceKey(Sensor.Info);
        }
Exemplo n.º 2
0
        private void RemoveDevice(IDeviceHandle <ISensorDevice, ISensorInfo> handle)
        {
            _lock.EnterWriteLock();
            try
            {
                var             key = new DeviceKey(handle.DeviceInfo);
                DeviceResources resources;
                if (!_nativeResources.TryGetValue(key, out resources))
                {
                    return;
                }

                RemoveDevice(resources);
            }
            finally
            {
                _lock.ExitWriteLock();
            }
        }