Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have a WCF client proxy [basically encapsulated as an object ] from here: C# WCF Client/Server without HTTP with Callbacks Made Easy [^]

I would like that my winforms application handle the callback data but since my proxy implements the interface making a nice encapsulation - I need to expose those changes - should I create an event in my proxy or is there a better or more correct way to do this?

My interface members basically exists like this and is implemented by the ClientProxy
C#
interface IWCFCallback
{
		[OperationContract(IsOneWay = true)]
		void OnBrandDataChanged(List<BRAND> brandList);	
}


in the proxyClass

C#
ClientProxy : IWCFCallback
{

		public void OnBrandDataChanged(List<BRAND> brandList)
		{
// SHOULD I Raise an event here that this List<BRAND> can be made available out side of the proxy and my Windows Forms application can subscribe to the event. Or is there another more accepted or better way this can be available to my Winform application ?
			throw new NotImplementedException();
		}

}
Posted
Comments
SundararamanS 4-Aug-15 8:24am    
Yes, raising the event in the callback will be one simplest option. The other option would be use IOCP based thread synchronization to notify the UI thread and pass the object to the same which obviously is little complex...
stixoffire 4-Aug-15 20:05pm    
Thank you - this is what I was looking for .. I don't know as much as I would like to know so getting advice from more experienced programmers is helpful.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900