Exemplo n.º 1
0
        public static async Task <string> DisplayEntry(InputPopupResult result, string placeHolder, string title = "", int offset = -1, bool autoPaste = true, string setText = null, string confirmText = "", int min = int.MinValue, int max = int.MaxValue)
        {
            var page = new InputPopupPage(result, placeHolder, title, offset, autoPaste, setText, confirmText, min, max);
            await PopupNavigation.Instance.PushAsync(page);

            return(await page.WaitForResult());
        }
Exemplo n.º 2
0
        public static void CheckEntry(Entry entry, InputPopupResult inputType, bool autoPaste = false, string setText = null, bool setWidth = true, bool setFontSize = true)
        {
            entry.ReturnType = ReturnType.Done;
            bool _isNumber = (inputType == InputPopupResult.decimalNumber || inputType == InputPopupResult.integrerNumber);

            // FORCE CORRENT TYPE
            entry.TextChanged += (o, e) => {
                if (inputType == InputPopupResult.integrerNumber || inputType == InputPopupResult.decimalNumber)
                {
                    if (e.NewTextValue.Contains("-") && !e.NewTextValue.StartsWith("-"))
                    {
                        entry.Text = e.OldTextValue;
                    }
                }

                if (inputType == InputPopupResult.integrerNumber)
                {
                    entry.Text = Regex.Replace(e.NewTextValue, "[^0-9-]", "");
                }
                else if (inputType == InputPopupResult.decimalNumber)
                {
                    entry.Text = Regex.Replace(e.NewTextValue, "[^0-9.,-]", "");
                    if (e.OldTextValue.IsClean())
                    {
                        if (e.OldTextValue.Contains(",") || e.OldTextValue.Contains("."))   // REMOVE DUPLICATES
                        {
                            if (e.NewTextValue.EndsWith(",") || e.NewTextValue.EndsWith("."))
                            {
                                entry.Text = entry.Text[0..^ 1];
                            }