Exemple #1
0
        private void DeviceAddAndRemove(TimeSpan amount)
        {
            var sw = new Stopwatch();

            sw.Start();

            while (!_exit && sw.Elapsed < amount)
            {
                //
                // Let's add the device
                //
                var hmd    = CreateHMD();
                var handle = new DeviceHandle <IHMDDevice, IHMDInfo>(hmd);
                var msg    = new MessageDeviceStatus
                {
                    Device       = this,
                    DeviceHandle = handle,
                    Type         = MessageType.DeviceAdded
                };

                _handler.OnMessage(msg);

                //
                // And remove it again
                //

                msg = new MessageDeviceStatus
                {
                    Device       = this,
                    DeviceHandle = handle,
                    Type         = MessageType.DeviceRemoved
                };
                _handler.OnMessage(msg);
            }
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="wait">The amount of time the background thread waits, before it adds the new dummy device</param>
        /// <param name="block"></param>
        public void SimulateAddOneDevice(TimeSpan wait, bool block = true)
        {
            Join();
            _worker = new Thread(() =>
            {
                Thread.Sleep(wait);

                var hmd    = CreateHMD();
                var handle = new DeviceHandle <IHMDDevice, IHMDInfo>(hmd);
                var msg    = new MessageDeviceStatus
                {
                    Device       = this,
                    DeviceHandle = handle,
                    Type         = MessageType.DeviceAdded
                };

                _handler.OnMessage(msg);
            });
            _worker.Start();

            if (block)
            {
                Join();
            }
        }
Exemple #3
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="wait">The amount of time the background thread waits, before it adds the new dummy device</param>
		/// <param name="block"></param>
		public void SimulateAddOneDevice(TimeSpan wait, bool block = true)
		{
			Join();
			_worker = new Thread(() =>
				{
					Thread.Sleep(wait);

					var hmd = CreateHMD();
					var handle = new DeviceHandle<IHMDDevice, IHMDInfo>(hmd);
					var msg = new MessageDeviceStatus
					{
						Device = this,
						DeviceHandle = handle,
						Type = MessageType.DeviceAdded
					};

					_handler.OnMessage(msg);
				});
			_worker.Start();

			if (block)
				Join();
		}
Exemple #4
0
		private void DeviceAddAndRemove(TimeSpan amount)
		{
			var sw = new Stopwatch();
			sw.Start();

			while (!_exit && sw.Elapsed < amount)
			{
				//
				// Let's add the device
				//
				var hmd = CreateHMD();
				var handle = new DeviceHandle<IHMDDevice, IHMDInfo>(hmd);
				var msg = new MessageDeviceStatus
					{
						Device = this,
						DeviceHandle = handle,
						Type = MessageType.DeviceAdded
					};

				_handler.OnMessage(msg);

				//
				// And remove it again
				//

				msg = new MessageDeviceStatus
					{
						Device = this,
						DeviceHandle = handle,
						Type = MessageType.DeviceRemoved
					};
				_handler.OnMessage(msg);
			}
		}