Search code examples
c#windows-phone-8phone-call

App closes after phoneCallTask is shown Windows phone 8


On mainpage I call several methods. First methods says some text and then I open CallDialog. This is the code for dialog:

   private void CallDialog()
    {
        PhoneCallTask phone = new PhoneCallTask();
        phone.PhoneNumber = "911";
        phone.Show();

    }

In MainPage loaded event handler I call :

        await Speak("Do you want me to call?");
        CallDialog();
        await Speak("ba bla");
        DispatcherTimer timer = new DispatcherTimer();
        timer.Tick += dispatcherTimer_Tick;
        timer.Interval = new TimeSpan(0, 0, 0, 0, 500);
        timer.Start();

And first line goes off well, and then phone call dialog pops up..The following method does not execute.. if i remove all the folowing methods it works all well.. and if i put

MessageBox.Show("something"); 

after phone call task it shows up before phone call dialog..


Solution

  • I am not sure if I get that correctly, however when you call phone.Show() it basically jumps out of your app and executes phone call with system application so that is why your code is not executed afterwards.

    In other words it is not your app that makes calls (not possible) it is your app telling the system who to call.

    Those tasks are called launchers and if you want to continue with your code, you must wait until user finishes action which is in your case phone call.