예제 #1
0
        //Select Status >> Offline (0)
        private void ButtonOfflineOnClick(object sender, EventArgs e)
        {
            try
            {
                //follow_button_profile_friends >> Un click
                //follow_button_profile_friends_pressed >> click
                ButtonOffline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                ButtonOffline.SetTextColor(Color.ParseColor("#ffffff"));

                BothStatusButton.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                BothStatusButton.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                ButtonOnline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                ButtonOnline.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                Status = 0;
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        private void GetFilter()
        {
            try
            {
                var dbDatabase = new SqLiteDatabase();

                var data = dbDatabase.GetNearByFilterById();
                if (data != null)
                {
                    Gender         = data.Gender;
                    DistanceCount  = data.DistanceValue;
                    Status         = data.Status;
                    RelationshipId = data.Relationship;

                    //////////////////////////// Gender //////////////////////////////
                    Gender = data.Gender;

                    var check1 = GenderAdapter.GenderList.Where(a => a.GenderSelect).ToList();
                    if (check1.Count > 0)
                    {
                        foreach (var all in check1)
                        {
                            all.GenderSelect = false;
                        }
                    }

                    var check2 = GenderAdapter.GenderList.FirstOrDefault(a => a.GenderId == data.Gender);
                    if (check2 != null)
                    {
                        check2.GenderSelect = true;
                        Gender = check2.GenderId;
                    }

                    GenderAdapter.NotifyDataSetChanged();

                    TxtDistanceCount.Text = DistanceCount + " " + GetText(Resource.String.Lbl_km);

                    if (Build.VERSION.SdkInt >= BuildVersionCodes.N)
                    {
                        DistanceBar.SetProgress(DistanceCount == 0 ? 300 : DistanceCount, true);
                    }
                    else  // For API < 24
                    {
                        DistanceBar.Progress = DistanceCount == 0 ? 300 : DistanceCount;
                    }

                    //////////////////////////// Status //////////////////////////////
                    //Select Status >> Both (2)
                    //Select Status >> Online (1)
                    //Select Status >> Offline (0)

                    switch (data.Status)
                    {
                    case 0:
                        ButtonOffline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        ButtonOffline.SetTextColor(Color.ParseColor("#ffffff"));

                        BothStatusButton.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        BothStatusButton.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                        ButtonOnline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        ButtonOnline.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                        Status = 0;
                        break;

                    case 1:
                        ButtonOnline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        ButtonOnline.SetTextColor(Color.ParseColor("#ffffff"));

                        BothStatusButton.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        BothStatusButton.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                        ButtonOffline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        ButtonOffline.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                        Status = 1;
                        break;

                    case 2:
                        BothStatusButton.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        BothStatusButton.SetTextColor(Color.ParseColor("#ffffff"));

                        ButtonOnline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        ButtonOnline.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                        ButtonOffline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        ButtonOffline.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                        Status = 2;
                        break;
                    }

                    switch (RelationshipId)
                    {
                    case "1":
                        TxtRelationship.Text = GetText(Resource.String.Lbl_Single);
                        break;

                    case "2":
                        TxtRelationship.Text = GetText(Resource.String.Lbl_InRelationship);
                        break;

                    case "3":
                        TxtRelationship.Text = GetText(Resource.String.Lbl_Married);
                        break;

                    case "4":
                        TxtRelationship.Text = GetText(Resource.String.Lbl_Engaged);
                        break;

                    case "5":
                        TxtRelationship.Text = GetText(Resource.String.Lbl_All);
                        break;

                    default:
                        TxtRelationship.Text = GetText(Resource.String.Lbl_All);
                        break;
                    }
                }
                else
                {
                    var newSettingsFilter = new DataTables.NearByFilterTb
                    {
                        DistanceValue = 0,
                        Gender        = "all",
                        Status        = 2,
                        Relationship  = "5",
                    };
                    dbDatabase.InsertOrUpdate_NearByFilter(newSettingsFilter);

                    Gender         = "all";
                    DistanceCount  = 0;
                    Status         = 2;
                    RelationshipId = "5";

                    //////////////////////////// Gender //////////////////////////////

                    var check1 = GenderAdapter.GenderList.Where(a => a.GenderSelect).ToList();
                    if (check1.Count > 0)
                    {
                        foreach (var all in check1)
                        {
                            all.GenderSelect = false;
                        }
                    }

                    var check2 = GenderAdapter.GenderList.FirstOrDefault(a => a.GenderId == "all");
                    if (check2 != null)
                    {
                        check2.GenderSelect = true;
                        Gender = check2.GenderId;

                        GenderAdapter.NotifyDataSetChanged();
                    }

                    //////////////////////////// Status //////////////////////////////
                    BothStatusButton.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                    BothStatusButton.SetTextColor(Color.ParseColor("#ffffff"));

                    ButtonOnline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                    ButtonOnline.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                    ButtonOffline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                    ButtonOffline.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                    if (Build.VERSION.SdkInt >= BuildVersionCodes.N)
                    {
                        DistanceBar.SetProgress(300, true);
                    }
                    else  // For API < 24
                    {
                        DistanceBar.Progress = 300;
                    }

                    TxtDistanceCount.Text = DistanceCount + " " + GetText(Resource.String.Lbl_km);

                    switch (RelationshipId)
                    {
                    case "5":
                        TxtRelationship.Text = GetText(Resource.String.Lbl_All);
                        break;

                    case "1":
                        TxtRelationship.Text = GetText(Resource.String.Lbl_Single);
                        break;

                    case "2":
                        TxtRelationship.Text = GetText(Resource.String.Lbl_InRelationship);
                        break;

                    case "3":
                        TxtRelationship.Text = GetText(Resource.String.Lbl_Married);
                        break;

                    case "4":
                        TxtRelationship.Text = GetText(Resource.String.Lbl_Engaged);
                        break;

                    default:
                        TxtRelationship.Text = GetText(Resource.String.Lbl_All);
                        break;
                    }
                }

                dbDatabase.Dispose();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        //Reset Value
        private void ResetTextViewOnClick(object sender, EventArgs e)
        {
            try
            {
                var dbDatabase        = new SqLiteDatabase();
                var newSettingsFilter = new DataTables.NearByFilterTb
                {
                    DistanceValue = 0,
                    Gender        = "all",
                    Status        = 2,
                    Relationship  = "5",
                };
                dbDatabase.InsertOrUpdate_NearByFilter(newSettingsFilter);
                dbDatabase.Dispose();

                Gender         = "all";
                DistanceCount  = 0;
                Status         = 2;
                RelationshipId = "5";

                UserDetails.NearByGender        = Gender;
                UserDetails.NearByDistanceCount = DistanceCount.ToString();
                UserDetails.NearByStatus        = Status.ToString();
                UserDetails.NearByRelationship  = RelationshipId;

                //////////////////////////// Gender //////////////////////////////

                var check1 = GenderAdapter.GenderList.Where(a => a.GenderSelect).ToList();
                if (check1.Count > 0)
                {
                    foreach (var all in check1)
                    {
                        all.GenderSelect = false;
                    }
                }

                var check2 = GenderAdapter.GenderList.FirstOrDefault(a => a.GenderId == "all");
                if (check2 != null)
                {
                    check2.GenderSelect = true;
                    Gender = check2.GenderId;

                    GenderAdapter.NotifyDataSetChanged();
                }
                //////////////////////////// Status //////////////////////////////
                BothStatusButton.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                BothStatusButton.SetTextColor(Color.ParseColor("#ffffff"));

                ButtonOnline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                ButtonOnline.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                ButtonOffline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                ButtonOffline.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                if (Build.VERSION.SdkInt >= BuildVersionCodes.N)
                {
                    DistanceBar.SetProgress(300, true);
                }
                else  // For API < 24
                {
                    DistanceBar.Progress = 300;
                }

                TxtDistanceCount.Text = DistanceCount + " " + GetText(Resource.String.Lbl_km);

                switch (RelationshipId)
                {
                case "5":
                    TxtRelationship.Text = GetText(Resource.String.Lbl_All);
                    break;

                case "1":
                    TxtRelationship.Text = GetText(Resource.String.Lbl_Single);
                    break;

                case "2":
                    TxtRelationship.Text = GetText(Resource.String.Lbl_InRelationship);
                    break;

                case "3":
                    TxtRelationship.Text = GetText(Resource.String.Lbl_Married);
                    break;

                case "4":
                    TxtRelationship.Text = GetText(Resource.String.Lbl_Engaged);
                    break;

                default:
                    TxtRelationship.Text = GetText(Resource.String.Lbl_All);
                    break;
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        private void GetFilter()
        {
            try
            {
                var dbDatabase = new SqLiteDatabase();

                var data = dbDatabase.GetFilterLastChatById();
                if (data != null)
                {
                    Status = data.Status;
                    Type   = data.Type;

                    TxtTypeChat.Text = Type;

                    //////////////////////////// Status //////////////////////////////
                    //Select Status >> Both (both)
                    //Select Status >> Online (on)
                    //Select Status >> Offline (off)

                    switch (data.Status)
                    {
                    case "offline":
                        ButtonOffline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        ButtonOffline.SetTextColor(Color.ParseColor("#ffffff"));

                        BothStatusButton.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        BothStatusButton.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                        ButtonOnline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        ButtonOnline.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                        Status = "offline";
                        break;

                    case "online":
                        ButtonOnline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        ButtonOnline.SetTextColor(Color.ParseColor("#ffffff"));

                        BothStatusButton.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        BothStatusButton.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                        ButtonOffline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        ButtonOffline.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                        Status = "online";
                        break;

                    case "both":
                        BothStatusButton.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        BothStatusButton.SetTextColor(Color.ParseColor("#ffffff"));

                        ButtonOnline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        ButtonOnline.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                        ButtonOffline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        ButtonOffline.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                        Status = "both";
                        break;
                    }
                }
                else
                {
                    var newSettingsFilter = new DataTables.FilterLastChatTb
                    {
                        Status = "both",
                        Type   = "all",
                    };
                    dbDatabase.InsertOrUpdate_FilterLastChat(newSettingsFilter);

                    Status = "both";
                    Type   = "all";

                    TxtTypeChat.Text = Context.GetString(Resource.String.Lbl_All);

                    //////////////////////////// Status //////////////////////////////
                    BothStatusButton.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                    BothStatusButton.SetTextColor(Color.ParseColor("#ffffff"));

                    ButtonOnline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                    ButtonOnline.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));

                    ButtonOffline.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                    ButtonOffline.SetTextColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#ffffff") : Color.ParseColor("#444444"));
                }

                dbDatabase.Dispose();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }