我无法从 Silverlight 业务应用程序中的代码隐藏中的查询获取结果

发布于 2024-11-25 03:15:14 字数 435 浏览 0 评论 0原文

关于您的书“Pro Business Applications with Silverlight 4”,有一些事情让我感到麻烦。我正在谈论从后面的代码中的查询获取结果。假设您正在使用 WCF RIA 服务,由于服务器和客户端之间的异步机制,您总是得不到任何结果。 我尝试使用像这样的BusyIndi​​cator(VB),但它不起作用:

dim ctx as new DomainService1
dim query= from p As Entity1 In Ctx.GetQueryEntity1Query select p 

If ctx.IsLoading = True Then
   BusyIndicator1.IsBusy = True
   Else
   BusyIndicator1.IsBusy = False
End If

如何停止程序直到服务器完成加载操作?

regarding your book "Pro Business Applications with Silverlight 4" there is something that makes me cumbersome. I'm Talking about getting results from a query in code behind. Suppossing you are using WCF RIA Services, you are always getting Nothing as a result due to asynchronous mecanism between Server and Client.
I've tried to use a BusyIndicator like this (VB), but it doesn't work:

dim ctx as new DomainService1
dim query= from p As Entity1 In Ctx.GetQueryEntity1Query select p 

If ctx.IsLoading = True Then
   BusyIndicator1.IsBusy = True
   Else
   BusyIndicator1.IsBusy = False
End If

How to stop the Program until the Server has completed the Load Operation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

滥情稳全场 2024-12-02 03:15:14

您需要使用 Load-DomainContext 类的方法。此方法需要调用一个查询并指定要加载的实体。
Load-Method 返回
LoadOperation,您可以使用它来检查实体的加载是否已完成并访问加载的实体。

尝试按如下方式更新您的代码:

dim ctx as new DomainService1
dim query= ctx.GetQueryEntity1Query
dim loadOperation = ctx.Load(query)

loadOperation.Completed += LoadCompleted
BusyIndicator1.IsBusy = True

Private Sub LoadCompleted(sender as object, e as EventArgs)
   BusyIndicator1.IsBusy = False
end Sub

You need to load the entities using the Load-Method of the DomainContext class. This method expects a query to invoke and that specifies what entities to load.
The Load-Method returnes an instance of LoadOperation that you can use to check if the load of the entities has finshed and to access the loaded entities.

Try to update your code as following:

dim ctx as new DomainService1
dim query= ctx.GetQueryEntity1Query
dim loadOperation = ctx.Load(query)

loadOperation.Completed += LoadCompleted
BusyIndicator1.IsBusy = True

Private Sub LoadCompleted(sender as object, e as EventArgs)
   BusyIndicator1.IsBusy = False
end Sub
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文