Silverlight,异步执行直到结束 [英] Silverlight, Wait Asynchronously Executing Until Over

查看:90
本文介绍了Silverlight,异步执行直到结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个名为聊天室"的解决方案,并且我有Silverlight应用程序,还有WCF数据服务的花药.


我需要检查昵称是否存在,然后答案是否定的,我需要插入新访客.

因此,我需要调用服务并选择一条记录然后插入一条记录.

但是Silverlight异步调用服务,因此我需要同步调用服务方法.经过艰苦的网络导航后,我知道这不适用.

因此,在这一点上,我需要异步调用Select方法,等到完成后再调用Insert方法.

如果可以的话,请提供代码.如果还有其他解决方法或其他方法,请提供代码.

Hi,

I have a solution called "Chat Room", and I have Silverlight application, and anther for WCF Data Service.


I need to check if the Nickname Exists, then if the answer is False I need to Insert the new visitor.

So I need to call the service and Select a record then Insert a record.

But Silverlight Invoke Asynchronously to services and I need to call services methods Synchronously; After hard web navigating I know that this not applicable.

So What I need at this point is to call the Select method Asynchronously and wait till finishing and then Call the Insert method.

Please provide code if you can also if there is any other workaround or other methodology it will be appreciated.

推荐答案

您可以做的是使用委托并将insert方法放置在此回调中. Web方法返回后,执行委托.
What you can do is use a delegate and place the insert method in this callback. Once the web method returns, execute the delegate.




您是否已经经历过这些:
-与Silverlight进行的同步Web服务调用:消除仅异步的神话 [ Silverlight 4同步WCF服务调用(或如何避免编写1层Silverlight应用程序") [^ ]

不确定他们是否会提供确切的帮助,但您也许可以使用这些想法.
Hi,

Did you already go through these:
- Synchronous Web Service Calls with Silverlight: Dispelling the async-only myth[^]
- Silverlight 4 Synchronous WCF Service Calls (or "How to avoid writing a 1-tier Silverlight App")[^]

Not sure if they offer exact help but you might be able to use the ideas.


这篇关于Silverlight,异步执行直到结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆