Silverlight C # webservices waiting for process

I am developing a silverlight application where I am using webservices. The server is responsible for processing some text, getting phoneme information, converting to visemes, generating audio and encoding to mp3. A list of weisems and the path to the creation of the audio file are returned. The sound is then transmitted to the client.

But now I have a problem. I need the server to wait for the audio encoding to be fully generated. Sometimes the sound is not ready and it is not transmitted to the client. I tried thread.join but it has the same problem for long texts.

What's the best way to solve this problem?

Thanks in advance

+2


a source to share


1 answer


I may have misunderstood your question, but I think it shouldn't pose much of a problem as the asynchronous pattern will really help you ... My intuitive understanding of this scenario would be something like this:

myWebServiceClient.ProcessTextCompleted += (sndr, evnt) =>
{
  IsBusy = false;
  var url = evnt.Result.PathToCreatedAudioFile;
  PlayAudioFile(url);
};
IsBusy = true;
myWebServiceClient.ProcessTextAsync("abcdefg");

      



Perhaps you could provide a little more information on why this doesn't work for your case.

Cheers, Alex

+1


a source







All Articles