Silverlight object model async or sync calls
-
2012年4月14日 19:19
Hello All,
Whether SharePoint 2010 Silverlight Client Object Model calls (ExecuteQuery() i.e, Synchronous call) or (ExecuteQueryAsync(ClientRequestSucceededEventHandler, ClientRequestFailedEventHandler) i.e, Asynchronous call)? or both?
According to this article it uses both. But on internet we don't have examples on ExecuteQuery() method.
Somebody clarify me.Thnx
Like Cricket
全部回复
-
2012年4月14日 19:55版主You can use both, but if you are executing commands in the main UI thread you have to use the asynchronous method.
Regards Bjoern
-
2012年4月16日 13:57
Thanks for the reply
Can I have an example for Synchronous call(ExecuteQuery())?
Like Cricket
-
2012年4月16日 19:56Silverlight only allows ansynchronous calls.
Blog | SharePoint Field Notes Dev Tool | ClassMaster
-
2012年4月16日 21:31版主Steve, that's not entirely true, it's possible to use synchronous calls in threads that don't interact with the UI thread.
Regards Bjoern
-
2012年4月16日 21:46
I understand. An asynchronous call is launching another thread. It is easier to call and manage the return values by calling the ExecuteQueryAsync than manually creating another thread and another delegate just to call the synchronous method. It is easy to manage async calls in Silverlight with in-line delegates.
context.ExecuteQueryAsync((object eventSender, ClientRequestSucceededEventArgs args1) => { }, (object sender, ClientRequestFailedEventArgs eventArgs) => { string message = eventArgs.Message; } );Blog | SharePoint Field Notes Dev Tool | ClassMaster
-
2012年4月17日 13:33
Hi Bjoern H Rapp,
can you please share any link for sync calls also in SilverLight?
Like Cricket

