gesturerecogizer在WP Direct3D应用程序中抛出异常
GestureRecognizer throws exception in WP Direct3D App
我现在正在开发WP10的图形应用程序。我需要使用GestureRecognizer来移动和调整屏幕上的对象大小。看起来很酷,但在某些情况下,使用两个手指的手势,GestureRecognizer会抛出这个错误。
WinRT information:帧内报文不一致。指针id不是唯一的,或者在时间戳、帧id、指针类型或源设备上存在差异。
用一个手指做手势就可以了。奇怪的是,这个逻辑在WP8.1上工作得很好。
这是我的识别器的源代码: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);
}
}
谢谢你的帮助!
乌利希期刊指南:Try-catch是有帮助的,但仍然想了解为什么这个异常抛出
好的,我在微软论坛上得到了答案。这是微软的错误,将在下次更新中修复。所以现在我用try catch来解决这个问题。
回答:https://social.msdn.microsoft.com/Forums/ru-RU/2353edb7-8c1c-4a8d-9e57-ece72f863616/uwpgesturerecognizer-throws-exception-in-wp-direct3d-app?forum=wpdevelop
相关文章:
- 从构造函数抛出异常时如何克服内存泄漏
- 函数如何通知用户它基于函数原型抛出异常?
- 在缺少函数重载时抛出异常,并带有 std::variant 而不是编译时错误
- VisualStudios 会抛出异常,而代码块不会 [C++]
- 如果不包含 pthread,为什么 GCC 的线程标准库实现会抛出异常?
- ZMQ::send() 抛出异常并终止 QNX 进程.为什么以及如何从中恢复?
- new(std::nothrow) int[n] 抛出异常
- 抛出异常,但未在 c++ 程序中捕获
- 有没有一种方法可以判断程序正在抛出异常
- 即使从类中抛出异常,C++程序也能很好地工作吗?
- X 的错误处理程序抛出异常是否安全?
- Loki:工厂在程序退出时抛出异常
- 程序在VS2008中运行良好,在程序的最后在VS2010中抛出异常
- Boost.Asio应用程序在创建接收器对象时抛出异常
- 检查所有c++函数是否在一个程序中抛出异常的工具
- 抛出异常时应用程序崩溃
- gesturerecogizer在WP Direct3D应用程序中抛出异常
- 在Cygwin上执行的程序没有报告抛出异常
- 为什么 SIGSEGV 的信号处理程序没有捕获我的C++抛出异常?
- 在应用Microsoft更新后,MSMQ在MQOpenQueue上抛出异常