Search code examples
windows-phone-8windows-phone

Close app after calling smscomposetask


I tried using the following code but its not working as the app closes immediately without even showing compose message task:

private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            SmsComposeTask smsComposeTask = new SmsComposeTask();
            smsComposeTask.To = number;
            smsComposeTask.Body = "I'll call you back.";
            smsComposeTask.Show();
            Application.Current.Terminate();
        }

Is there a way to close app after this button is clicked and sms task has been completed?


Solution

  • i added a 500ms delay between show task and terminate. the app went tombstone in this time and couldn't execute terminate statement.

    smsComposeTask.Show();
     System.Threading.Thread.Sleep(500);
     Application.Current.Terminate();