Skip to content
This repository has been archived by the owner on Feb 3, 2022. It is now read-only.

Commit

Permalink
Tutorial finished
Browse files Browse the repository at this point in the history
  • Loading branch information
n8water committed Sep 16, 2020
1 parent a2cbfc5 commit d2bd928
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion XamarinForms/Phoneword/Phoneword/Phoneword/MainPage.cs
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using Xamarin.Essentials;
using Xamarin.Forms;

namespace Phoneword
Expand Down Expand Up @@ -100,7 +101,23 @@ private async void OnCall(object sender, EventArgs e)
"No"
))
{
// TODO: dial the phone
try
{
PhoneDialer.Open(translatedNumber);
}
catch (ArgumentNullException)
{
await DisplayAlert("Unable to dial", "Phone number was not valid.", "OK");
}
catch (FeatureNotSupportedException)
{
await DisplayAlert("Unable to dial", "Phone dialing not supported.", "OK");
}
catch (Exception)
{
// Other error has occured
await DisplayAlert("Unable to dial", "Phone dialing failed", "OK");
}

}

Expand Down

0 comments on commit d2bd928

Please sign in to comment.