SIlverlight4 中的提示框
我在 Silverlight 页面上捕获了组合键事件。现在,在事件处理程序中,我想显示一个提示框,它接受用户输入并将其存储到字符串变量中。 我输入了这段代码:
string input = System.Windows.Browser.HtmlPage.Window.Invoke("prompt", new string[] { "QUICK SEARCH", "ENTER YOUR SEARCH ITEM.." }) as string;
但是当我运行它时,它显示 AccessViolation 错误的运行时错误未处理,并显示:“尝试读取或写入受保护的内存。这通常表明其他内存已损坏。” 有什么解决办法吗??
I have captured a key-combination-press event on my Silverlight Page. Now in the event handler i want to display a prompt box which takes user input and stores into a string variable.
I put in this code :
string input = System.Windows.Browser.HtmlPage.Window.Invoke("prompt", new string[] { "QUICK SEARCH", "ENTER YOUR SEARCH ITEM.." }) as string;
But when i run it, It shows me a run time error of AccessViolation error was unhandled saying:"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
any Solutions ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过大量搜索,我发现 Silverlight 应用程序是单线程活动。
通过上述声明,我试图调用另一个线程。
我必须使用调度程序来解决这个问题。
这就是代码的运行方式..
然后在 javaScriptPopup 中,我调用了我的字符串 input = System.Windows.Browser.HtmlPage.Window.Invoke("prompt", new string[] { "QUICK SEARCH", "ENTER YOUR SEARCH ITEM.." }) 作为字符串;陈述。
这里sender1和e1是Object和Keyeventargs类型!
With lot of searching I found out that Silverlight applcation is a Single Thread activity.
And with the above statement I was trying to invoke another thread.
I had to use the Dispatcher to sort this problem out.
this is how the code goes ..
and then in the javaScriptPopup, I called my string input = System.Windows.Browser.HtmlPage.Window.Invoke("prompt", new string[] { "QUICK SEARCH", "ENTER YOUR SEARCH ITEM.." }) as string; statement.
here sender1 and e1 are the Object and Keyeventargs type!!