public void Selected(SurveyAsk model)
        {
            var _model = _DataSource.Where(o => o.Code == model.Code).FirstOrDefault();

            if (_model is null)
            {
                return;
            }
            if (_model.TypeField == TYPE_FIELD.TEXTFIELD)
            {
                return;
            }
            _model.Selected = !_model.Selected;

            int index = _DataSource.IndexOf(_model);

            if (index < 0)
            {
                return;
            }

            _DataSource[index] = _model;
            //_DataSource.Insert(index, _model);
        }
        public async Task ReloadData()
        {
            _DataSource.Clear();
            HideAll();
            ICPFeeds Service  = DependencyService.Get <ICPFeeds>();
            var      response = await Service.m_GetCOVIDSurvey();

            if (response.Count() > 0)
            {
                foreach (SurveyAsk item in response)
                {
                    item.TypeField = TYPE_FIELD.CHECKBOX;
                    _DataSource.Add(item: item);
                }

                String phoneValue = "";
                if (!string.IsNullOrEmpty(Settings.sUserNameLogin))
                {
                    List <string> split_login = Settings.sUserNameLogin
                                                .Split("_")
                                                .ToList();

                    if (split_login.Count() > 1)
                    {
                        phoneValue = split_login[1];
                    }
                }

                _DataSource.Add(SurveyAsk.BuildTextField("telefono", phoneValue, "Teléfono", true));
                _DataSource.Add(SurveyAsk.BuildTextField("cp", "", "Código postal", true));

                ShowDataButton();
                return;
            }
            ShowDataError();
        }
Exemplo n.º 3
0
        public void OnItemTapped(object sender, ItemTappedEventArgs e)
        {
            SurveyAsk model = e.Item as SurveyAsk;

            GetContext.Selected(model);
        }
Exemplo n.º 4
0
        public void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            SurveyAsk model = e.SelectedItem as SurveyAsk;

            GetContext.Selected(model);
        }