public BindingSource Listen(BindingListenOptions listenOptions, InputDevice device) { if (!listenOptions.IncludeControllers || device.IsUnknown) { return(null); } if (detectFound != 0 && !IsPressed(detectFound, device) && detectPhase == 2) { DeviceBindingSource result = new DeviceBindingSource(detectFound); Reset(); return(result); } InputControlType inputControlType = ListenForControl(listenOptions, device); if (inputControlType != 0) { if (detectPhase == 1) { detectFound = inputControlType; detectPhase = 2; } } else if (detectPhase == 0) { detectPhase = 1; } return(null); }
public BindingSource Listen(BindingListenOptions listenOptions, InputDevice device) { if (!listenOptions.IncludeControllers || device.IsUnknown) { return(null); } if (detectFound != InputControlType.None) { if (!IsPressed(detectFound, device)) { if (detectPhase == 2) { var bindingSource = new DeviceBindingSource(detectFound); Reset(); return(bindingSource); } } } var control = ListenForControl(listenOptions, device); if (control != InputControlType.None) { if (detectPhase == 1) { detectFound = control; detectPhase = 2; // Wait for release. } } else { if (detectPhase == 0) { detectPhase = 1; // Wait for press. } } return(null); }