コード例 #1
0
        private void GenderAdapterOnItemClick(object sender, GendersAdapterClickEventArgs e)
        {
            try
            {
                var position = e.Position;
                if (position >= 0)
                {
                    var item = GenderAdapter.GetItem(position);
                    if (item != null)
                    {
                        var check = GenderAdapter.GenderList.Where(a => a.GenderSelect).ToList();
                        if (check.Count > 0)
                        {
                            foreach (var all in check)
                            {
                                all.GenderSelect = false;
                            }
                        }

                        item.GenderSelect = true;
                        GenderAdapter.NotifyDataSetChanged();

                        Gender = item.GenderId;
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
コード例 #2
0
        private void GenderAdapterOnItemClick(object sender, GendersAdapterClickEventArgs e)
        {
            try
            {
                var position = e.Position;
                switch (position)
                {
                case >= 0:
                {
                    var item = GenderAdapter.GetItem(position);
                    if (item != null)
                    {
                        var check = GenderAdapter.GenderList.Where(a => a.GenderSelect).ToList();
                        switch (check.Count)
                        {
                        case > 0:
                        {
                            foreach (var all in check)
                            {
                                all.GenderSelect = false;
                            }
                            break;
                        }
                        }

                        item.GenderSelect = true;
                        GenderAdapter.NotifyDataSetChanged();

                        Gender = item.GenderId;
                    }

                    break;
                }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
コード例 #3
0
        private void SetRecyclerViewAdapters()
        {
            try
            {
                GenderRecycler.HasFixedSize = true;
                GenderRecycler.SetLayoutManager(new LinearLayoutManager(Activity, LinearLayoutManager.Horizontal, false));
                GenderAdapter = new GendersAdapter(Activity)
                {
                    GenderList = new ObservableCollection <Classes.Gender>()
                };
                GenderRecycler.SetAdapter(GenderAdapter);
                GenderRecycler.NestedScrollingEnabled = false;
                GenderAdapter.NotifyDataSetChanged();
                GenderRecycler.Visibility = ViewStates.Visible;
                GenderAdapter.ItemClick  += GenderAdapterOnItemClick;

                GenderAdapter.GenderList.Add(new Classes.Gender
                {
                    GenderId     = "all",
                    GenderName   = Activity.GetText(Resource.String.Lbl_All),
                    GenderColor  = AppSettings.MainColor,
                    GenderSelect = false
                });

                if (ListUtils.SettingsSiteList?.Genders?.Count > 0)
                {
                    foreach (var(key, value) in ListUtils.SettingsSiteList?.Genders)
                    {
                        GenderAdapter.GenderList.Add(new Classes.Gender
                        {
                            GenderId     = key,
                            GenderName   = value,
                            GenderColor  = AppSettings.SetTabDarkTheme ? "#ffffff" : "#444444",
                            GenderSelect = false
                        });
                    }
                }
                else
                {
                    GenderAdapter.GenderList.Add(new Classes.Gender
                    {
                        GenderId     = "male",
                        GenderName   = Activity.GetText(Resource.String.Radio_Male),
                        GenderColor  = AppSettings.SetTabDarkTheme ? "#ffffff" : "#444444",
                        GenderSelect = false
                    });
                    GenderAdapter.GenderList.Add(new Classes.Gender
                    {
                        GenderId     = "female",
                        GenderName   = Activity.GetText(Resource.String.Radio_Female),
                        GenderColor  = AppSettings.SetTabDarkTheme ? "#ffffff" : "#444444",
                        GenderSelect = false
                    });
                }

                GenderAdapter.NotifyDataSetChanged();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }