private async void CallButton_Clicked(object sender, EventArgs e)
 {
     if (await this.DisplayAlert("Dial a Number", "Would you like to call " + translatedNumber + "?", "Yes", "No"))
     {
         IDialer dialer = DependencyService.Get <IDialer>();
         if (dialer != null)
         {
             await dialer.DialAsync(translatedNumber);
         }
     }
 }
Beispiel #2
0
        async void OnCall(object sender, EventArgs e)
        {
            bool result = await this.DisplayAlert(title : "Dial a Number",
                                                  message : $"Would you like to call {phoneNum}",
                                                  accept : "Yes",
                                                  cancel : "No");

            if (result)
            {
                // TODO: dial the phone
                IDialer dialer = DependencyService.Get <IDialer>();

                if (dialer != null)
                {
                    await dialer.DialAsync(phoneNum);
                }
            }
        }
Beispiel #3
0
        async void OnCall(object obj, EventArgs args)
        {
            bool answer = await DisplayAlert("Dia; a Number",
                                             "Would you like to call " + translatedNumber + "?",
                                             "Yes",
                                             "No");

            if (answer)
            {
                // Get Implementation with Dependency Service
                IDialer dialer = DependencyService.Get <IDialer>();
                if (dialer != null)
                {
                    // Call the methd in platform
                    await dialer.DialAsync(translatedNumber);
                }
            }
        }
Beispiel #4
0
        //private void OnTranslate(object sender, EventArgs e)
        //{
        //	string enteredNumber = numberEntry.Text;
        //	string translatedNumber = PhonewordTranslator.ToNumber(enteredNumber);
        //	if (!string.IsNullOrEmpty(translatedNumber))
        //	{
        //		callButton.Text = "Call " + translatedNumber;
        //		callButton.IsEnabled = true;
        //	}
        //	else {
        //		callButton.Text = "Call";
        //		callButton.IsEnabled = false;
        //	}
        //}

        async void OnCall(object sender, EventArgs e)
        {
            int    numeroTelefone   = 0;
            string enteredNumber    = numberEntry.Text;
            string translatedNumber = PhonewordTranslator.ToNumber(enteredNumber);

            //asynchronous 'await' keyword for this method
            if (await this.DisplayAlert("Dial a Number",
                                        "Você gostaria de ligar para " + translatedNumber + "?",
                                        "Sim", "Não"))
            {
                IDialer dialer = DependencyService.Get <IDialer>();
                if (dialer != null)
                {
                    await dialer.DialAsync(translatedNumber);

                    numeroTelefone = Int32.Parse(numberEntry.Text);
                    numeroTelefone++;
                    numberEntry.Text = numeroTelefone.ToString();
                }
            }
        }
Beispiel #5
0
 public Task <ITransportConnection> DialAsync(Multiaddress remoteAddress, CancellationToken cancellationToken)
 {
     return(_dialer.DialAsync(remoteAddress, cancellationToken)
            .ContinueWith(t => new TcpConnection(t.Result, _transport) as ITransportConnection, cancellationToken, TaskContinuationOptions.NotOnFaulted | TaskContinuationOptions.NotOnCanceled, TaskScheduler.Current));
 }