GestureRecognizer.IsRecognizerAvailable 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
사용자 시스템에서 제스처 인식기를 사용할 수 있는지 여부를 나타내는 부울 값을 가져옵니다.
public:
property bool IsRecognizerAvailable { bool get(); };
public bool IsRecognizerAvailable { get; }
member this.IsRecognizerAvailable : bool
Public ReadOnly Property IsRecognizerAvailable As Boolean
속성 값
인식 구성 요소를 사용할 수 있으면 true
이고, 그렇지 않으면 false
입니다.
예제
다음 예제에서는 메서드를 호출 Recognize 하기 전에 제스처 인식기를 사용할 수 있는지 여부를 확인하는 방법을 보여 줍니다.
private bool InterpretScratchoutGesture(Stroke stroke)
{
// Attempt to instantiate a recognizer for scratchout gestures.
ApplicationGesture[] gestures = { ApplicationGesture.ScratchOut };
GestureRecognizer recognizer = new GestureRecognizer(gestures);
if (!recognizer.IsRecognizerAvailable)
return false;
// Determine if the stroke was a scratchout gesture.
StrokeCollection gestureStrokes = new StrokeCollection();
gestureStrokes.Add(stroke);
ReadOnlyCollection<GestureRecognitionResult> results = recognizer.Recognize(gestureStrokes);
if (results.Count == 0)
return false;
// Results are returned sorted in order strongest-to-weakest;
// we need only analyze the first (strongest) result.
if (results[0].ApplicationGesture == ApplicationGesture.ScratchOut &&
results[0].RecognitionConfidence == RecognitionConfidence.Strong)
{
// Use the scratchout stroke to perform hit-testing and
// erase existing strokes, as necessary.
return true;
}
else
{
// Not a gesture: display the stroke normally.
return false;
}
}
Private Function InterpretScratchoutGesture(ByVal stroke As Stroke) As Boolean
' Attempt to instantiate a recognizer for scratchout gestures.
Dim gestures() As ApplicationGesture = {ApplicationGesture.ScratchOut}
Dim recognizer As New GestureRecognizer(gestures)
If Not recognizer.IsRecognizerAvailable Then
Return False
End If
' Determine if the stroke was a scratchout gesture.
Dim gestureStrokes As StrokeCollection = New StrokeCollection()
gestureStrokes.Add(stroke)
Dim results As ReadOnlyCollection(Of GestureRecognitionResult)
results = recognizer.Recognize(gestureStrokes)
If results.Count = 0 Then
Return False
End If
' Results are returned sorted in order strongest-to-weakest;
' we need only analyze the first (strongest) result.
If (results(0).ApplicationGesture = ApplicationGesture.ScratchOut) Then
' Use the scratchout stroke to perform hit-testing and
' erase existing strokes, as necessary.
Return True
Else
' Not a gesture: display the stroke normally.
Return False
End If
End Function