I'm working on the graphic app for WP10 now. I need to use GestureRecognizer to move and to resize the objects on the screen. Looks kinda cool, but in some cases with two finger gestures, GestureRecognizer throws this error.
WinRT information: Packets in the frame are inconsistent. Either pointer ids are not unique or there is a discrepancy in timestamps, frame ids, pointer types or source devices.
Everything is OK with one finger gestures. The strange thing here is that this logic works fine on WP8.1.
This is source code of my RecognizerHelper:
GestureHelper::GestureHelper(){
this->recognizer = ref new GestureRecognizer();
this->recognizer->GestureSettings = GestureSettings::ManipulationScale | GestureSettings::ManipulationTranslateX |
GestureSettings::ManipulationTranslateY | GestureSettings::Tap | GestureSettings::ManipulationRotate | GestureSettings::DoubleTap;
this->recognizer->Tapped += ref new TypedEventHandler<GestureRecognizer ^, TappedEventArgs ^>(this, &GestureHelper::OnTapped);
this->recognizer->ManipulationStarted += ref new TypedEventHandler<GestureRecognizer ^, ManipulationStartedEventArgs ^>(this, &GestureHelper::OnManipulationStarted);
this->recognizer->ManipulationCompleted += ref new TypedEventHandler<GestureRecognizer ^, ManipulationCompletedEventArgs ^>(this, &GestureHelper::OnManipulationCompleted);
this->recognizer->ManipulationUpdated += ref new TypedEventHandler<GestureRecognizer ^, ManipulationUpdatedEventArgs ^>(this, &GestureHelper::OnManipulationUpdated);
}
void GestureHelper::ProcessPress(PointerPoint ^ppt){
this->recognizer->ProcessDownEvent(ppt);
if (this->Clicked) {
this->Clicked(ppt->Position.X, ppt->Position.Y);
}
}
void GestureHelper::ProcessMove(PointerPoint ^ppt){
this->recognizer->ProcessMoveEvents(ppt->GetIntermediatePoints(ppt->PointerId));
}
void GestureHelper::ProcessRelease(PointerPoint ^ppt){
this->recognizer->ProcessUpEvent(ppt);
}
void GestureHelper::OnManipulationStarted(GestureRecognizer^ sender, ManipulationStartedEventArgs^ e){
if (this->Pressed){
this->Pressed(e->Position.X, e->Position.Y);
}
}
void GestureHelper::OnManipulationCompleted(GestureRecognizer ^sender, ManipulationCompletedEventArgs ^e) {
if (this->Released) {
this->Released(e->Position.X, e->Position.Y);
}
}
void GestureHelper::OnManipulationUpdated(GestureRecognizer ^sender, ManipulationUpdatedEventArgs ^e){
if (this->MoveUpdated){
this->MoveUpdated(e->Position.X, e->Position.Y);
}
if (this->ZoomUpdated){
this->ZoomUpdated(e->Delta.Scale);
}
if (this->RotateUpdated) {
this->RotateUpdated(-e->Delta.Rotation);
}
}
void GestureHelper::OnTapped(GestureRecognizer ^sender, TappedEventArgs ^e){
if (this->Pressed) {
this->Pressed(e->Position.X, e->Position.Y);
}
if (this->Released){
this->Released(e->Position.X, e->Position.Y);
}
}
Thanks for any help!
UPD: Try-catch is helped, but still would like to understand, why this exception throws
Ok, I have got the answer on the microsoft forum. This is the microsoft bug, that will be fixed in next updates. So now I use try catch to resolve this problem.