I am trying to send a JSON string through a Winforms application to a Silverlight application.
I tried several times to do this by exposing my silverlight method using
HtmlPage.RegisterScriptableObject("Page", this);
.....
[ScriptableMember]
public void CallMeInSilverlight(string message)
{
HtmlPage.Window.Alert("The form said: " + message);
}
in javascript
function CallMe(message) {
var control = document.getElementById('silverlightControl');
control.Content.Page.CallMeInSilverlight(message);
}
But for some reason I cannot do this work with javascript. It is simply not caused.
in winforms
webBrowser1.Document.InvokeScript("CallMe", new object[] { "testing 1 2 3" });
Am I doing something wrong?
source
share