Callback method in RIA Services in Silverlight 4
I have a Silverlight 4 appliction. This appliation is using RIA Services for operations. I have an operat开发者_运维百科ion that I want to do something when it has completed. I know that I need to wireup a callback, but I'm not sure how. Currently, I have the following:
DomainContext.CalculateTotal(param1, param2, OnCalculateTotalCompleted);
...
private void OnCalculateTotalCompleted(InvokeOperation response)
{
}
When I compile this, I get an error that says: No overload for method 'CalculateTotal' takes 3 arguments.
What am I doing wrong? How do I wireup a callback for this specific operation?
Thank you!
there's another parameter that you have to add at the end (UserState
), just use "null".
DomainContext.CalculateTotal(param1, param2, OnCalculateTotalCompleted, null);
The DomainContext.CalculateTotal needs a 4th argument "Object state", so give it a null
, and you are OK.
精彩评论