void ReleaseDesignerOutlets() { if (CallButton != null) { CallButton.Dispose(); CallButton = null; } if (HistoryButton != null) { HistoryButton.Dispose(); HistoryButton = null; } if (PhonewordText != null) { PhonewordText.Dispose(); PhonewordText = null; } if (TranslateButton != null) { TranslateButton.Dispose(); TranslateButton = null; } }
public override void ViewDidLoad() { base.ViewDidLoad(); TranslateButton.TouchUpInside += (object sender, EventArgs e) => { // Convert the phone number with text to a number // using PhoneTranslator.cs translatedNumber = PhonewordTranslator.ToNumber(PhonewordText.Text); // Dismiss the keyboard if text field was tapped PhonewordText.ResignFirstResponder(); makeInsertCall(); }; CallButton.TouchUpInside += (object sender, EventArgs e) => { // Use URL handler with tel: prefix to invoke Apple's Phone app... var url = new NSUrl("tel:" + translatedNumber); if (!UIApplication.SharedApplication.OpenUrl(url)) { var alert = UIAlertController.Create("Not supported", "Scheme 'tel:' is not supported on this device", UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null)); PresentViewController(alert, true, null); } }; HistoryButton.TouchUpInside += (object sender, EventArgs e) => { }; }