Assuming your contractual contract interface is called IMyServiceCallback, your service would execute the following code when it wants to raise an event:
IMyServiceCallback callback = OperationContext.Current.GetCallbackChannel<IMyServiceCallback>();
callback.OnGetMapStoryboardsComplete(...);
I found this article very helpful. It describes a system of transient events and a permanent system of events, each of which must satisfy any scenario of events, IMO.
NTN
To set up a callback contract:
interface IMyServiceCallback
{
[OperationContract(IsOneWay = true)]
void OnGetMapStoryboardsComplete(object sender, List<Storyboard>);
}
, :
[ServiceContract(CallbackContract = typeof(IMyServiceCallback))]
interface IMyService
{
}
, . , IMyServiceCallback:
class EventHandler : IMyServiceCallback
{
public void OnGetMapStoryBoardsComplete(object sender, List<Storyboard>)
{
}
}
, InstanceContext, , :
EventHandler eventHandler = new EventHandler();
MyServiceClient client = new MyServiceClient(new InstanceContext(eventHandler));
?