locked
Asynchronous WCF Service Methods Call in Silverlight RRS feed

  • Question

  • we have two Asynchronous  call in silver light , second call response come before first call response .

     

    1.  First  call method :  GetOPDetailsView_TotalAsync(Parameters)

    2.  Second    : GetOPDetailsViewByRG_PLAsync(Paramter)

     

     

     

    But we need response first call should come first coz we use this response in second call.

     

    Thanks

    Girijesh

    Wednesday, March 28, 2012 2:34 AM

Answers

  • Call the second async method when the first one is completed......

    ServiceClient proxy = new ServiceClient();
    protected override void OnNavigatedTo(NavigationEventArgs e)
            {
                proxy.FirstMethodCompleted += FirstMethodCompletedMethod;
                proxy.FirstMethodAsync();
            }
    private void FirstMethodCompletedMethod(sender object,FirstMethodCompletedEventArgs e)
    {
     if(e.Result != null){
             proxy.SecondMethodCompleted += SecondMethodCompletedMethod;
                proxy.SecondMethodAsync();
      }
    
    }
    
    
    Hope this is what you want
    Wednesday, March 28, 2012 6:44 AM

All replies

  • Call the second async method when the first one is completed......

    ServiceClient proxy = new ServiceClient();
    protected override void OnNavigatedTo(NavigationEventArgs e)
            {
                proxy.FirstMethodCompleted += FirstMethodCompletedMethod;
                proxy.FirstMethodAsync();
            }
    private void FirstMethodCompletedMethod(sender object,FirstMethodCompletedEventArgs e)
    {
     if(e.Result != null){
             proxy.SecondMethodCompleted += SecondMethodCompletedMethod;
                proxy.SecondMethodAsync();
      }
    
    }
    
    
    Hope this is what you want
    Wednesday, March 28, 2012 6:44 AM
  • Thanks Ravi..Now problem is solved.

    Wednesday, March 28, 2012 8:47 AM