Error while drawing shape on Canvas Windows 10 Universal Apps - c#

I am creating an app that draws shapes on canvas and those shapes are recognized as letters using https://github.com/phatware/WritePadSDK sdk for writing pad. but the problem is that this api code works fine when it is used in windows 8.1 project but when the same code is used in windows 10 universal app it produces error when i debugged the code. Code of xaml is given bellow
<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 which is recognizes the shape using sdk is given bellow which is executed on PointerReleased event of Canvas:-
var resultValue = recognizerShared.RecognizeStrokes(InkCanvas.Children.ToList(), false);
and when i inspected the method given in sdk i.e. RecognizeStrokes which does the recolonization i got error when i did debugging
As this code works fine in windows 8.1 project i think it can be something todo with windows 10 universal app problem
Excelption details is given bellow:-
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 of type 'System.InvalidCastException'
ContextFlyout = 'new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items[0].ContextFlyout' threw an exception of type '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' threw an exception of 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 to solve the problem above.
Link to download the sample project code is given bellow for testing where you can see the problem
https://www.dropbox.com/s/1xbtxbxwyoyuf00/WindowsSDK.rar?dl=0
Thanks!

Related

Xamarin Project works fine in Android, throws "405" errors in UWP when calling WCF

I have an App that works fine when I set Android as the startup project but throws an error when I have UWP as the startup project. I have found, by commenting out code here and there, that the error is occurring when I make a call to my WCF. The second line below is causing the error:
_client = new Service1Client(binding, Endpoint);
var result = _client.CreateUser(Txt_UserName.Text , Txt_Password.Text);
The blah error message I can get so far is:
Unhandled exception at 0x0878DC3C (Windows.UI.Xaml.dll) in MyApp.UWP.exe:
0xC000027B: An application-internal exception has occurred (parameters:
0x172E2738, 0x00000006). occurred
Also apparently this was running right before it crashed:
#define BEGIN_DELEGATE_MAP(CLASS)\
ref class delegate_proxy_type;\
msclr::delegate_map::internal::delegate_proxy_factory<CLASS> m_delegate_map_proxy;\
\
ref class delegate_proxy_type\
{\
CLASS* m_p_native_target;\
public:\
delegate_proxy_type(CLASS* pNativeTarget) : m_p_native_target(pNativeTarget) {}\
void detach() { m_p_native_target = NULL; }
#define EVENT_DELEGATE_ENTRY(MEMBER,ARG0,ARG1)\
void MEMBER(ARG0 arg0,ARG1 arg1)\
{\
if(m_p_native_target == NULL)\
throw gcnew System::ArgumentNullException("Delegate call failed: Native sink was not attached or has already detached from the managed proxy (m_p_native_target == NULL). Hint: see if native sink was destructed or not constructed properly");\
\
m_p_native_target->MEMBER(arg0,arg1);\
}
#define END_DELEGATE_MAP()\
};
#define MAKE_DELEGATE(DELEGATE,MEMBER)\
gcnew DELEGATE(m_delegate_map_proxy.get_proxy(this),&delegate_proxy_type::MEMBER)
To further narrow down the cause of this error I created a simple standalone UWP app and I am trying to connect it to a WCF. On this program, I am getting this error message when I make the WCF method call:
'The remote server returned an unexpected response: (405) Method Not Allowed.'
Any ideas on the cause of this error? Thanks in Advance.
Per #Xavier:
Changing the settings in the app manifest solved my problem! It was that simple. Thanks.

How to get a the value of "background-color" property of an element that I have in my NATIVE App

I'm developing a test code in c# (v3.0.02 of Appium) and I need to get the value of "background-color" property of an element that I have in my NATIVE App.
Here is a part of the code:
ReadOnlyCollection obj = driver.FindElementsByName("lblProtocolo");
for(int i=0;i<obj.Count;i++)
{
var str = obj[i].GetCssValue("background-color");
}
but is throwing an exception:
Test method ASEXamarin.Shared.Tests.TelaInicial.TesteRows threw exception:
System.NotImplementedException: Not yet implemented. Please help us: http://appium.io/get-involved.html
There is any form to get this property in NATIVE Apps?
There is a related post in:
Appium Android UI testing - how to verify the style attribute of an element?

ArgumentException on MediaElement AreTransportControlsEnabled property set (Windows Phone 8.1)

I am developing Windows Phone application and I got a really weird exception when I set my MediaElement object property AreTransportControlsEnabled to some value:
_mediaElement.IsFullWindow = fullScreen;
_mediaElement.AreTransportControlsEnabled = fullScreen;
This is what that I get:
Exception thrown: 'System.ArgumentException' in MyApp.ni.EXE WinRT
information: The value cannot be infinite or Not a Number (NaN).
Additional information: The parameter is incorrect.
The value cannot be infinite or Not a Number (NaN).
How boolean value can be a NAN or in finite and why it's allways throws the exception on the AreTransportControlsEnabled boolean property and not on IsFullWindow?
This issue is still hunting me...2 months gone now...

C# VSTO Addin Exception With CurrentItem

When trying to obtain the current item with focus in an outlook 2013 addin I get this exception: An exception of type 'System.MissingMemberException' occurred in System.Dynamic.dll but was not handled in user code
Additional information: Error while invoking [PROPERTYGET, DISPID(0)].
The code throwing the exception is this:
Inspector curObj = Globals.ThisAddIn.Application.ActiveInspector();
Object curItem = curObj.CurrentItem();
The second line throws the exception. The addin is launched from a button on the ribbon when in the create message window.
What is the proper way to access the current item as I think I'm doing it wrong which is causing the issue, since it's saying CurrentItem is not a member. The VBA code examples do it similar to this, but in C# CurrentItem doesn't seem to work the same.
CurrentItem is a property, not a method.

Emgu.CV Not supported Uri format

I have some program on my 1st pc (everytinh works fine)
but when I copy my full project to another PC and try to run application I get this error :
A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll
Additional information: Formaty identyfikatorów URI nie są obsługiwane.
If there is a handler for this exception, the program may be safely continued.
and than:
A first chance exception of type 'System.BadImageFormatException' occurred in Emgu.CV.dll
Additional information: Próbowano załadować program w niepoprawnym formacie. (Wyjątek od HRESULT: 0x8007000B)
If there is a handler for this exception, the program may be safely continued.
in this code:
BackgroundSubtractorMOG2 pMog11 = new BackgroundSubtractorMOG2(0, 80, false);
I have really have no idea what to do with this. What is the problem with Emgu.CV in the 2nd pc?

Categories

Resources