Platform::Array<unsigned char>^ and Platform::String^ have same signature to JS?
-
2012년 3월 14일 수요일 오후 1:23
Given this class:
public ref class Foo sealed { public: Foo(Platform::String^ filePath); Foo(Platform::Array<unsigned char>^ buffer); }
The call in JavaScript
Foo('some file path')
and
Foo([1,2,3])
result in ctor Foo(Platform::String^ pdfFile); being called. How can I force JS to call the array ctor when I am using an array?
Thanks!- 편집됨 phil_ke 2012년 3월 14일 수요일 오후 1:23
모든 응답
-
2012년 3월 15일 목요일 오전 7:59중재자
No, the first letter should be lowercase.
If your JavaScript code doesn't seem to recognize the public properties or methods in the component, make sure that in JavaScript you are using camel casing. For example, the ComputeResult C++ method must be referenced as computeResult in JavaScript.
From:http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh755833(v=vs.110).aspx
Best regards,
JesseJesse Jiang [MSFT]
MSDN Community Support | Feedback to us
-
2012년 3월 15일 목요일 오전 8:53
As you can see Jesse, the first letter has to be uppercase since this is the ctor method I am calling. Any other ideas?
My JS recognizes the public Foo ctor it just always calls the String^ Variant even when called with a byte array as I described.
-
2012년 5월 10일 목요일 오전 10:54
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh441569(v=vs.110).aspx
Do not know if it works on ctor overloading..
[Windows::Foundation::Metadata::Overload("FooArray")]
Foo(Platform::Array<unsigned char>^ buffer);
[Windows::Foundation::Metadata::Overload("FooString")]
Foo(Platform::String^ filePath);- 답변으로 제안됨 James Dailey - MSFTMicrosoft Employee, Moderator 2012년 5월 11일 금요일 오후 11:17
-
2012년 5월 11일 금요일 오전 1:15중재자
Hello phil,
Did adewang82's post answer your question? It looks to me like it should. If you still have questions please let us know.
-James
Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/
-
2012년 5월 11일 금요일 오후 1:38Thanks, I will try that out! :) Although I found a workaround using static functions already.
-
2012년 5월 11일 금요일 오후 3:09No, unfortunately it does not work. The String method is called everytime.
-
2012년 5월 12일 토요일 오전 1:29did you call it through FooArray or Foo?
-
2012년 5월 12일 토요일 오전 8:56Ah, right, I did not di that. Will try again.
-
2012년 6월 7일 목요일 오후 11:18
This probably does not help but, I did file a bug on this issue.
The response was: functions need to have different arities to be overloaded and be seen from JS.
and since I had to look up arities(http://en.wikipedia.org/wiki/Arities).... it is the number of arguments or operands that the function takes
Thanks
Derek- 답변으로 표시됨 DavidLambMicrosoft Employee, Moderator 2012년 7월 11일 수요일 오후 6:42

