Esempio n. 1
0
        private async void yearsofexperience_TextChanged(object sender, TextChangedEventArgs e)
        {
            string _text = yearsofexperience.Text;

            if (string.IsNullOrEmpty(_text))
            {
                return;
            }

            if (_text.Length > 2)
            {
                _text = _text.Remove(_text.Length - 1); // Remove Last character
                yearsofexperience.Text = _text;         //Set the Old value
                //RegisterViewModel.RBM.yearsOfExperience = Convert.ToInt32(_text);
            }

            string lastChar = _text.Substring(_text.Length - 1, 1);
            int    number   = 0;
            var    x        = int.TryParse(lastChar, out number);

            //if (number == 0)
            //{
            //    _text = _text.Remove(_text.Length - 1);  // Remove Last character
            //    yearsofexperience.Text = _text;        //Set the Old value
            //    //RegisterViewModel.RBM.yearsOfExperience = Convert.ToInt32(_text);
            //}
            if (x == false)
            {
                _text = _text.Remove(_text.Length - 1); // Remove Last character
                yearsofexperience.Text = _text;         //Set the Old value
            }
            string years = ValidateYears.Validate(yearsofexperience.Text);

            if (string.IsNullOrEmpty(years) == false)
            {
                RegisterViewModel.RBM.yearsOfExperience = int.Parse(years);
            }
            else
            {
                RegisterViewModel.RBM.yearsOfExperience = 0;
            }
        }
Esempio n. 2
0
        public async void Handle_TextChanged(object sender, Xamarin.Forms.TextChangedEventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(yearsofexperience.Text))
                {
                    string _text = yearsofexperience.Text;
                    if (string.IsNullOrEmpty(_text))
                    {
                        return;
                    }

                    if (_text.Length > 2)
                    {
                        _text = _text.Remove(_text.Length - 1); // Remove Last character
                        yearsofexperience.Text = _text;         //Set the Old value
                    }

                    string lastChar = _text.Substring(_text.Length - 1, 1);
                    int    number   = 0;
                    var    x        = int.TryParse(lastChar, out number);
                    //if (number == 0)
                    //{
                    //    _text = _text.Remove(_text.Length - 1);  // Remove Last character
                    //    yearsofexperience.Text = _text;        //Set the Old value
                    //}
                    if (x == false)
                    {
                        _text = _text.Remove(_text.Length - 1); // Remove Last character
                        yearsofexperience.Text = _text;         //Set the Old value
                    }

                    string years = ValidateYears.Validate(yearsofexperience.Text);

                    if (string.IsNullOrEmpty(years) == false)
                    {
                        RegisterViewModel.RBM.yearsOfExperience = int.Parse(years);
                    }
                    else
                    {
                        RegisterViewModel.RBM.yearsOfExperience = 0;
                    }
                }
                else
                {
                    return;
                }


                if (Xamarin.Forms.Device.Idiom == TargetIdiom.Phone)
                {
                    this.BackgroundImage = "background_2";
                }
                else if (Xamarin.Forms.Device.Idiom == TargetIdiom.Tablet)
                {
                    this.BackgroundImage = "background_Tablet";
                }

                EditProfile.BackgroundColor = new Color(255, 255, 255, 0.6);
            }
            catch (Exception ex)
            {
                var logged = new LoggedException.LoggedException("Error in Bankaccount.xaml.cs", ex);
                await logged.LoggAPI();
            }
        }