How to make asynchrounous call with OpenNetCf TAPI (Windows Mobil

How to make asynchronous call with OpenNetCf TAPI (Windows Mobile C#)


If you want to make a synchrounous call you can read the previous article on the blog.
But if you want to make an asynchronous call you must write the following lines of code

The example

Ok, instead of calling:

call = line.MakeCall(tbNumber.Text, 39, false);

You must use

line.BeginMakeCall(tbNumber.Text, 39, null, new AsyncCallback(OnCallMade), this);

In this way the method don't block the execution and the OnCallMade method is called when the call is made!
So, implement the callback method OnCallMade

     private void OnCallMade(IAsyncResult ar)
  //with this line of code we can bring up the Call instance in order to hang up it or do something else
            call = line.EndMakeCall(ar);

No comments: