In a client application, I am using an asynchronous WCF method being called from the following code:
public void doActiveDx()
{
this.dataservice.GetActiveDxCompleted += (s,e) =>
{
...do something...
};
this.dataservice.GetActiveDxAsync( );
}
Why is the delegate called multiple times when doActiveDx() is called but once?
In my case, ...do something..., is updating an observable collection bound to the display, so having the delegate called multiple times is causing a flickering effect on the display.
How can I have the delegate called but once on completion of doActiveDx() ???
TIA
Every time a call to doActiveDx
is performed, the delegate is registered once again. This results in multiple calls to the delegate on subsequent calls to doActiveDx
.
Make sure you are registering the delegate just once. For instance, try registering it outside the doActiveDx
function.