Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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));
        }
Ejemplo n.º 5
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();
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        /*
         * 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);
        }
Ejemplo n.º 8
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);
        }
 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");
     }
 }