/// <summary>
        /// Change the current state of UI, if allowed by timeouts
        /// </summary>
        /// <param name="newState">the state to change to</param>
        /// <param name="choice">customer informatiom</param>
        /// <param name="force">always change the state and update timer</param>
        /// <returns>true iff the change was "officially" made (timeouts are reset)</returns>
        /// Note: we want to prevent too frequent updates here so the customer can react to the prompts
        public bool Update(ShoppingScreenState newState, ShoppingChoice choice = ShoppingChoice.TopLeft, bool force = false)
        {
            if (!force)
            {
                // Take care of the cases when there is no real change of state
                if (newState == CurrentScreenState)
                {
                    return(false);  // keep waiting for change of state
                }

                TimeSpan sinceLastUpdate = DateTime.Now - lastStateChangeTime;

                switch (CurrentScreenState)
                {
                // Delay state change to prevent flickering
                case ShoppingScreenState.Selected:
                    if (sinceLastUpdate.TotalMilliseconds < 5000)
                    {
                        return(false);    // let user to absorb the info
                    }
                    break;

                case ShoppingScreenState.Choice:
                    if (sinceLastUpdate.TotalMilliseconds < 1000)
                    {
                        return(false);    // wait for gaze stabilization
                    }
                    break;
                }
            }

            // Now do change the state
            switch (newState)
            {
            case ShoppingScreenState.Choice:
                break;

            case ShoppingScreenState.Selected:
                SetSelectedSubstate(choice);
                break;
            }

            lastStateChangeTime = DateTime.Now;
            CurrentScreenState  = newState;
            return(true);
        }
 public Visibility IsSelected(ShoppingScreenState sss)
 {
     return(sss == ShoppingScreenState.Selected ? Visibility.Visible : Visibility.Collapsed);
 }
 // Helpers for function bindings
 public Visibility IsChoice(ShoppingScreenState sss)
 {
     return(sss == ShoppingScreenState.Choice ? Visibility.Visible : Visibility.Collapsed);
 }