Error while drawing on Canvas Windows 10 Universal Apps

I am creating an application that draws shapes on canvas, and these shapes are recognized as letters using the https://github.com/phatware/WritePadSDK sdk to write the pad. but the problem is that this api code works fine when it is used in a Windows 8.1 project, but when the same code is used in a universal Windows 10 application, it causes an error while debugging the code. The xaml code is below.

<Canvas Background="WhiteSmoke" Name="InkCanvas" PointerPressed="OnCanvasPointerPressed" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" PointerReleased="OnCanvasPointerReleased" PointerCaptureLost="OnCanvasPointerCaptureLost" PointerExited="InkCanvas_OnPointerExited" PointerMoved="OnCanvasPointerMoved" LostFocus="InkCanvas_LostFocus"> 

and the code that recognizes the form using sdk is given below, which is executed in the Caninter: PointerReleased event: -

  var resultValue = recognizerShared.RecognizeStrokes(InkCanvas.Children.ToList(), false); 

and when I checked the method specified in sdk ie RecognizeStrokes , which causes a recolonization error when I debugged

enter image description here

How this code works fine in a Windows 8.1 project, I think it might be something like a problem with a universal Windows 10 application

Excelption details are given below: -

 AccessKey = 'new System.Collections.Generic.Mscorlib_CollectionDebugView<Windows.UI.Xaml.UIElement>(strokes).Items[0].AccessKey' threw an exception of type 'System.InvalidCastException' 

AccessKeyScopeOwner = 'new System.Collections.Generic.Mscorlib_CollectionDebugView (strokes) .Items [0] .AccessKeyScopeOwner' threw an exception of type "System.InvalidCastException"

AllowFocusOnInteraction = '((Windows.UI.Xaml.FrameworkElement) new System.Collections.Generic.Mscorlib_CollectionDebugView (strokes) .Items [0]). AllowFocusOnInteraction 'threw an exception of type' System.InvalidCastException '

AllowFocusWhenDisabled = '((Windows.UI.Xaml.FrameworkElement) new System.Collections.Generic.Mscorlib_CollectionDebugView (strokes) .Items [0]). AllowFocusWhenDisabled 'threw an exception like "System.InvalidCastException"

ContextFlyout = 'new System.Collections.Generic.Mscorlib_CollectionDebugView (strokes) .Items [0] .ContextFlyout' threw an exception like "System.InvalidCastException"

ExitDisplayModeOnAccessKeyInvoked = 'new System.Collections.Generic.Mscorlib_CollectionDebugView (strokes) .Items [0] .ExitDisplayModeOnAccessKeyInvoked' threw an exception of type "System.InvalidCastException"

FocusVisualMargin = '((Windows.UI.Xaml.FrameworkElement) new System.Collections.Generic.Mscorlib_CollectionDebugView (strokes) .Items [0]). FocusVisualMargin 'thrown type' System.InvalidCastException '

FocusVisualPrimaryBrush = '((Windows.UI.Xaml.FrameworkElement) new System.Collections.Generic.Mscorlib_CollectionDebugView (strokes) .Items [0]). FocusVisualPrimaryBrush 'threw an exception of type' System.InvalidCastException '

new System.Collections.Generic.Mscorlib_CollectionDebugView (strokes) .Items [0] .IsAccessKeyScope

Please help me solve the problem above.

A link to download a sample project code is provided below for testing, where you can see the problem.

https://www.dropbox.com/s/1xbtxbxwyoyuf00/WindowsSDK.rar?dl=0

Thanks!

+5
source share

Source: https://habr.com/ru/post/1258465/


All Articles