Пример #1
0
        private void DecideAction(MotionEvent e1)
        {
            var screenWidth = _info.DeviceWidth;

            _action = e1.GetX() > screenWidth - (screenWidth / 100 * 10) ? TouchEnum.Scroll : TouchEnum.Single;
        }
        private void SetField(string fieldName, string value)
        {
            if (!skipCheckIfLoadedFromDb) // import from external
            {
                switch (fieldName.ToUpper())
                {
                case ZOemExtIdName:
                    if (!string.IsNullOrEmpty(value) &&
                        !System.Text.RegularExpressions.Regex.IsMatch(value, NumbericRegEx))
                    {
                        throw new ApplicationException("OEM Extended Identifier value required numeric characters.");
                    }
                    break;

                case ZFrmFactorCl1Name:
                    if (!string.IsNullOrEmpty(value))
                    {
                        FormFactorL1Enum outzFrmFactorCl1;
                        bool             isValidFrmFactorCl1 = Enum.TryParse <FormFactorL1Enum>(value, true, out outzFrmFactorCl1);
                        if (!isValidFrmFactorCl1)
                        {
                            throw new ApplicationException(string.Format("{0} is not valid format.", ZFrmFactorCl1Name));
                        }

                        value = outzFrmFactorCl1.ToString();
                    }
                    break;

                case ZFrmFactorCl2Name:
                    if (!string.IsNullOrEmpty(value))
                    {
                        FormFactorL2Enum outzFrmFactorCl2;
                        bool             isValidFrmFactorCl2 = Enum.TryParse <FormFactorL2Enum>(value, true, out outzFrmFactorCl2);
                        if (!isValidFrmFactorCl2)
                        {
                            throw new ApplicationException(string.Format("{0} is not valid format.", ZFrmFactorCl2Name));
                        }

                        value = outzFrmFactorCl2.ToString();
                    }
                    break;

                case ZTouchScreenName:
                    if (!string.IsNullOrEmpty(value))
                    {
                        TouchEnum outTouchEnum = ConvertTouchEnum(value);
                        value = outTouchEnum.ToString();
                    }
                    break;

                case ZScreenSizeName:
                    if (!string.IsNullOrEmpty(value))
                    {
                        Decimal zScreenSizeOut;
                        bool    isValidDecimal = Decimal.TryParse(value, out zScreenSizeOut);
                        if (!isValidDecimal)
                        {
                            throw new ApplicationException(string.Format("{0} is not valid decimal format.", ZScreenSizeName));
                        }
                    }
                    break;
                }
            }

            if (Values.ContainsKey(fieldName))
            {
                Values[fieldName] = value;
            }
            else
            {
                Values.Add(fieldName, value);
            }
        }