コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: DebtViewModel.cs プロジェクト: Riders9388/Debtors
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        async void NewMicDialog()
        {
            var newMicIdDialog = new PromptConfig();

            newMicIdDialog.SetInputMode(InputType.Default);
            newMicIdDialog.Title       = "Add a new mic";
            newMicIdDialog.OkText      = "NEXT";
            newMicIdDialog.CancelText  = "CANCEL";
            newMicIdDialog.Placeholder = "Mic ID";
            var micIdResponse = await UserDialogs.Instance.PromptAsync(newMicIdDialog);

            if (micIdResponse.Ok)
            {
                Regex r = new Regex("^[a-zA-Z0-9]*$");
                if (!r.IsMatch(micIdResponse.Text) || micIdResponse.Text == "")
                {
                    UserDialogs.Instance.Alert("Please enter a valid Mic ID!");
                }
                else
                {
                    var newMicNameDialog = new PromptConfig();
                    newMicNameDialog.SetInputMode(InputType.Name);
                    newMicIdDialog.Title       = "Would you like to name your mic?";
                    newMicIdDialog.OkText      = "ADD";
                    newMicIdDialog.CancelText  = "CANCEL";
                    newMicIdDialog.Placeholder = "Mic Name (Optional)";
                    var micNameResponse = await UserDialogs.Instance.PromptAsync(newMicIdDialog);

                    if (micNameResponse.Ok)
                    {
                        AddNewMic(micIdResponse.Text, micNameResponse.Text);
                    }
                }
            }
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        async void NewSoundDialog()
        {
            var newMicIdDialog = new PromptConfig();

            newMicIdDialog.SetInputMode(InputType.Default);
            newMicIdDialog.Title       = "Record a new sound";
            newMicIdDialog.Message     = "What is the name of this sound?";
            newMicIdDialog.OkText      = "NEXT";
            newMicIdDialog.CancelText  = "CANCEL";
            newMicIdDialog.Placeholder = "Doorbell";
            var micIdResponse = await UserDialogs.Instance.PromptAsync(newMicIdDialog);

            if (micIdResponse.Ok)
            {
                Regex r = new Regex("^[a-zA-Z0-9]*$");
                if (!r.IsMatch(micIdResponse.Text) || micIdResponse.Text == "")
                {
                    UserDialogs.Instance.Alert("Please use a different name.");
                }
                else
                {
                    var newDialog = new ConfirmConfig();
                    newDialog.Message = "Have your mic ready to record your sound, then press the record button. ";
                    newDialog.OkText  = "RECORD";
                    newDialog.Title   = "Record a new sound";

                    var recordResponse = await UserDialogs.Instance.ConfirmAsync(newDialog);

                    if (recordResponse)
                    {
                        AddNewSoundRequest(micIdResponse.Text);
                    }
                }
            }
        }
コード例 #11
0
        /// <summary>
        /// Muestra una lista con los idiomas disponibles
        /// </summary>
        /// <param name="languages">Array strings con los idiomas disponibles</param>
        /// <param name="title">Título</param>
        /// <param name="btnText">Mensaje del botón</param>

        /* PENDIENTE IMPLEMENTACION
         * public static async Task<String> SetLanguageAsync(string[] languages, string title, string btnCancelText)
         * {
         *  string result = await UserDialogs.Instance.ActionSheetAsync(title, "", btnCancelText, null, languages);
         *
         *  return result;
         * }*/


        /// <summary>
        /// Pregunta contraseña actual al usuario   IMPLEMENTAR IGUAL QUE ELS ALTRES NOTIFY (NO A LO GUARRO JEJE)
        /// </summary>
        public static async Task <PromptResult> TypePassword()
        {
            PromptConfig pass_config = new PromptConfig();

            pass_config.SetCancellable(true);
            pass_config.SetOkText("Confirmar");
            pass_config.SetTitle("Confirmación contraseña");
            pass_config.SetInputMode(InputType.Password);

            return(await UserDialogs.Instance.PromptAsync(pass_config));
        }
コード例 #12
0
        public async void Save()
        {
            PromptConfig huboPrompt = new PromptConfig()
            {
                IsCancellable = true,
                Title         = Resource.AddManShiftTitle
            };

            huboPrompt.SetInputMode(InputType.Default);
            PromptResult promptResult = await UserDialogs.Instance.PromptAsync(huboPrompt);

            if (promptResult.Ok && promptResult.Text != string.Empty)
            {
                DateTime startShift = Date.Date + StartShift;
                DateTime endShift   = Date.Date + EndShift;

                int result = dbService.SaveShift(startShift, endShift, listOfDrives);

                if (result == -1)
                {
                    await UserDialogs.Instance.AlertAsync(Resource.ShiftAddError, Resource.Alert, Resource.Okay);

                    return;
                }

                if (listOfBreaks.Count != 0)
                {
                    foreach (BreakTable breakItem in listOfBreaks)
                    {
                        breakItem.ShiftKey    = result;
                        breakItem.ActiveBreak = false;

                        dbService.SaveBreak(breakItem);
                    }
                }
                else
                {
                    if (listOfNotes.Count != 0)
                    {
                        foreach (NoteTable note in listOfNotes)
                        {
                            note.ShiftKey = result;

                            await dbService.SaveNote(note.Note, DateTime.Parse(note.Date));
                        }
                    }
                }

                await Navigation.PopModalAsync();
            }
        }
コード例 #13
0
        async void FeedbackDialog()
        {
            var feedbackDialog = new PromptConfig();

            feedbackDialog.SetInputMode(InputType.Default);
            feedbackDialog.Title       = "Submit feedback.";
            feedbackDialog.OkText      = "Submit";
            feedbackDialog.CancelText  = "Cancel";
            feedbackDialog.Placeholder = "Questions, Comments";
            var feedbackResponse = await UserDialogs.Instance.PromptAsync(feedbackDialog);

            if (feedbackResponse.Ok)
            {
                RequestSendFeedback(feedbackResponse.Text);
            }
        }
コード例 #14
0
        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();
        }
コード例 #15
0
        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);
        }
コード例 #16
0
        async void SensitivityDialog(int defaultValue)
        {
            var newSensitivityDialog = new PromptConfig();

            newSensitivityDialog.SetInputMode(InputType.Number);
            newSensitivityDialog.Title       = "Mic Sensitivity";
            newSensitivityDialog.Message     = "Valid values are from 1 to 10";
            newSensitivityDialog.OkText      = "Set";
            newSensitivityDialog.CancelText  = "Cancel";
            newSensitivityDialog.Placeholder = "5";
            newSensitivityDialog.Text        = defaultValue.ToString();
            var micIdResponse = await UserDialogs.Instance.PromptAsync(newSensitivityDialog);

            if (micIdResponse.Ok)
            {
                int newValue = 5;

                var value = micIdResponse.Text;

                if (micIdResponse.Text != "")
                {
                    try
                    {
                        newValue = int.Parse(micIdResponse.Text);
                    }
                    catch
                    {
                        newValue = 0;
                    }
                }


                if (newValue < 1 || newValue > 10)
                {
                    Acr.UserDialogs.UserDialogs.Instance.ShowError("Please enter a valid number from 1 to 10");
                }
                else
                {
                    RequestSetSensitivity(newValue);
                }
            }
        }
コード例 #17
0
        private void PromptAction()
        {
            var config = new PromptConfig();

            config.AndroidStyleId = 0;
            config.SetCancelText("Cancel");
            config.SetOkText("Ok");
            config.SetCancellable(true);
            config.OnAction = (x) => { };
            config.SetOnTextChanged((x) => { });
            config.SetTitle("Add bookmark");
            config.SetPlaceholder("Add bookmark name");
            string text = "My bookmark";

            config.SetText(text);
            config.SetMaxLength(70 + 5);
            config.SetInputMode(InputType.Default);


            var dialog = DependencyService.Get <ICustomUserDialog>();

            dialog.Prompt(config);
        }