public PeopleViewModel() { People = new ObservableCollection <Person>(); RegisterPageCommand = new Command(async() => { await App.Current.MainPage.Navigation.PushAsync(new RegisterPage(People)); }); DeletePersonCommand = new Command(() => { People.Remove(People.Where(i => i.Name == selectedPerson.Name).Last()); }); MoreCommand = new Command(async() => { var action = await App.Current.MainPage.DisplayActionSheet("", "Cancel", null, "Call " + selectedPerson.PhoneNumber, "Edit"); if (action == $"Call {selectedPerson.PhoneNumber}") { PhoneDialer.Open(selectedPerson.PhoneNumber); } else if (action == "Edit") { var editAction = await App.Current.MainPage.DisplayPromptAsync("Change Number", "Introduce the new number"); var found = People.FirstOrDefault(i => i.PhoneNumber == selectedPerson.PhoneNumber); int place = People.IndexOf(found); People[place] = new Person(selectedPerson.Name, editAction); } }); }
private void openPhone(object sender, EventArgs args) { try { var cellPhoneNumber = args.GetPropertyValue("Parameter"); if (cellPhoneNumber != null) { if (Device.RuntimePlatform == Device.iOS) { PhoneDialer.Open(cellPhoneNumber.ToString()); } else if (Device.RuntimePlatform == Device.Android) { PhoneDialer.Open(cellPhoneNumber.ToString()); } else if (Device.RuntimePlatform == Device.UWP) { PhoneDialer.Open(cellPhoneNumber.ToString()); } } else { DisplayAlert("Información", "No se cuenta con un número valido", "OK"); } } catch (FeatureNotSupportedException ex) { DisplayAlert("Información", "No se cuenta con un número valido", "OK"); } catch (Exception ex) { DisplayAlert("Información", "Ocurrio un error", "OK"); } }
async void BtnCallButton_Clicked(object sender, EventArgs e) { if (await this.DisplayAlert( "Marcar número", //Titulo "Te gustaría llamar al número " + translatedNumber + "?", //Mensaje "Si", //Botonos para cancelar y aceptar "No") ) { try { PhoneDialer.Open(translatedNumber); } catch (ArgumentNullException) { await DisplayAlert("Incapaz de llamar", "Número de teléfono inválido.", "Ok"); } catch (FeatureNotSupportedException) { await DisplayAlert("Incapaz de llamar", "No se admite la marcación telefónica.", "Ok."); } catch (Exception) { await DisplayAlert("Incapaz de llamar", "Fallo al realizar la llamada.", "Ok"); } } }
private void Call(string s) { if (s.ToString() != null) { PhoneDialer.Open(s.ToString()); } }
public void Call(string number) { if (CrossConnectivity.Current.IsConnected) { try { PhoneDialer.Open(number); var app = Application.Current as App; Analytics.TrackEvent("Caller Icon clicked", new Dictionary <string, string> { { "UserPhoneNumber", app.UserPhoneNumber }, { "Bill Number ", viewModel.BillNumber } }); } catch (FeatureNotSupportedException ex) { //txtNum.Text = "Phone Dialer is not supported on this device." + ex; } catch (Exception ex) { Console.WriteLine(ex); } } else { DependencyService.Get <IToastMessage>().ShortTime("Check your Internet Connection and try again"); } }
public ContactViewModel() { Contacts.Add(new Contact() { Name = "Franklin", Phone = "5658456" }); Contacts.Add(new Contact() { Name = "Someone", Phone = "123456" }); DeleteElementCommand = new Command <Contact>((param) => { Contacts.Remove(param); }); GoToAddContactCommand = new Command(async() => { await App.Current.MainPage.Navigation.PushAsync(new AddContactPage(Contacts)); }); MoreOptionCommand = new Command <Contact>(async(Contactselected) => { var Selection = await App.Current.MainPage.DisplayActionSheet("Contact", "Cancel", null, "Number: " + $"{Contactselected.Phone}", "Edit"); if (Selection == "Number: " + $"{Contactselected.Phone}") { PhoneDialer.Open(Contactselected.Phone); } else if (Selection == "Edit") { // await App.Current.MainPage.Navigation.PushAsync(new EditPage(Contactselected.Name)); //await App.Current.MainPage.Navigation.PushAsync(new EditPage(Contactselected.Phone)); } }); }
async void OnCall(object sender, System.EventArgs e) { if (await this.DisplayAlert( "Marcar Un Numero", "Quieres LLamar a " + translatedNumber + " ?", "Yes", "No")) { try { PhoneDialer.Open(translatedNumber); } catch (ArgumentNullException) { await DisplayAlert("No Disponible para marcar", "El numero de telefono no es valido", "OK"); } catch (FeatureNotSupportedException) { await DisplayAlert("No Disponible Para Marcar", "Marcado de telefono no soportada", "OK"); } catch (Exception) { await DisplayAlert("No Disponible para Marcar", "Marcado de telefono con error", "OK"); } } }
public ContactsViewModel() { GetContacts(); GoToAddViewCommand = new Command(async() => { await App.Current.MainPage.Navigation.PushAsync(new NewContactView(Contacts)); }); DeleteContactCommand = new Command <Contact>(async(contact) => { await App.ContactDatabase.DeleteContact(contact.Id); Contacts.Remove(contact); }); RefreshListCommand = new Command(async() => { Contacts = new ObservableCollection <Contact>(await App.ContactDatabase.GetContactsAsync()); IsRefreshingList = false; }); DisplayMoreCommand = new Command <Contact>(async(contact) => { var option = await App.Current.MainPage.DisplayActionSheet("More", "Cancel", "Close", $"Call {contact.CellNumber}", "Edit"); switch (option) { case "Edit": await App.Current.MainPage.Navigation.PushAsync(new NewContactView(Contacts, contact)); break; default: PhoneDialer.Open(contact.CellNumber); break; } }); }
public async Task OpenPhoneDialer(string contactNumber) { try { PhoneDialer.Open(contactNumber); } catch (ArgumentNullException anEx) { await App.Current.MainPage.DisplayAlert("Error Occurred", "Please verify that the contact number is a valid phone number", "Ok"); } catch (FeatureNotSupportedException ex) { await App.Current.MainPage.DisplayAlert("Error Occurred", "Cannot Open Phone Dialer on this device, please dial number manually", "Ok"); } catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Error Occurred", "Unexpected Error, Please contact administrator", "Ok"); } }
public async void OnCall(object obj, EventArgs e) { if (await DisplayAlert( "Dial a Number", $"Would You Like To Call {translatedNumber}?", "Yes", "No")) { 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) { await DisplayAlert("Unable To Dial", "Phone Dialing Failed", "Ok"); } } ; }
private void PhoneBtn_Clicked(object sender, EventArgs e) { if (NumberPhone != "") { PhoneDialer.Open(NumberPhone); } }
public async void MoreOptions(Models.Contact selectContact) { var selectedAction = await App.Current.MainPage.DisplayActionSheet(null, "Cancel", null, "Call", "Edit"); if (selectedAction == "Cancel") { //cancel action } else if (selectedAction == "Call") { try { PhoneDialer.Open(selectContact.Number); } catch (ArgumentNullException anEx) { // Number was null or white space await App.Current.MainPage.DisplayAlert("Null", "Number Empty", "Ok"); } catch (FeatureNotSupportedException ex) { // Phone Dialer is not supported on this device. } } else if (selectedAction == "Edit") { await App.Current.MainPage.Navigation.PushAsync(new ModifyContactPage(selectContact), false); } }
private void Call(Agent obj) { try { try { PhoneDialer.Open("0799710919"); } catch (ArgumentNullException anEx) { // Number was null or white space } catch (FeatureNotSupportedException ex) { // Phone Dialer is not supported on this device. } catch (Exception ex) { // Other error has occurred. } } catch (Exception) { } }
public PlacePhoneCallStatus PlacePhoneCall(string phoneNumber) { if (string.IsNullOrWhiteSpace(phoneNumber)) { return(PlacePhoneCallStatus.InvalidNumber); } var result = PlacePhoneCallStatus.Unknown; try { PhoneDialer.Open(phoneNumber); result = PlacePhoneCallStatus.Placed; } catch (FeatureNotSupportedException ex) { Debug.Write(ex); result = PlacePhoneCallStatus.NotSupported; } catch (Exception ex) { Debug.Write(ex); result = PlacePhoneCallStatus.Error; } return(result); }
//TODO : To Define Constructor.. public ProfilePageVM(INavigation _Nav) { Navigation = _Nav; if (Constants.UserProfile != null) { MobileVisibility = (Constants.UserProfile.Role == "patient"); Mobile = Constants.UserProfile.Phone; Email = Constants.UserProfile.Email; FullName = Constants.UserProfile.Name; } // BackCommand = new DelegateCommand(BackCommandAsync); LogoutCommand = new Command(LogoutCommandAsync); UpdateCommand = new Command(UpdateCommandAsync); RADIOLOGYCommand = new Command(() => { App.Current.MainPage.Navigation.PushAsync(new TabbedPage(1)); //App.HomeView.Detail.Navigation.PushAsync(new RadioResultPage()); }); LABORATORYCommand = new Command(() => { App.Current.MainPage.Navigation.PushAsync(new TabbedPage(0)); // App.HomeView.Detail.Navigation.PushAsync(new LabResultPage()); }); BloodSampleCommand = new Command(() => { PhoneDialer.Open(Settings.AppSettings_BloodSampleNumber); }); }
private void Phone_Tapped(object sender, EventArgs e) { if (!string.IsNullOrEmpty(SelectedPhone) && SelectedPhone.Length >= 10) { PhoneDialer.Open(SelectedPhone); } }
private async void UsePhoneAsync(Vendor vendor) { try { var action = await DialogService.ShowActionSheetAsync(vendor.Phone, "Cancel", null, "Call", "SMS"); if (action == "Call") { PhoneDialer.Open(vendor.Phone); } else if (action == "SMS") { await Sms.ComposeAsync(new SmsMessage { Recipients = new List <string> { vendor.Phone }, Body = $"Hi {vendor.FirstName}, regarding {Property.Address} " }); } } catch (FeatureNotSupportedException ex) { await DialogService.ShowAlertAsync("Your device does not support this feature", "Feature Not Supported"); } }
public async void callAdvisor(object sender, EventArgs args) { Debug.WriteLine("Tap registered"); Frame myvar = (Frame)sender; Person advisor = myvar.BindingContext as Person; string phoneNumber = advisor.PhoneNumber; if (phoneNumber == "") { await Application.Current.MainPage.DisplayAlert("Sorry!", $"Hmmm... We don't have a phone number on file", "OK"); } else { //Console.WriteLine("ZZZZZZZZZZZZZZZ"); Debug.WriteLine("Manifest.ViewModels.AboutViewModel: Dialing Number:" + phoneNumber); //Console.WriteLine("ZZZZZZZZZZZZZZZ"); try { PhoneDialer.Open(phoneNumber); Debug.WriteLine("IN ABOUTVIEWMODEL. LAUNCHING PHONE"); } catch (Exception e) { await DisplayAlert("Error", "Unable to perform a phone call", "OK"); } //await Launcher.OpenAsync(new Uri("tel:" + phoneNumber)); } }
private async void callPerson(object sender, EventArgs args) { Image myvar = (Image)sender; Person person = myvar.BindingContext as Person; string phoneNumber = person.PhoneNumber; if (phoneNumber == "" || phoneNumber == null) { await DisplayAlert("Sorry!", $"Hmmm... We don't have a phone number on file", "OK"); } else { //Console.WriteLine("ZZZZZZZZZZZZZZZ"); Debug.WriteLine("Manifest.ViewModels.AboutViewModel: Dialing Number:" + phoneNumber); //Console.WriteLine("ZZZZZZZZZZZZZZZ"); try { PhoneDialer.Open(phoneNumber); Debug.WriteLine("IN ABOUTVIEWMODEL. LAUNCHING PHONE"); } catch (Exception e) { await DisplayAlert("Error", "Unable to perform a phone call", "OK"); } //await Launcher.OpenAsync(new Uri("tel:" + phoneNumber)); } }
private async void TapPhone_Tapped(object sender, EventArgs e) { try { var action = await DisplayActionSheet(Property.Vendor.Phone, "Cancel", null, "Call", "SMS"); switch (action) { case "Call": PhoneDialer.Open(Property.Vendor.Phone); break; case "SMS": await Sms.ComposeAsync(new SmsMessage(string.Format("Hej, {0}, angående {1}", Property.Vendor.FirstName, Property.Address), new[] { Property.Vendor.FullName })); break; } } catch (FeatureNotSupportedException fbsEx) { // Email is not supported on this device } catch (Exception ex) { // Some other exception occurred } }
private void PhoneNumer_Tapped(object sender, EventArgs e) { // get phone numer Label lbl = sender as Label; try { PhoneDialer.Open(lbl.Text); } catch (ArgumentNullException anEx) { CrashTracker.Track(anEx); // Number was null or white space } catch (FeatureNotSupportedException ex) { CrashTracker.Track(ex); // Phone Dialer is not supported on this device. } catch (Exception ex) { CrashTracker.Track(ex); // Other error has occurred. } }
public void PlacePhoneCall(string number) { try { PhoneDialer.Open(number); } catch (ArgumentNullException anEx) { // Number was null or white space. Console.WriteLine(anEx); exception.Text = "Number cannot be null or white space"; } catch (FeatureNotSupportedException ex) { // Phone Dialer is not supported on this device. Console.WriteLine(ex); exception.Text = "Phone Dialer is not supported on this device"; } catch (Exception ex) { // Other error has occurred. Console.WriteLine(ex); exception.Text = "Other error has occurred."; } }
async void OnPhoneTapped(object sender, EventArgs e) { if (!UserLogged.IsLogged) { return; } string action = await DisplayActionSheet(Language.tuy_chon, Language.huy, null, Language.goi_dien, Language.nhan_tin); if (action == Language.goi_dien) { try { PhoneDialer.Open(viewModel.User.Phone); } catch (Exception ex) { await DisplayAlert("", ex.Message, Language.dong); } } if (action == Language.nhan_tin) { try { await Sms.ComposeAsync(new SmsMessage(string.Empty, viewModel.User.Phone)); } catch (Exception ex) { await DisplayAlert("", ex.Message, Language.dong); } } }
private async void OnMore(Contact contact) { string option = await App.Current.MainPage.DisplayActionSheet(null, "Cancel", null, "Call +" + contact.Number, "Edit"); if (option == "Call +" + contact.Number) { try { PhoneDialer.Open(contact.Number); } catch (Exception) { await App.Current.MainPage.DisplayAlert("No se pudo realizar la llamada", "Intentelo mas tarde", "Ok"); } } else if (option == "Edit") { int newIndex = Contacts.IndexOf(contact); var result = await App.Current.MainPage.DisplayPromptAsync("Add New Name", "Type Name", "Ok"); var phone = await App.Current.MainPage.DisplayPromptAsync("Add New Number", "Type Number", "Ok"); Contacts.Remove(contact); Contacts.Add(new Contact(result, phone)); int oldIndex = Contacts.Count - 1; Contacts.Move(oldIndex, newIndex); } }
public async Task ItemSelected(object obj) { try { var item = (Value)obj; if (SelectionType == "Phone") { PhoneDialer.Open(item.Label); } else if (SelectionType == "Email") { var message = new EmailMessage { Subject = "Gazette", Body = "Gazette", To = new System.Collections.Generic.List <string> { item.Label }, }; await Email.ComposeAsync(message); } else if (SelectionType == "Website") { await Browser.OpenAsync("https://" + item.Label, BrowserLaunchMode.SystemPreferred); } } catch (Exception ex) { await PageDialogService.DisplayAlertAsync(Dialog.Error, ex.Message, Dialog.Ok); } }
private async Task CallAsync() { try { IsBusy = true; try { PhoneDialer.Open("+5215573348266"); } catch (ArgumentNullException anEx) { // Number was null or white space } catch (FeatureNotSupportedException ex) { // Phone Dialer is not supported on this device. } catch (Exception ex) { // Other error has occurred. } await Application.Current.MainPage.DisplayAlert("Error", "No fue posible completar su solicitud", "Aceptar"); } finally { IsBusy = false; } }
async void OnCall(object sender, System.EventArgs e) { if (await this.DisplayAlert( "Marcar un número", "¿Le gustaría llamar a: " + translatedNumber + "?", "Sí", "No")) { 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 occurred. await DisplayAlert("Unable to dial", "Phone dialing failed.", "OK"); } } }
async public void OnCall(object obj, EventArgs eventArgs) { if ( await DisplayAlert("Dial a number", $"Do you want to call {translatedNumber}?", "Yes", "No") ) { try { PhoneDialer.Open(translatedNumber); System.Diagnostics.Debug.WriteLine("DIALING"); } catch (ArgumentNullException anEx) { // Number was null or white space await DisplayAlert("Exception", $"Exception, NULL: {anEx.ToString()}", "OK"); } catch (FeatureNotSupportedException ex) { // Phone Dialer is not supported on this device. await DisplayAlert("Exception", $"Exception, NO FEATURE: {ex.ToString()}", "OK"); } catch (Exception ex) { // Other error has occurred. await DisplayAlert("Exception", $"Exception: {ex.ToString()}", "OK"); } } else { await DisplayAlert("NO", "NO", "OK"); } }
async void OnCall(object sender, System.EventArgs e) { if (await this.DisplayAlert( "Dial a Number", "Would you like to call " + translatedNumber + "?", "Yes", "No")) { 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 occurred. await DisplayAlert("Unable to dial", "Phone dialing failed.", "OK"); } } }
private async void BtnCall_Clicked(object sender, EventArgs e) { if (await this.DisplayAlert( "Dial a Number", "Would you like to call " + translatedNumber + "?", "Yes", "No" )) { 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 is not supported", "OK"); } catch (Exception) { await DisplayAlert("Unable to dial", "Phone dialing failed", "OK"); } } }