public override IScriptCommand Execute(ParameterDic pm) { TouchEventArgs TouchEvent = pm.GetValue <TouchEventArgs>(RoutedEventArgsKey); IUIInput input = pm.GetValue <IUIInput>(InputKey); TouchGesture inputGesture = input.GetTouchGesture(); TouchGesture gesture = pm.GetValue <TouchGesture>(TouchGestureKey); if (inputGesture == null || gesture == null || inputGesture.TouchDevice == UIInputState.NotApplied) { return(OtherwiseCommand); } bool match = (gesture.TouchAction == UITouchGesture.NotApplied || inputGesture.TouchAction == gesture.TouchAction) && (gesture.TouchDevice == UIInputState.NotApplied || inputGesture.TouchDevice == gesture.TouchDevice); return(match ? NextCommand : OtherwiseCommand); }