Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am working on a silverlight project using MVVM pattern. Here I have some validations that are being performed by SP's. I just have to call the SP to perform these validations and based on the data returned by the service call I have to continue executing save method. Please see the below sample code.
C#
public void Save()
{
    preSaveValidations();
    if(continueSave==false) //This value will be set in call back method validation service call
          return;

    //Here goes actual service call to save the modifications
}

public void preSaveValidations()
{
    _dataContext.CallValidate(callVaildate_CallBack, null);
}

public void callValidate_CallBack(InvokeOperation<\IEnumerable<\CallValidate_Result>> e)
{
  if(e.HasError==false)
   {
     if(e.Value!=null)
      {
         continueSave=true; // This is the parameter used to continue save method
      }
   }
}

Now the problem is when i run this code, callValidate_CallBack is not being executed, instead code present after preSaveValidations() is being exected, which is resulting in wrong functionality.

Simply, I just want to stop the execution of other code, until results from call back method are generated.

Suggestions please. . .
Posted
Updated 16-May-12 18:29pm
v3

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