Example #1
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //Static Methods

        public static decimal RequestDecimalValue(Window pSourceWindow, decimal pDefaultValue, bool pUseDefaultValue = true)
        {
            decimal result;
            String  regexDecimalGreaterThanZero = SettingsApp.RegexDecimalGreaterThanZero;
            String  defaultValue = (pUseDefaultValue) ? FrameworkUtils.DecimalToString(pDefaultValue) : string.Empty;

            PosKeyboardDialog dialog = new PosKeyboardDialog(pSourceWindow, DialogFlags.DestroyWithParent, KeyboardMode.Numeric, defaultValue, regexDecimalGreaterThanZero);
            int response             = dialog.Run();

            if (response == (int)ResponseType.Ok)
            {
                result = decimal.Parse(dialog.Text, GlobalFramework.CurrentCultureNumberFormat);
            }
            else
            {
                result = response;
            }
            dialog.Destroy();

            return(result);
        }
Example #2
0
        public static string RequestAlfaNumericValue(Window pSourceWindow, KeyboardMode pKeyboardMode, string pDefaultValue, bool pUseDefaultValue = true)
        {
            string result;
            String regexAlfaNumeric = SettingsApp.RegexAlfaNumeric;
            String defaultValue     = (pUseDefaultValue) ? pDefaultValue : string.Empty;

            PosKeyboardDialog dialog = new PosKeyboardDialog(pSourceWindow, DialogFlags.DestroyWithParent, pKeyboardMode, defaultValue, regexAlfaNumeric);
            int response             = dialog.Run();

            if (response == (int)ResponseType.Ok)
            {
                result = dialog.Text;
            }
            else
            {
                result = string.Empty;
            }
            dialog.Destroy();

            return(result);
        }