예제 #1
0
        private async Task <int> ExecuteInputPopup(string Title)
        {
            var inputView = new TextInputView(Title);
            var popup     = new InputAlertDialogBase <int>(inputView);

            inputView.CloseButtonEventHandler +=
                (sender, obj) =>
            {
                if (((TextInputView)sender).TextInputResult >= 0)
                {
                    ((TextInputView)sender).IsValidationLabelVisible = false;
                    popup.PageClosedTaskCompletionSource.SetResult(((TextInputView)sender).TextInputResult);
                }
                else
                {
                    ((TextInputView)sender).IsValidationLabelVisible = true;
                }
            };

            await PopupNavigation.PushAsync(popup);

            var result = await popup.PageClosedTask;
            await PopupNavigation.PopAsync();

            return(result);
        }
예제 #2
0
        private async Task <Fighter> ExecuteAddFighterMonsterPopup(string Title, List <Monster> mobs)
        {
            var inputView = new AddFighterView(Title, mobs);
            var popup     = new InputAlertDialogBase <Fighter>(inputView);

            inputView.CloseButtonEventHandler +=
                (sender, obj) =>
            {
                if (!string.IsNullOrEmpty(((AddFighterView)sender).FighterResult.Name) && ((AddFighterView)sender).FighterResult.Initiative != 0)
                {
                    ((AddFighterView)sender).IsValidationLabelVisible = false;
                    popup.PageClosedTaskCompletionSource.SetResult(((AddFighterView)sender).FighterResult);
                }
                else
                {
                    ((AddFighterView)sender).IsValidationLabelVisible = true;
                }
            };

            await PopupNavigation.PushAsync(popup);

            var result = await popup.PageClosedTask;
            await PopupNavigation.PopAsync();

            return(result);
        }
예제 #3
0
        public async Task <string> OpenTextInputAlertDialog(string titleText, string placeHolderText,
                                                            string closeButtonText, string validationLabelText)
        {
            // create the TextInputView
            var inputView = new TextInputView(titleText, placeHolderText,
                                              closeButtonText, validationLabelText);

            // create the Transparent Popup Page
            // of type string since we need a string return
            var popup = new InputAlertDialogBase <string>(inputView);

            // subscribe to the TextInputView's Button click event
            inputView.CloseButtonEventHandler +=
                (sender, obj) =>
            {
                if (!string.IsNullOrEmpty(((TextInputView)sender).TextInputResult))
                {
                    ((TextInputView)sender).IsValidationLabelVisible = false;
                    popup.PageClosedTaskCompletionSource.SetResult(((TextInputView)sender).TextInputResult);
                }
                else
                {
                    ((TextInputView)sender).IsValidationLabelVisible = true;
                }
            };

            // return user inserted text value
            return(await Navigate(popup));
        }
예제 #4
0
        public async Task <MyDataModel> OpenMultipleDataInputAlertDialog(string title1Text, string title2Text, string entry1PlaceholderValue,
                                                                         string entry2PlaceholderValue, double sliderMinValue, double sliderMaxValue, string saveButtonText,
                                                                         string cancelButtonText)
        {
            // create the TextInputView
            var inputView = new MultipleDataInputView(title1Text, title2Text, entry1PlaceholderValue,
                                                      entry2PlaceholderValue, sliderMinValue, sliderMaxValue, saveButtonText,
                                                      cancelButtonText);

            // create the Transparent Popup Page
            // of type string since we need a string return
            var popup = new InputAlertDialogBase <MyDataModel>(inputView);

            // subscribe to the TextInputView's Button click event
            inputView.SaveButtonEventHandler +=
                (sender, obj) =>
            {
                // handle validations
                if (string.IsNullOrEmpty(((MultipleDataInputView)sender).MultipleDataResult.FirstName))
                {
                    ((MultipleDataInputView)sender).ValidationLabelText      = "Ops! You need to enter the First name!";
                    ((MultipleDataInputView)sender).IsValidationLabelVisible = true;
                    return;
                }

                if (string.IsNullOrEmpty(((MultipleDataInputView)sender).MultipleDataResult.LastName))
                {
                    ((MultipleDataInputView)sender).ValidationLabelText      = "Ops! You need to enter the Last name!";
                    ((MultipleDataInputView)sender).IsValidationLabelVisible = true;
                    return;
                }

                if (((MultipleDataInputView)sender).MultipleDataResult.Age < 18)
                {
                    ((MultipleDataInputView)sender).ValidationLabelText      = "Ops! You need to be over 18 years of Age!";
                    ((MultipleDataInputView)sender).IsValidationLabelVisible = true;
                    return;
                }

                // if all good then set the Result
                ((MultipleDataInputView)sender).IsValidationLabelVisible = false;
                popup.PageClosedTaskCompletionSource.SetResult(((MultipleDataInputView)sender).MultipleDataResult);
            };

            // subscribe to the TextInputView's Button click event
            inputView.CancelButtonEventHandler +=
                (sender, obj) =>
            {
                popup.PageClosedTaskCompletionSource.SetResult(null);
            };

            // return user inserted text value
            return(await Navigate(popup));
        }
예제 #5
0
        /// <summary>
        /// Handle popup page Navigation
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="popup"></param>
        /// <returns></returns>
        private async Task <T> Navigate <T>(InputAlertDialogBase <T> popup)
        {
            // Push the page to Navigation Stack
            await PopupNavigation.PushAsync(popup);

            // await for the user to enter the text input
            var result = await popup.PageClosedTask;

            // Pop the page from Navigation Stack
            await PopupNavigation.PopAsync();

            return(result);
        }
예제 #6
0
        public async Task <Tuple <string, PopupResultEnum> > OpenCancellableTextInputAlertDialog(string inputText)
        {
            // create the TextInputView
            var inputView = new TextInputCancellableView(
                "Nom de la liste ?", "Nouveau nom...", inputText, "Enregistrer", "Annuler", "Supprimer", "Le nom ne peut pas être vide.");

            // create the Transparent Popup Page
            // of type string since we need a string return
            var popup = new InputAlertDialogBase <Tuple <string, PopupResultEnum> >(inputView);


            // subscribe to the TextInputView's Button click event
            inputView.SaveButtonEventHandler +=
                (sender, obj) =>
            {
                if (!string.IsNullOrEmpty(((TextInputCancellableView)sender).TextInputResult))
                {
                    ((TextInputCancellableView)sender).IsValidationLabelVisible = false;
                    popup.PageClosedTaskCompletionSource.SetResult(new Tuple <string, PopupResultEnum>(((TextInputCancellableView)sender).TextInputResult, PopupResultEnum.Save));
                }
                else
                {
                    ((TextInputCancellableView)sender).IsValidationLabelVisible = true;
                }
            };

            // subscribe to the TextInputView's Button click event
            inputView.CancelButtonEventHandler +=
                (sender, obj) =>
            {
                popup.PageClosedTaskCompletionSource.SetResult(new Tuple <string, PopupResultEnum>(null, PopupResultEnum.Cancel));
            };

            inputView.DeleteButtonEventHandler +=
                (sender, obj) =>
            {
                popup.PageClosedTaskCompletionSource.SetResult(new Tuple <string, PopupResultEnum>(null, PopupResultEnum.Delete));
            };

            // Push the page to Navigation Stack
            await PopupNavigation.Instance.PushAsync(popup, true);

            // await for the user to enter the text input
            var result = await popup.PageClosedTask;

            // Pop the page from Navigation Stack
            await PopupNavigation.Instance.PopAsync();

            // return user inserted text value
            return(result);
        }
예제 #7
0
        private async Task <string> Aanpassen()
        {
            var result = string.Empty;
            // create the TextInputView
            var inputView = new TextInputView(
                "Geef je wachtwoord op", "wachtwoord...", "OK", "Annuleer", "Onjuist wachtwoord!");

            // create the Transparent Popup Page
            // of type string since we need a string return
            var popup = new InputAlertDialogBase <string>(inputView);

            // subscribe to the TextInputView's Button click event
            inputView.SaveButtonEventHandler +=
                (sender, obj) =>
            {
                if (bus.Vergelijken(inputView.TextInputResult) == true)
                {
                    ((TextInputView)sender).IsValidationLabelVisible = false;
                    popup.PageClosedTaskCompletionSource.SetResult(((TextInputView)sender).TextInputResult);
                    lstGebruiker.SelectedItem = (lstGebruiker.ItemsSource as List <Gebruiker>)[0];
                    Navigation.PushAsync(new GegevensAanpassen()
                    {
                        BindingContext = lstGebruiker.SelectedItem as Gebruiker
                    });
                }
                else
                {
                    ((TextInputView)sender).IsValidationLabelVisible = true;
                }
            };
            // subscribe to the TextInputView's Button click event
            inputView.CancelButtonEventHandler +=
                (sender, obj) =>
            {
                popup.PageClosedTaskCompletionSource.SetResult(null);
            };

            // Push the page to Navigation Stack
            await PopupNavigation.PushAsync(popup);

            // await for the user to enter the text input
            result = await popup.PageClosedTask;

            // Pop the page from Navigation Stack
            await PopupNavigation.PopAsync();

            // return user inserted text value
            return(result);
        }
예제 #8
0
        private async Task <PaymentModel> PaymentDialog(int totalBayar)
        {
            //string NmBrg = autoComplete.Text;
            // create the TextInputView
            var inputView = new PaymentInputView("Pembayaran", totalBayar);

            // create the Transparent Popup Page
            // of type string since we need a string return
            var popup = new InputAlertDialogBase <PaymentModel>(inputView);

            // subscribe to the TextInputView's Button click event
            inputView.CloseTrnButtonEventHandler +=
                (sender, obj) =>
            {
                // handle validations
                if (((PaymentInputView)sender).PaymentResult.uangBayar < totalBayar)
                {
                    ((PaymentInputView)sender).ValidationLabelText      = "Uang tidak mencukupi";
                    ((PaymentInputView)sender).IsValidationLabelVisible = true;
                    return;
                }

                // if all good then set the Result
                ((PaymentInputView)sender).IsValidationLabelVisible = false;
                popup.PageClosedTaskCompletionSource.SetResult(((PaymentInputView)sender).PaymentResult);
            };

            // subscribe to the TextInputView's Button click event
            inputView.CancelButtonEventHandler +=
                (sender, obj) =>
            {
                popup.PageClosedTaskCompletionSource.SetResult(null);
            };

            // Push the page to Navigation Stack
            //await PopupNavigation.PushAsync(popup);
            await Navigation.PushAsync(popup);

            // await for the user to enter the text input
            var result = await popup.PageClosedTask;

            // Pop the page from Navigation Stack
            //await PopupNavigation.PopAsync();
            await Navigation.PopAsync();

            // return user inserted text value
            return(result);
        }
예제 #9
0
        private async Task <MyDataModel2> OpenAlertDialogDelAll()
        {
            // create the TextInputView
            var inputView = new AlertConfirmation("PERHATIAN", "Akan Menghapus semua barang dalam keranjang ? \nBarang akan dikembalikan ke Inventory", "Yes", "Cancel");

            // create the Transparent Popup Page
            // of type string since we need a string return
            var popup = new InputAlertDialogBase <MyDataModel2>(inputView);

            // subscribe to the TextInputView's Button click event
            inputView.SaveButtonEventHandler +=
                (sender, obj) =>
            {
                // handle validations
                if (((AlertConfirmation)sender).InputResult.strQty == "2")
                {
                    ((AlertConfirmation)sender).ValidationLabelText      = "QTY tidak boleh 0";
                    ((AlertConfirmation)sender).IsValidationLabelVisible = true;
                    return;
                }

                // if all good then set the Result
                ((AlertConfirmation)sender).IsValidationLabelVisible = false;
                //popup.PageClosedTaskCompletionSource.SetResult(((MultipleDataInputView)sender).MultipleDataResult);
                popup.PageClosedTaskCompletionSource.SetResult(((AlertConfirmation)sender).InputResult);
            };

            // subscribe to the TextInputView's Button click event
            inputView.CancelButtonEventHandler +=
                (sender, obj) =>
            {
                popup.PageClosedTaskCompletionSource.SetResult(null);
            };

            // Push the page to Navigation Stack
            //await PopupNavigation.PushAsync(popup);
            await Navigation.PushAsync(popup);

            // await for the user to enter the text input
            var result = await popup.PageClosedTask;

            // Pop the page from Navigation Stack
            //await PopupNavigation.PopAsync();
            await Navigation.PopAsync();

            // return user inserted text value
            return(result);
        }
        private async Task <double> OpenPercentageSliderInputAlertDialog(WorkOrderParametersView wop)
        {
            // create the TextInputView
            var inputView = new PercentageUpdateSlider(
                "How much would you rate it?", 0, 10,
                "تحديث", "الغاء", "", wop);

            // create the Transparent Popup Page
            // of type string since we need a string return
            var popup = new InputAlertDialogBase <double>(inputView);

            // subscribe to the TextInputView's Button click event
            inputView.SaveButtonEventHandler +=
                (sender, obj) =>
            {
                if (((PercentageUpdateSlider)sender).SliderInputResult > 0)
                {
                    //((PercentageUpdateSlider)sender).IsValidationLabelVisible = false;
                    popup.PageClosedTaskCompletionSource.SetResult(((SlidableInputView)sender).SliderInputResult);
                }
                else
                {
                    //((PercentageUpdateSlider)sender).IsValidationLabelVisible = true;
                }
            };

            // subscribe to the TextInputView's Button click event
            inputView.CancelButtonEventHandler +=
                (sender, obj) =>
            {
                popup.PageClosedTaskCompletionSource.SetResult(0);
            };

            // Push the page to Navigation Stack
            await PopupNavigation.PushAsync(popup);

            // await for the user to enter the text input
            var result = await popup.PageClosedTask;

            // Pop the page from Navigation Stack
            await PopupNavigation.PopAsync();

            // return user inserted text value
            return(result);
        }
        private async Task <string> OpenKMUpdateInputAlertDialog(WorkOrderParametersView wopv)
        {
            // create the TextInputView
            var inputView = new KMUpdateTextInputCancellableView(
                "How's your day mate?", "enter here...", "تحديث", "الغاء", "Ops! Can't leave this empty!", wopv);

            // create the Transparent Popup Page
            // of type string since we need a string return
            var popup = new InputAlertDialogBase <string>(inputView);

            // subscribe to the TextInputView's Button click event
            inputView.SaveButtonEventHandler +=
                (sender, obj) =>
            {
                if (!string.IsNullOrEmpty(((KMUpdateTextInputCancellableView)sender).TextInputResult.ToString()))
                {
                    //((KMUpdateTextInputCancellableView)sender).IsValidationLabelVisible = false;
                    popup.PageClosedTaskCompletionSource.SetResult(((KMUpdateTextInputCancellableView)sender).TextInputResult);
                }
                else
                {
                    //((KMUpdateTextInputCancellableView)sender).IsValidationLabelVisible = true;
                }
            };

            // subscribe to the TextInputView's Button click event
            inputView.CancelButtonEventHandler +=
                (sender, obj) =>
            {
                popup.PageClosedTaskCompletionSource.SetResult(null);
            };

            // Push the page to Navigation Stack
            await PopupNavigation.PushAsync(popup);

            // await for the user to enter the text input
            var result = await popup.PageClosedTask;

            // Pop the page from Navigation Stack
            await PopupNavigation.PopAsync();

            // return user inserted text value
            return(result);
        }
예제 #12
0
        public async Task <string> OpenSelectableInputAlertDialog(string titleText, IList <string> selectiondataSource, string saveButtonText,
                                                                  string cancelButtonText, string validationText)
        {
            // create the TextInputView
            var inputView = new SelectableInputView(
                "How's your day mate?",
                new List <string>()
            {
                "Awesome!", "Great!", "Cool!", "Good!", "Not Bad!", "Meh!"
            },
                "Save", "Cancel", "Ops! You can't leave without a selection!");

            // create the Transparent Popup Page
            // of type string since we need a string return
            var popup = new InputAlertDialogBase <string>(inputView);

            // subscribe to the TextInputView's Button click event
            inputView.SaveButtonEventHandler +=
                (sender, obj) =>
            {
                if (!string.IsNullOrEmpty(((SelectableInputView)sender).SelectionResult))
                {
                    ((SelectableInputView)sender).IsValidationLabelVisible = false;
                    popup.PageClosedTaskCompletionSource.SetResult(((SelectableInputView)sender).SelectionResult);
                }
                else
                {
                    ((SelectableInputView)sender).IsValidationLabelVisible = true;
                }
            };

            // subscribe to the TextInputView's Button click event
            inputView.CancelButtonEventHandler +=
                (sender, obj) =>
            {
                popup.PageClosedTaskCompletionSource.SetResult(null);
            };

            // return user inserted text value
            return(await Navigate(popup));
        }
예제 #13
0
        public async Task <double> OpenSliderInputAlertDialog(string titleText, double minValue, double maxValue, string saveButtonText,
                                                              string cancelButtonText, string validationText)
        {
            // create the TextInputView
            var inputView = new SlidableInputView(
                "How much would you rate it?", 0, 10,
                "Save", "Cancel", "Ops! You can't leave with an empty value!");

            // create the Transparent Popup Page
            // of type string since we need a string return
            var popup = new InputAlertDialogBase <double>(inputView);

            // subscribe to the TextInputView's Button click event
            inputView.SaveButtonEventHandler +=
                (sender, obj) =>
            {
                if (((SlidableInputView)sender).SliderInputResult > 0)
                {
                    ((SlidableInputView)sender).IsValidationLabelVisible = false;
                    popup.PageClosedTaskCompletionSource.SetResult(((SlidableInputView)sender).SliderInputResult);
                }
                else
                {
                    ((SlidableInputView)sender).IsValidationLabelVisible = true;
                }
            };

            // subscribe to the TextInputView's Button click event
            inputView.CancelButtonEventHandler +=
                (sender, obj) =>
            {
                popup.PageClosedTaskCompletionSource.SetResult(0);
            };

            // return user inserted text value
            return(await Navigate(popup));
        }
예제 #14
0
        private async void AnimationView_OnFinish(object sender2, EventArgs e)
        {
            if (finished)
            {
                return;
            }

            finished = true;

            //Thread.Sleep(2000);
            //bool answer = await DisplayAlert("Time is up!", "Would you like to play another game?", "Yes", "No");


            var a      = true;
            var result = 1;

            while (a)
            {
                try
                {
                    var inputView = new Popup3("TIME IS UP!");

                    // create the Transparent Popup Page
                    // of type string since we need a string return
                    var popup = new InputAlertDialogBase <string>(inputView);
                    inputView.CloseButtonEventHandler +=
                        (sender, obj) =>
                    {
                        popup.PageClosedTaskCompletionSource.SetResult("1");
                    };
                    inputView.PlayButtonEventHandler +=
                        (sender, obj) =>
                    {
                        popup.PageClosedTaskCompletionSource.SetResult("0");
                    };
                    inputView.ResultsButtonEventHandler +=
                        (sender, obj) =>
                    {
                        popup.PageClosedTaskCompletionSource.SetResult("2");
                    };

                    // Push the page to Navigation Stack
                    await Navigation.PushPopupAsync(popup);

                    // await for the user to enter the text input
                    result = Convert.ToInt32(await popup.PageClosedTask);

                    // Pop the page from Navigation Stack
                    await Navigation.PopPopupAsync();

                    a = false;
                }
                catch (Exception ex)
                {
                }
            }
            a = true;
            while (a)
            {
                try
                {
                    await finish_fun(result);

                    a = false;
                }
                catch (Exception ex)
                {
                }
            }
        }
예제 #15
0
        private async Task <MyDataModel> OpenMultipleDataInputAlertDialog(List <TblInventory> LstInv, List <InventorySearch> LstDisc)
        {
            //string NmBrg = autoComplete.Text;
            // create the TextInputView
            var inputView = new MultipleDataInputView(LstDisc,
                                                      LstInv[0].NM_BRG, LstInv[0].HRG_JUAL.ToString(), LstInv[0].HRG_MODAL.ToString(),
                                                      LstInv[0].SATUAN, LstInv[0].SATUAN_JUAL.ToString(), LstInv[0].SATUAN_JUAL, LstInv[0].STOK,
                                                      "Add To Cart", "Cancel");

            // create the Transparent Popup Page
            // of type string since we need a string return
            var popup = new InputAlertDialogBase <MyDataModel>(inputView);

            // subscribe to the TextInputView's Button click event
            inputView.SaveButtonEventHandler +=
                (sender, obj) =>
            {
                // handle validations
                if (((MultipleDataInputView)sender).MultipleDataResult.Qty == 0)
                {
                    ((MultipleDataInputView)sender).ValidationLabelText      = "QTY tidak boleh 0";
                    ((MultipleDataInputView)sender).IsValidationLabelVisible = true;
                    return;
                }

                if (LstInv[0].SATUAN == "Gr")
                {
                    if (((MultipleDataInputView)sender).MultipleDataResult.Qty % LstInv[0].SATUAN_JUAL != 0)
                    {
                        ((MultipleDataInputView)sender).ValidationLabelText      = "Pembelian harus / " + LstInv[0].SATUAN_JUAL.ToString() + " Gr";
                        ((MultipleDataInputView)sender).IsValidationLabelVisible = true;
                        return;
                    }

                    if (((MultipleDataInputView)sender).MultipleDataResult.Qty < 10)
                    {
                        ((MultipleDataInputView)sender).ValidationLabelText      = "Minimum pembelian 10 Gr";
                        ((MultipleDataInputView)sender).IsValidationLabelVisible = true;
                        return;
                    }
                }


                // if all good then set the Result
                ((MultipleDataInputView)sender).IsValidationLabelVisible = false;
                popup.PageClosedTaskCompletionSource.SetResult(((MultipleDataInputView)sender).MultipleDataResult);
            };

            // subscribe to the TextInputView's Button click event
            inputView.CancelButtonEventHandler +=
                (sender, obj) =>
            {
                popup.PageClosedTaskCompletionSource.SetResult(null);
            };

            // Push the page to Navigation Stack
            //await PopupNavigation.PushAsync(popup);
            await Navigation.PushPopupAsync(popup);

            // await for the user to enter the text input
            var result = await popup.PageClosedTask;

            // Pop the page from Navigation Stack
            //await PopupNavigation.PopAsync();
            await Navigation.PopAsync();

            // return user inserted text value
            return(result);
        }