Exemplo n.º 1
0
        private async void Initialization()
        {
            try
            {
                await this._model.GetCountryList();

                if (_user?.UserMetas?.Count > 0)
                {
                    _model.CountryName = _user.UserMetas.ToList().Get(MetaEnum.country);
                    _model.Address     = _user.UserMetas.ToList().Get(MetaEnum.address);
                    _model.CityName    = _user.UserMetas.ToList().Get(MetaEnum.city);
                    _model.PostalCode  = _user.UserMetas.ToList().Get(MetaEnum.postalcode);
                    if (!string.IsNullOrEmpty(_model.CountryName))
                    {
                        _model.GetStateList(_model.CountryName);
                    }
                    _model.StateName = _user.UserMetas.ToList().Get(MetaEnum.state);
                }

                pickerCountry.Focused += (sender, e) =>
                {
                    if (pickerCountry.ItemsSource == null || pickerCountry.ItemsSource.Count == 0)
                    {
                        pickerCountry.Unfocus();
                        _model.SetActivityResource(showError: true, errorMessage: TextResources.NoRecordToProcess);
                    }
                };
                pickerCountry.SelectedIndexChanged += (sender1, e1) =>
                {
                    var countrySelected = pickerCountry.SelectedItem;
                    if (countrySelected != null)
                    {
                        _model.CountryName = countrySelected.ToString();
                        _model.GetStateList(_model.CountryName);
                        entryAddress.Focus();
                    }
                };
                StateSetup();
                buttonNext.Clicked += async(sender, e) => { await NextStepAsync(); };
            }
            catch
            {
                //
            }
        }
Exemplo n.º 2
0
        private async void Initialization()
        {
            try
            {
                await _model.GetCountryList();

                if (_user.UserMetas != null && _user.UserMetas.Count > 0)
                {
                    _model.CountryName = _user.UserMetas.ToList().Get(MetaEnum.country);
                    _model.Address     = _user.UserMetas.ToList().Get(MetaEnum.address);
                    _model.CityName    = _user.UserMetas.ToList().Get(MetaEnum.city);
                    _model.PostalCode  = _user.UserMetas.ToList().Get(MetaEnum.postalcode);
                    if (_model.CountryName != null && _model.CountryName.Trim().Length > 0)
                    {
                        _model.GetStateList(_model.CountryName);
                    }
                    _model.StateName = _user.UserMetas.ToList().Get(MetaEnum.state);
                }

                pickerCountry.ItemsSource = _model.CountryList;
                entryCountry.Focused     += (sender, e) =>
                {
                    entryCountry.Unfocus();
                    pickerCountry.Focus();

                    pickerCountry.SelectedIndexChanged += (sender1, e1) =>
                    {
                        var countrySelected = pickerCountry.SelectedItem;
                        if (countrySelected != null)
                        {
                            _model.CountryName = countrySelected.ToString();
                            _model.GetStateList(_model.CountryName);
                            entryAddress.Focus();
                        }
                    };
                };
                StateSetup();
                buttonNext.Clicked += async(sender, e) => { await NextStepAsync(); };
            }
            catch
            {
                //
            }
        }