Example #1
0
        public void EnterWaitState()
        {
            //these flags are here so that they get reset before anything else happens in the SM
            //these were previously in the action method but that causes issues because the update state is run again before all of the flags are reset.
            zoomer.ResetZoomLens();
            magnifier.Stop();
            SystemFlags.fixationRunning      = false;
            SystemFlags.actionButtonSelected = false;
            SystemFlags.fixationRunning      = false;
            SystemFlags.hasGaze = false;
            SystemFlags.timeOut = false;
            fixationWorker.IsZoomerFixation(false);
            currentState             = SystemState.Wait;
            SystemFlags.currentState = SystemState.Wait;
            zoomer.Refresh();

            fixationWorker = new FixationDetection();
        }
Example #2
0
        public void RefreshZoom()
        {
            magnifier.Stop();

            zoomer    = new ZoomLens();
            magnifier = CreateMagnifier();
            zoomer.ResetZoomLens();
            magnifier.ResetZoomValue();
            EnterWaitState();
        }
Example #3
0
 /*
  *  Called from UpdateState() when the system state is in the ZoomWait phase
  */
 public void UpdateZoomWaitState()
 {
     if (SystemFlags.hasGaze)   //if the second zoomGaze has happed an action needs to be performed
     {
         SetState(SystemState.ApplyAction);
     }
     else if (SystemFlags.timeOut)
     {
         EnterWaitState();
         zoomForm.ResetZoomLens();
     }
 }
Example #4
0
        //The update method is responsible for transitioning from state to state. Once a state is changed the action() method is run
        public void UpdateState()
        {
            currentState = SystemFlags.currentState;
            switch (currentState)
            {
            case SystemState.Wait:
                if (SystemFlags.actionButtonSelected)     //if a button has been selected from the toolbar
                {
                    currentState = SystemState.ActionButtonSelected;
                    SystemFlags.actionButtonSelected = false;
                }
                else if (SystemFlags.shortCutKeyPressed)
                {
                    currentState = SystemState.Zooming;
                }
                break;

            case SystemState.ActionButtonSelected:
                SystemFlags.hasSelectedButtonColourBeenReset = false;
                if (SystemFlags.gaze)
                {
                    currentState = SystemState.Zooming;
                }
                else if (SystemFlags.timeOut)
                {
                    EnterWaitState();
                    SystemFlags.timeOut = false;
                }
                break;

            case SystemState.Zooming:
                if (SystemFlags.actionToBePerformed == ActionToBePerformed.Scroll)
                {
                    currentState = SystemState.ApplyAction;
                }
                else
                {
                    currentState = SystemState.ZoomWait;
                }
                break;

            case SystemState.ZoomWait:
                if (SystemFlags.gaze)    //if the second zoomGaze has happed an action needs to be performed
                {
                    currentState = SystemState.ApplyAction;
                }
                else if (SystemFlags.timeOut)
                {
                    EnterWaitState();
                    zoomer.ResetZoomLens();
                }
                break;

            case SystemState.ScrollWait:
                if (!SystemFlags.scrolling)
                {
                    EnterWaitState();
                }
                break;

            case SystemState.ApplyAction:
                if (SystemFlags.scrolling)
                {
                    currentState = SystemState.ScrollWait;
                }
                else
                {
                    EnterWaitState();
                }
                break;
            }
            SystemFlags.currentState = currentState;
        }