private async void createCard_Clicked(object sender, EventArgs e) { PromptConfig prompt = new PromptConfig(); prompt.SetCancelText("Cancel"); prompt.SetOkText("Create"); prompt.SetMessage("Name Card"); prompt.SetInputMode(InputType.Default); PromptResult promptResult = await UserDialogs.Instance.PromptAsync(prompt); if (promptResult.Ok) { Card newCard = await FSManager.addNewCardAsync(promptResult.Text); allCardsToDisplay.Add(newCard); if (mediasToAdd != null) { addMediaToCard(newCard); } } // Resort cards allCardsToDisplay = new ObservableCollection <Card>(FSManager.getAllCards()); cardsHeaderView.updateDataSet(allCardsToDisplay); }
private async void createAlbum() { PromptConfig prompt = new PromptConfig(); prompt.SetCancelText("Cancel"); prompt.SetOkText("Create"); prompt.SetMessage("Create New Album"); prompt.SetInputMode(InputType.Default); PromptResult promptResult = await UserDialogs.Instance.PromptAsync(prompt); if (!promptResult.Ok) { return; } if (FSManager.albumExists(promptResult.Text)) { await DisplayAlert("Notice", "Album name already exists", "OK"); } else { Dir newAlbum = await FSManager.addNewAlbumAsync(promptResult.Text); this.albumsToDisplay.Add(newAlbum); } }
public static async Task <string> ShowInputPrompt(string Ok, string Cancel, string Title, string subTitle, string inputText, InputType type) { PromptConfig t_config = new PromptConfig(); t_config.SetCancelText(Cancel); t_config.SetOkText(Ok); t_config.SetTitle(Title); t_config.SetInputMode(type); t_config.SetText(inputText); t_config.SetMessage(subTitle); PromptResult tm = await UserDialogs.Instance.PromptAsync(t_config); if (tm.Ok) { return(tm.Text); } if (tm.Text.Length > 0) // Work around for IOS { return(tm.Text); } return(null); }
private void AddMail() { PromptConfig config = new PromptConfig(); config.SetAction((result) => { if (!result.Ok || Debtor == null || string.IsNullOrWhiteSpace(result.Value)) { return; } if (Debtor.Mails == null) { Debtor.Mails = new MvxObservableCollection <Mail>(); } Debtor.Mails.Add(new Mail() { Address = result.Value }); RaisePropertyChanged(() => Debtor); }); config.SetInputMode(InputType.Email); config.SetMessage(ResourceService.GetString("setMailAddress")); UserDialogs.Instance.Prompt(config); }
private void EditMail(Mail mail) { if (mail == null) { return; } PromptConfig config = new PromptConfig(); config.SetAction((result) => { if (!result.Ok || Debtor == null || string.IsNullOrWhiteSpace(result.Value)) { return; } mail.Address = result.Value; RaisePropertyChanged(() => Debtor); }); config.SetInputMode(InputType.Email); config.SetMessage(ResourceService.GetString("setMailAddress")); config.SetText(mail.Address); config.OkText = ResourceService.GetString("ok"); config.CancelText = ResourceService.GetString("cancel"); UserDialogs.Instance.Prompt(config); }
private void EditPhone(Phone phone) { if (phone == null) { return; } PromptConfig config = new PromptConfig(); config.SetAction((result) => { if (!result.Ok || Debtor == null || string.IsNullOrWhiteSpace(result.Value)) { return; } phone.Number = result.Value; RaisePropertyChanged(() => Debtor); }); config.SetInputMode(InputType.Phone); config.SetMessage(ResourceService.GetString("setPhoneNumber")); config.SetText(phone.Number); config.OkText = ResourceService.GetString("ok"); config.CancelText = ResourceService.GetString("cancel"); UserDialogs.Instance.Prompt(config); }
private void AddPhone() { PromptConfig config = new PromptConfig(); config.SetAction((result) => { if (!result.Ok || Debtor == null || string.IsNullOrWhiteSpace(result.Value)) { return; } if (Debtor.Phones == null) { Debtor.Phones = new MvxObservableCollection <Phone>(); } Debtor.Phones.Add(new Phone() { Number = result.Value, Type = PhoneNumberType.Mobile }); RaisePropertyChanged(() => Debtor); }); config.SetInputMode(InputType.Phone); config.SetMessage(ResourceService.GetString("setPhoneNumber")); config.OkText = ResourceService.GetString("ok"); config.CancelText = ResourceService.GetString("cancel"); UserDialogs.Instance.Prompt(config); }
async void OnItemSelected(object sender, SelectedItemChangedEventArgs args) { var evento = args.SelectedItem as Wifi; if (evento == null) { return; } viewModel.SelectedNetwork = evento; if (evento.SecurityType != WifiSecurityType.NONE) { PromptConfig config = new PromptConfig(); config.InputType = InputType.Password; config.IsCancellable = true; config.SetTitle("Ingrese password"); config.SetMessage("Ingrese el password de la red wifi " + evento.Ssid); PromptResult result = await UserDialogs.Instance.PromptAsync(config); if (result.Ok) { evento.Password = result.Text; } else { WifisListView.SelectedItem = null; return; } } viewModel.ConnectToNetworkCommand.Execute(evento); viewModel.GetConnectedNetworkCommand.Execute(null); WifisListView.SelectedItem = null; }
private void AddDebtBack() { PromptConfig config = new PromptConfig(); config.SetAction((result) => { if (!result.Ok || Debt == null || string.IsNullOrWhiteSpace(result.Value)) { return; } if (Debt.ValuesBack == null) { Debt.ValuesBack = new List <DebtBack>(); } Debt.ValuesBack.Add(new DebtBack() { DebtId = Debt.Id, Value = Convert.ToDecimal(result.Value) }); RaisePropertyChanged(() => Debt); }); config.SetInputMode(InputType.Phone); config.SetMessage(ResourceService.GetString("setValue")); config.OkText = ResourceService.GetString("ok"); config.CancelText = ResourceService.GetString("cancel"); UserDialogs.Instance.Prompt(config); }
async void stopButton_Clicked(object sender, EventArgs e) { if (isRecording) { AudioPlayerManager.stopRecordAudio(); DateTime audioDuration = new DateTime((long)AudioPlayerManager.getAudioDuration(audioFilePath)); recordingDuration.Text = audioDuration.ToString("HH:mm:ss"); PromptConfig prompt = new PromptConfig(); prompt.SetCancelText("Cancel"); prompt.SetOkText("Create"); prompt.SetMessage("Name audio recording"); prompt.SetInputMode(InputType.Default); PromptResult promptResult = await UserDialogs.Instance.PromptAsync(prompt); if (promptResult.Ok) { // prompt rename audio file // Create a file, if one doesn't already exist. IFile audioFile = await FileSystem.Current.LocalStorage.GetFileAsync(audioFilePath); await audioFile.RenameAsync(promptResult.Text + ".wav"); audioFilePath = audioFile.Path; } this.capturedMedia = new AudioMediaContent(audioFilePath); parentCard?.addMedia(capturedMedia); MediaManager.addNewMedia(capturedMedia); stopRecordMode(); } else if (isPlaying) { AudioPlayerManager.stopPlayAudio(); stopPlayMode(); } //audioPlayerFinished(); }
public static async Task <string> promptInput(string message) { PromptConfig prompt = new PromptConfig(); prompt.SetCancelText("Cancel"); prompt.SetOkText("Accept"); prompt.SetMessage(message); prompt.SetInputMode(InputType.Default); PromptResult promptResult = await UserDialogs.Instance.PromptAsync(prompt); if (promptResult.Text == null) { return(""); } return(promptResult.Text); }
/* * Adds to menu table in azure */ public async void AddItem(object sendeer, EventArgs e) { PromptConfig popup = new PromptConfig(); // to setup a prompt popup.SetOkText("Ok"); popup.SetMessage("Enter a menu title"); // Promt user for menu title PromptResult test = await UserDialogs.Instance.PromptAsync(popup); menuTitle = test.Text; // get the user input for the menu title field // new menuTable object MenuTable mt = new MenuTable() { MenuName = menuTitle, Desc = foodNames, TotalPrice = total }; // add items to azure table await AzureManager.AzureManagerInstance.AddMenu(mt); }
private void ToolbarSearch_Clicked(Object sender, EventArgs e) { try { Device.BeginInvokeOnMainThread(async() => { var toolbarItem = (ToolbarItem)sender; var contextPage = toolbarItem.CommandParameter as ExecutionStageThreeViewModel; CommandItem commandItem = new CommandItem(); LotAndCommandFinder lotAndCommandFinder = new LotAndCommandFinder(); PromptConfig promptConfig = new PromptConfig(); promptConfig.SetTitle("Criterios de Búsqueda"); promptConfig.SetCancelText("Cancelar"); promptConfig.SetOkText("Buscar"); promptConfig.InputType = InputType.Default; promptConfig.SetMessage("Puede ingresar el nombre completo o parte del mismo de un lote o comando a buscar así como una combinación de ambos separados por ':'"); promptConfig.SetPlaceholder("1 - LOTE : 1 - COMANDO"); promptConfig.IsCancellable = true; var criteriaValues = await UserDialogs.Instance.PromptAsync(promptConfig); if (criteriaValues.Ok) { if (criteriaValues.Text.Contains(":")) { if (criteriaValues.Text.Split(':').Length > 2) { Alert.Show("Sólo debe ingresar una vez el separador ':'"); return; } if (string.IsNullOrEmpty(criteriaValues.Text.Split(':')[0])) { Alert.Show("Debe ingresar un criterio antes del separador de búsqueda!"); return; } if (string.IsNullOrWhiteSpace(criteriaValues.Text.Split(':')[0])) { Alert.Show("Debe ingresar un criterio antes del separador de búsqueda!"); return; } if (string.IsNullOrEmpty(criteriaValues.Text.Split(':')[1])) { Alert.Show("Debe ingresar un criterio después del separador de búsqueda!"); return; } if (string.IsNullOrWhiteSpace(criteriaValues.Text.Split(':')[1])) { Alert.Show("Debe ingresar un criterio después del separador de búsqueda!"); return; } lotAndCommandFinder.BothCriteria = true; lotAndCommandFinder.CriteriaA = criteriaValues.Text.Split(':')[0]; lotAndCommandFinder.CriteriaB = criteriaValues.Text.Split(':')[1]; } else { if (string.IsNullOrEmpty(criteriaValues.Text)) { Alert.Show("Debe ingresar un criterio de búsqueda!"); return; } if (string.IsNullOrWhiteSpace(criteriaValues.Text)) { Alert.Show("Debe ingresar un criterio de búsqueda!"); return; } lotAndCommandFinder.BothCriteria = false; lotAndCommandFinder.Criteria = criteriaValues.Text; } if (lotAndCommandFinder.BothCriteria) { foreach (CommandItem item in contextPage.CommandItems) { if (item.NameLot.ToUpper().Contains(lotAndCommandFinder.CriteriaA.ToUpper()) && item.NameCommand.ToUpper().Contains(lotAndCommandFinder.CriteriaB.ToUpper())) { commandItem = item; InstanceItemsListView.ScrollTo(commandItem, ScrollToPosition.Start, true); return; } } Alert.Show("No se encontro el registro"); } else { foreach (CommandItem item in contextPage.CommandItems) { if (item.NameLot.ToUpper().Contains(lotAndCommandFinder.Criteria.ToUpper()) || item.NameCommand.ToUpper().Contains(lotAndCommandFinder.Criteria.ToUpper())) { commandItem = item; InstanceItemsListView.ScrollTo(commandItem, ScrollToPosition.Start, true); return; } } Alert.Show("No se encontro el registro"); } } }); } catch //(Exception ex) { Alert.Show("Ocurrió un error", "Aceptar"); } }