Exemple #1
0
        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 = Core.PhonewordTranslator.ToNumber(
                    PhoneNumberText.Text);

                // Dismiss the keyboard if text field was tapped
                PhoneNumberText.ResignFirstResponder();

                if (translatedNumber == "")
                {
                    CallButton.SetTitle("Call", UIControlState.Normal);
                    CallButton.Enabled = false;
                }
                else
                {
                    CallButton.SetTitle("Call " + translatedNumber, UIControlState.Normal);
                    CallButton.Enabled = true;
                }
            };


            CallButton.TouchUpInside += (object sender, EventArgs e) => {
                var url = new NSUrl("tel:" + translatedNumber);

                // Store the phone number for the history screen
                phoneNumbers.Add(translatedNumber);

                // Use URL handler with tel: prefix to invoke Apple's Phone app,
                // otherwise show an alert dialog

                if (!UIApplication.SharedApplication.OpenUrl(url))
                {
                    var av = new UIAlertView("Not supported",
                                             "Scheme 'tel:' is not supported on this device",
                                             null,
                                             "OK",
                                             null);
                    av.Show();
                }
            };

            // Load CallHistory view programmatically
            CallHistoryButton.TouchUpInside += (object sender, EventArgs e) => {
                // Launches a new instance of CallHistoryController
                CallHistoryController callHistory =
                    this.Storyboard.InstantiateViewController("CallHistoryController") as CallHistoryController;
                if (callHistory != null)
                {
                    callHistory.PhoneNumbers = PhoneNumbers;
                    this.NavigationController.PushViewController(callHistory, true);
                }
            };
        }
Exemple #2
0
 public CallHistoryDataSource(CallHistoryController controller)
 {
     this.controller = controller;
 }