Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,41 @@ internal void RawStylusInput(RawStylusInput rawStylusInput)
// Only fire if plugin is enabled and hooked up to plugincollection.
if (__enabled && _pic != null)
{
switch (rawStylusInput.Report.Actions)
try
{
case RawStylusActions.Down:
OnStylusDown(rawStylusInput);
break;
case RawStylusActions.Move:
OnStylusMove(rawStylusInput);
break;
case RawStylusActions.Up:
OnStylusUp(rawStylusInput);
break;
switch (rawStylusInput.Report.Actions)
{
case RawStylusActions.Down:
OnStylusDown(rawStylusInput);
break;
case RawStylusActions.Move:
OnStylusMove(rawStylusInput);
break;
case RawStylusActions.Up:
OnStylusUp(rawStylusInput);
break;
}
}
catch (Exception e)
{
// This code is running on the Stylus Input thread
// and has the chance to call out into app code.
// If the app code throws an exception that is not caught,
// then the app will crash
// and the application will stop responding the touch.
// We don't want to ignore all exceptions,
// so we catch the exception and
// dispatch it to the main thread,
// allowing developers to handle it inside the handler
// for the `Application.DispatcherUnhandledException` event.
_pic.Element.Dispatcher.InvokeAsync(() =>
{
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(e).Throw();
},
// Why we should use `Send` priority?
// Maybe the main thread is busy
// that the developer can not find the exception timely
DispatcherPriority.Send);
}
}
}
Expand Down