Click here to Skip to main content
15,910,123 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: How to create channel factory for Sync Wcf contract? Pin
Mark Salsbery23-Jul-09 7:08
Mark Salsbery23-Jul-09 7:08 
GeneralRe: How to create channel factory for Sync Wcf contract? Pin
Michael Sync23-Jul-09 7:38
Michael Sync23-Jul-09 7:38 
GeneralRe: How to create channel factory for Sync Wcf contract? Pin
Michael Sync23-Jul-09 7:41
Michael Sync23-Jul-09 7:41 
GeneralRe: How to create channel factory for Sync Wcf contract? Pin
Mark Salsbery23-Jul-09 7:47
Mark Salsbery23-Jul-09 7:47 
GeneralRe: How to create channel factory for Sync Wcf contract? Pin
pioner23-Jul-09 10:25
pioner23-Jul-09 10:25 
GeneralRe: How to create channel factory for Sync Wcf contract? Pin
Michael Sync23-Jul-09 19:38
Michael Sync23-Jul-09 19:38 
GeneralRe: How to create channel factory for Sync Wcf contract? Pin
pioner23-Jul-09 22:05
pioner23-Jul-09 22:05 
AnswerRe: How to create channel factory for Sync Wcf contract? Pin
Adriaan Davel23-Jul-09 19:44
Adriaan Davel23-Jul-09 19:44 
I am doing most of my WCF services "near" sync in Silverlight 3 based on this article Synchronous Web Service Calls with Silverlight 2: Dispelling the async-only myth[^].

Basically I add the service reference as per normal, then generate the channel factory as below:

ThreadPool.QueueUserWorkItem(delegate
{
	var channelFactory = new ChannelFactory<IDataService>("*");
	var dataService = channelFactory.CreateChannel();
	var asyncResult = dataService.BeginSaveMethod(dataObject, null, null);
	newInfonMachineActiveDefinition.Id = dataService.EndSaveMethod(asyncResult);

	if (Dispatcher.CheckAccess())
	{
		Visibility = Visibility.Collapsed;
	}
	else
	Dispatcher.BeginInvoke(delegate
	{
		Visibility = Visibility.Collapsed;
	});
});


NOTE: I have not shown any exception handling here to keep the code simpler

It is important that you call the Dispatcher from the same thread that is executing the "sync" call else your UI is not going to wait for the call to finish...

This approach has one major downside, the call must be done form code behind of the control and not from a proxy class in your client, but you can try to refactor it to pass a delegate to your proxy class that will be called from the Dispatcher, or something like that...

____________________________________________________________
Be brave little warrior, be VERY brave

AnswerRe: How to create channel factory for Sync Wcf contract? Pin
DukeZ16-Aug-11 5:18
DukeZ16-Aug-11 5:18 
QuestionListView SelectedValue Binding issue Pin
bonkers12322-Jul-09 21:19
bonkers12322-Jul-09 21:19 
AnswerRe: ListView SelectedValue Binding issue Pin
Pete O'Hanlon22-Jul-09 21:44
mvePete O'Hanlon22-Jul-09 21:44 
GeneralRe: ListView SelectedValue Binding issue Pin
bonkers12323-Jul-09 1:25
bonkers12323-Jul-09 1:25 
GeneralRe: ListView SelectedValue Binding issue Pin
Pete O'Hanlon23-Jul-09 2:54
mvePete O'Hanlon23-Jul-09 2:54 
QuestionVirtualisation in ComboBox Pin
SriBalupalakkattu22-Jul-09 20:55
SriBalupalakkattu22-Jul-09 20:55 
AnswerRe: Virtualisation in ComboBox Pin
Michael Sync23-Jul-09 6:09
Michael Sync23-Jul-09 6:09 
GeneralRe: Virtualisation in ComboBox Pin
Jeremy Likness26-Jul-09 3:03
professionalJeremy Likness26-Jul-09 3:03 
QuestionRSS using Silver light Pin
Nekkantidivya22-Jul-09 19:03
Nekkantidivya22-Jul-09 19:03 
AnswerRe: RSS using Silver light Pin
Michael Sync23-Jul-09 6:11
Michael Sync23-Jul-09 6:11 
QuestionMessage Removed Pin
22-Jul-09 4:06
professionalN_tro_P22-Jul-09 4:06 
AnswerRe: Binding Questioon Pin
Pete O'Hanlon22-Jul-09 4:34
mvePete O'Hanlon22-Jul-09 4:34 
Questionhow to get the scroll vertical and scroll horizantal for a page created in WPF Pin
Krishna Aditya22-Jul-09 4:04
Krishna Aditya22-Jul-09 4:04 
AnswerRe: how to get the scroll vertical and scroll horizantal for a page created in WPF Pin
#realJSOP22-Jul-09 4:24
professional#realJSOP22-Jul-09 4:24 
GeneralRe: how to get the scroll vertical and scroll horizantal for a page created in WPF Pin
Krishna Aditya22-Jul-09 4:29
Krishna Aditya22-Jul-09 4:29 
AnswerRe: how to get the scroll vertical and scroll horizantal for a page created in WPF Pin
Krishna Aditya22-Jul-09 4:24
Krishna Aditya22-Jul-09 4:24 
QuestionActive Directory in Silverlight Pin
GomathiR22-Jul-09 1:55
GomathiR22-Jul-09 1:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.