public BindingSource Listen(BindingListenOptions listenOptions, InputDevice device)
        {
            if (!listenOptions.IncludeUnknownControllers || device.IsKnown)
            {
                return(null);
            }
            if (detectPhase == DetectPhase.WaitForControlRelease && (bool)detectFound && !IsPressed(detectFound, device))
            {
                UnknownDeviceBindingSource result = new UnknownDeviceBindingSource(detectFound);
                Reset();
                return(result);
            }
            UnknownDeviceControl control = ListenForControl(listenOptions, device);

            if ((bool)control)
            {
                if (detectPhase == DetectPhase.WaitForControlPress)
                {
                    detectFound = control;
                    detectPhase = DetectPhase.WaitForControlRelease;
                }
            }
            else if (detectPhase == DetectPhase.WaitForInitialRelease)
            {
                detectPhase = DetectPhase.WaitForControlPress;
            }
            return(null);
        }
Exemple #2
0
        public BindingSource Listen(BindingListenOptions listenOptions, InputDevice device)
        {
            if (!listenOptions.IncludeUnknownControllers || device.IsKnown)
            {
                return(null);
            }

            if (detectPhase == DetectPhase.WaitForControlRelease && detectFound)
            {
                if (!IsPressed(detectFound, device))
                {
                    var bindingSource = new UnknownDeviceBindingSource(detectFound);
                    Reset();
                    return(bindingSource);
                }
            }

            var control = ListenForControl(listenOptions, device);

            if (control)
            {
                if (detectPhase == DetectPhase.WaitForControlPress)
                {
                    detectFound = control;
                    detectPhase = DetectPhase.WaitForControlRelease;
                }
            }
            else
            {
                if (detectPhase == DetectPhase.WaitForInitialRelease)
                {
                    detectPhase = DetectPhase.WaitForControlPress;
                }
            }

            return(null);
        }
		public BindingSource Listen( BindingListenOptions listenOptions, InputDevice device )
		{
			if (!listenOptions.IncludeUnknownControllers || device.IsKnown)
			{
				return null;
			}

			if (detectPhase == DetectPhase.WaitForControlRelease && detectFound)
			{
				if (!IsPressed( detectFound, device ))
				{
					var bindingSource = new UnknownDeviceBindingSource( detectFound );
					Reset();
					return bindingSource;
				}
			}

			var control = ListenForControl( listenOptions, device );
			if (control)
			{
				if (detectPhase == DetectPhase.WaitForControlPress)
				{
					detectFound = control;
					detectPhase = DetectPhase.WaitForControlRelease;
				}
			}
			else
			{
				if (detectPhase == DetectPhase.WaitForInitialRelease)
				{
					detectPhase = DetectPhase.WaitForControlPress;
				}
			}

			return null;
		}
Exemple #4
0
 public void Reset()
 {
     detectFound = UnknownDeviceControl.None;
     detectPhase = DetectPhase.WaitForInitialRelease;
     TakeSnapshotOnUnknownDevices();
 }
		public void Reset()
		{
			detectFound = UnknownDeviceControl.None;
			detectPhase = DetectPhase.WaitForInitialRelease;
			TakeSnapshotOnUnknownDevices();
		}