public void Start() { leftEyeStatusList.Clear(); rightEyeStatusList.Clear(); leftEyeState = EyeClickState.EyeOpen; rightEyeState = EyeClickState.EyeOpen; leftEyeClosedTime = 0; rightEyeClosedTime = 0; }
public EyeClickerFiniteStateMachine(BlinkLinkEyeClickData blinkLinkEyeClickData, EyeStatusWindow eyeStatusWindow) { this.blinkLinkEyeClickData = blinkLinkEyeClickData; this.eyeStatusWindow = eyeStatusWindow; leftEyeStatusList = new List <EyeStatus>(); rightEyeStatusList = new List <EyeStatus>(); leftEyeClosedTime = 0; rightEyeClosedTime = 0; leftEyeState = EyeClickState.EyeOpen; rightEyeState = EyeClickState.EyeOpen; noActionImageSet = true; mouseEventImageTimer = -1; isDragging = false; }
public void Reset() { leftEyeStatusList.Clear(); rightEyeStatusList.Clear(); leftEyeState = EyeClickState.EyeOpen; rightEyeState = EyeClickState.EyeOpen; leftEyeClosedTime = 0; rightEyeClosedTime = 0; if (!noActionImageSet) { noActionImageSet = true; SetMouseImage(ClickAction.None); } mouseEventImageTimer = -1; isDragging = false; }
private void SetEyeState(Eye eye, EyeClickState value) { EyeClickState oldEyeState; EyeClickState otherEyeState; if (eye == Eye.Left) { otherEyeState = rightEyeState; oldEyeState = leftEyeState; leftEyeState = value; } else { otherEyeState = leftEyeState; oldEyeState = rightEyeState; rightEyeState = value; } switch (value) { case EyeClickState.DeterminingBlinkType: { leftEyeStatusList.Add(EyeStatus.Open); } break; case EyeClickState.DoubleClickPause: { PerformBlinkAction(); } break; case EyeClickState.DoubleClickPauseWaitForOtherEye: { if (rightEyeState == EyeClickState.DoubleClickPauseWaitForOtherEye) { SetEyeState(Eye.Left, EyeClickState.EyeOpen); SetEyeState(Eye.Right, EyeClickState.EyeOpen); } } break; case EyeClickState.LongVoluntaryBlink: { if (eye == Eye.Left) { StartLongLeftWinkAction(); } else { StartLongRightWinkAction(); } } break; case EyeClickState.EyeOpen: { if (eye == Eye.Left) { leftEyeClosedTime = 0; leftEyeStatusList.Clear(); } else { rightEyeClosedTime = 0; rightEyeStatusList.Clear(); } if (oldEyeState == EyeClickState.VoluntaryBlink) { if (eye == Eye.Left) { PerformShortLeftWinkAction(); } else { PerformShortRightWinkAction(); } } else if (oldEyeState == EyeClickState.LongVoluntaryBlink) { if (eye == Eye.Left) { StopLongLeftWinkAction(); } else { StopLongRightWinkAction(); } } } break; case EyeClickState.VoluntaryBlink: { if (otherEyeState == EyeClickState.VoluntaryBlink) { SetEyeState(Eye.Left, EyeClickState.DoubleClickPause); SetEyeState(Eye.Right, EyeClickState.DoubleClickPause); } else { if (eye == Eye.Left) { if (blinkLinkEyeClickData.ShortLeftWinkAction == ClickAction.LeftClick || blinkLinkEyeClickData.ShortLeftWinkAction == ClickAction.RightClick || blinkLinkEyeClickData.ShortLeftWinkAction == ClickAction.DoubleClick) { SetMouseImage(blinkLinkEyeClickData.ShortLeftWinkAction, true); } } else { if (blinkLinkEyeClickData.ShortRightWinkAction == ClickAction.LeftClick || blinkLinkEyeClickData.ShortRightWinkAction == ClickAction.RightClick || blinkLinkEyeClickData.ShortRightWinkAction == ClickAction.DoubleClick) { SetMouseImage(blinkLinkEyeClickData.ShortRightWinkAction, true); } } } } break; } }