示例#1
0
        public static bool TryReceive(IntentDefinition intent, out UserIntent intentObject)
        {
            intentObject = null;

            switch (intent.type)
            {
            case IntentionType.SingleHand:
                if (intent.handedness == Chirality.Left)
                {
                    if (_leftHandIntention != null && _bothHandIntention != null)
                    {
                        intentObject       = _leftHandIntention;
                        _leftHandIntention = null;
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    if (_rightHandIntention != null && _bothHandIntention != null)
                    {
                        intentObject        = _rightHandIntention;
                        _rightHandIntention = null;
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }

            case IntentionType.BothHands:
                if (_leftHandIntention != null &&
                    _rightHandIntention != null &&
                    _bothHandIntention != null)
                {
                    intentObject       = _bothHandIntention;
                    _bothHandIntention = null;
                    return(true);
                }
                else
                {
                    return(false);
                }

            default:
                return(false);
            }
        }
示例#2
0
 private UserIntent(IntentDefinition intentDefinition)
 {
     _def = intentDefinition;
 }