コード例 #1
0
        //Get Data My Profile API
        public async void Get_MyProfileData_Api()
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_Error_check_internet_connection),
                                   ToastLength.Short).Show();
                }
                else
                {
                    var(Api_status, Respond) = await Global.Get_User_Data(S_UserId);

                    if (Api_status == 200)
                    {
                        if (Respond is GetUserDataObject result)
                        {
                            var dbDatabase = new SqLiteDatabase();

                            //Add Data User
                            //=======================================
                            // user_data
                            if (result.user_data != null)
                            {
                                LoadDataUser(result.user_data);

                                dbDatabase.Insert_Or_Update_To_MyProfileTable(result.user_data);
                            }

                            dbDatabase.Dispose();
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is ErrorObject error)
                        {
                            var errortext = error._errors.Error_text;


                            if (errortext.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(this);
                            }
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                Get_MyProfileData_Api();
            }
        }
コード例 #2
0
        //About me
        private async void AboutMePref_OnPreferenceChange(object sender,
                                                          Preference.PreferenceChangeEventArgs preferenceChangeEventArgs)
        {
            try
            {
                var etp   = (EditTextPreference)sender;
                var value = etp.EditText.Text;
                etp.Summary = value;

                var datauser = Classes.MyProfileList.FirstOrDefault(a => a.user_id == UserDetails.User_id);
                if (datauser != null)
                {
                    datauser.about = etp.EditText.Text;
                    S_About        = etp.EditText.Text;
                }

                if (IMethods.CheckConnectivity())
                {
                    var dictionary_profile = new Dictionary <string, string>
                    {
                        { "about", S_About }
                    };
                    Settings st = new Settings();
                    var(Api_status, Respond) = await Client.Global.Update_User_Data(st, dictionary_profile);

                    if (Api_status == 200)
                    {
                        if (Respond is Update_User_Data_Object result)
                        {
                            if (result.message.Contains("updated"))
                            {
                                Toast.MakeText(ActivityContext, result.message, ToastLength.Short).Show();
                                AndHUD.Shared.Dismiss(ActivityContext);
                            }
                            else
                            {
                                //Show a Error image with a message
                                AndHUD.Shared.ShowError(ActivityContext, result.message, MaskType.Clear,
                                                        TimeSpan.FromSeconds(2));
                            }
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is Error_Object error)
                        {
                            var errortext = error._errors.Error_text;
                            Toast.MakeText(ActivityContext, errortext, ToastLength.Short).Show();

                            if (errortext.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(Activity);
                            }
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();
                        Toast.MakeText(ActivityContext, error, ToastLength.Short).Show();
                    }
                }
                else
                {
                    Toast.MakeText(ActivityContext,
                                   ActivityContext.GetString(Resource.String.Lbl_CheckYourInternetConnection),
                                   ToastLength.Short)
                    .Show();
                }
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
コード例 #3
0
        public async void GetCategories_API()
        {
            try
            {
                if (IMethods.CheckConnectivity())
                {
                    var(Api_status, Respond) = await Client.Global.Get_Categories(new Settings());

                    if (Api_status == 200)
                    {
                        if (Respond is Categories_Object result)
                        {
                            if (result.Config.PageCategories.Count > 0)
                            {
                                ListCatigories_Names.Clear();

                                foreach (var pageCategory in result.Config.PageCategories)
                                {
                                    var id   = pageCategory.Key;
                                    var name = pageCategory.Value;
                                    Classes.Catigories cat = new Classes.Catigories
                                    {
                                        Catigories_Id = id, Catigories_Name = name, Catigories_Color = "#212121"
                                    };

                                    var select = ListCatigories_Names.FirstOrDefault(a => a.Catigories_Id == id);
                                    if (select == null)
                                    {
                                        ListCatigories_Names.Add(cat);
                                    }
                                }
                            }

                            var list = ListCatigories_Names.Select(cat => new DataTables.CatigoriesTB
                            {
                                Catigories_Id   = cat.Catigories_Id,
                                Catigories_Name = cat.Catigories_Name,
                            }).ToList();

                            SqLiteDatabase sqLiteDatabase = new SqLiteDatabase();
                            //Insert Categories in Database
                            sqLiteDatabase.Insert_Categories(new ObservableCollection <DataTables.CatigoriesTB>(list));
                            sqLiteDatabase.Dispose();
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is Error_Object error)
                        {
                            var errortext = error._errors.Error_text;


                            //if (errortext.Contains("Invalid or expired access_token"))
                            //    API_Request.Logout(this);
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();
                        //Show a Error
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #4
0
        //Api
        public async void Get_PostData_API()
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)
                    .Show();
                    DataPost_Recycler.Visibility = ViewStates.Visible;
                    DataPost_Empty.Visibility    = ViewStates.Gone;
                }
                else
                {
                    if (TypePost == "post_likes")
                    {
                        var(Api_status, Respond) = await Client.Global.Get_Post_Data(IdPost, "post_liked_users");

                        if (Api_status == 200)
                        {
                            if (Respond is Get_Post_Data_Object result)
                            {
                                if (result.post_liked_users.Length > 0)
                                {
                                    DataPost_Recycler.SetAdapter(LikedUsersAdapter);

                                    LikedUsersAdapter.mPostlikedList =
                                        new ObservableCollection <Get_Post_Data_Object.PostLikedUsers>(
                                            result.post_liked_users);
                                    LikedUsersAdapter.BindEnd();
                                }
                            }
                        }
                        else if (Api_status == 400)
                        {
                            if (Respond is Error_Object error)
                            {
                                var errortext = error._errors.Error_text;
                                //Toast.MakeText(this, errortext, ToastLength.Short).Show();

                                if (errortext.Contains("Invalid or expired access_token"))
                                {
                                    API_Request.Logout(this);
                                }
                            }
                        }
                        else if (Api_status == 404)
                        {
                            var error = Respond.ToString();
                            //Toast.MakeText(this, error, ToastLength.Short).Show();
                        }
                    }
                    else if (TypePost == "post_wonders")
                    {
                        var(Api_status, Respond) = await Client.Global.Get_Post_Data(IdPost, "post_wondered_users");

                        if (Api_status == 200)
                        {
                            if (Respond is Get_Post_Data_Object result)
                            {
                                if (result.post_wondered_users.Length > 0)
                                {
                                    DataPost_Recycler.SetAdapter(WonderedAdapter);

                                    WonderedAdapter.mPostWonderedList =
                                        new ObservableCollection <Get_Post_Data_Object.PostWonderedUsers>(
                                            result.post_wondered_users);
                                    WonderedAdapter.BindEnd();
                                }
                            }
                        }
                        else if (Api_status == 400)
                        {
                            if (Respond is Error_Object error)
                            {
                                var errortext = error._errors.Error_text;
                                //Toast.MakeText(this, errortext, ToastLength.Short).Show();

                                if (errortext.Contains("Invalid or expired access_token"))
                                {
                                    API_Request.Logout(this);
                                }
                            }
                        }
                        else if (Api_status == 404)
                        {
                            var error = Respond.ToString();
                            //Toast.MakeText(this, error, ToastLength.Short).Show();
                        }
                    }

                    if (TypePost == "post_likes")
                    {
                        //Show Empty Page
                        if (LikedUsersAdapter.mPostlikedList.Count > 0)
                        {
                            DataPost_Recycler.Visibility = ViewStates.Visible;
                            DataPost_Empty.Visibility    = ViewStates.Gone;
                        }
                        else
                        {
                            DataPost_Recycler.Visibility = ViewStates.Gone;
                            DataPost_Empty.Visibility    = ViewStates.Visible;

                            IMethods.Set_TextViewIcon("1", Icon_DataPost, IonIcons_Fonts.Thumbsup);

                            Txt_Empty.Text = GetText(Resource.String.Lbl_Empty_PostLikes);
                        }
                    }
                    else if (TypePost == "post_wonders")
                    {
                        //Show Empty Page
                        if (LikedUsersAdapter.mPostlikedList.Count > 0)
                        {
                            DataPost_Recycler.Visibility = ViewStates.Visible;
                            DataPost_Empty.Visibility    = ViewStates.Gone;
                        }
                        else
                        {
                            DataPost_Recycler.Visibility = ViewStates.Gone;
                            DataPost_Empty.Visibility    = ViewStates.Visible;

                            IMethods.Set_TextViewIcon("1", Icon_DataPost, IonIcons_Fonts.IosInformationOutline);

                            Txt_Empty.Text = GetText(Resource.String.Lbl_Empty_PostWonders);
                        }
                    }

                    swipeRefreshLayout.Refreshing = false;
                    swipeRefreshLayout.Enabled    = false;
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
コード例 #5
0
        private async void SaveDataButtonOnClick(object sender, EventArgs e)
        {
            try
            {
                if (Txt_CurrentPassword.Text == "" || Txt_NewPassword.Text == "" || Txt_RepeatPassword.Text == "")
                {
                    Toast.MakeText(this, GetText(Resource.String.Lbl_Please_check_your_details), ToastLength.Long)
                    .Show();
                    return;
                }

                if (Txt_NewPassword.Text != Txt_RepeatPassword.Text)
                {
                    Toast.MakeText(this, GetText(Resource.String.Lbl_Your_password_dont_match), ToastLength.Long)
                    .Show();
                }
                else
                {
                    if (IMethods.CheckConnectivity())
                    {
                        //Show a progress
                        AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading));

                        if (Txt_CurrentPassword.Text != null && Txt_NewPassword.Text != null &&
                            Txt_RepeatPassword.Text != null)
                        {
                            var dataPrivacy = new Dictionary <string, string>
                            {
                                { "new_password", Txt_NewPassword.Text },
                                { "current_password", Txt_CurrentPassword.Text }
                            };

                            var(Api_status, Respond) =
                                await Global.Update_User_Data(dataPrivacy);

                            if (Api_status == 200)
                            {
                                if (Respond is MessageObject result)
                                {
                                    if (result.Message.Contains("updated"))
                                    {
                                        Toast.MakeText(this, result.Message, ToastLength.Short).Show();
                                        AndHUD.Shared.Dismiss(this);
                                    }
                                    else
                                    {
                                        //Show a Error image with a message
                                        AndHUD.Shared.ShowError(this, result.Message, MaskType.Clear,
                                                                TimeSpan.FromSeconds(2));
                                    }
                                }
                            }
                            else if (Api_status == 400)
                            {
                                if (Respond is ErrorObject error)
                                {
                                    var errortext = error._errors.Error_text;


                                    if (errortext.Contains("Invalid or expired access_token"))
                                    {
                                        API_Request.Logout(this);
                                    }
                                }
                            }
                            else if (Api_status == 404)
                            {
                                var error = Respond.ToString();
                            }
                        }
                        else
                        {
                            Toast.MakeText(this, GetString(Resource.String.Lbl_Please_check_your_details),
                                           ToastLength.Long).Show();
                        }

                        AndHUD.Shared.Dismiss(this);
                    }
                    else
                    {
                        Toast.MakeText(this, GetString(Resource.String.Lbl_Error_check_internet_connection),
                                       ToastLength.Short).Show();
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
コード例 #6
0
        //Event Save Data Group
        private async void SaveDataButton_OnClick(object sender, EventArgs eventArgs)
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)
                    .Show();
                }
                else
                {
                    //Show a progress
                    AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading) + "...");

                    var dictionary = new Dictionary <string, string>();

                    //dictionary.Add("group_id", Groups_Id);
                    dictionary.Add("group_name", Txt_name.Text);
                    dictionary.Add("group_title", Txt_title.Text);
                    dictionary.Add("about", Txt_about.Text);
                    dictionary.Add("category", CategoryId);
                    dictionary.Add("privacy", GroupPrivacy);

                    var(Api_status, Respond) = await Client.Group.Update_Group_Data(Groups_Id, dictionary);

                    if (Api_status == 200)
                    {
                        if (Respond is Update_Group_Data_Object result)
                        {
                            var cat = CategoriesController.ListCatigories_Names.FirstOrDefault(a =>
                                                                                               a.Catigories_Id == CategoryId);
                            if (cat != null)
                            {
                                CategoryText = cat.Catigories_Name;
                            }

                            // Update Group in DB
                            var dbDatabase = new SqLiteDatabase();
                            if (Groups_Type == "Joined_UserGroups")
                            {
                                var item = _JoinedGroups_Data;
                                var data = new DataTables.GroupsTB
                                {
                                    Id          = item.id,
                                    UserId      = item.user_id,
                                    GroupName   = Txt_name.Text,
                                    GroupTitle  = Txt_title.Text,
                                    Avatar      = item.avatar,
                                    Cover       = item.cover,
                                    About       = Txt_about.Text,
                                    Category    = CategoryText,
                                    Privacy     = item.privacy,
                                    JoinPrivacy = item.join_privacy,
                                    Active      = item.active,
                                    Registered  = item.registered,
                                    GroupId     = item.group_id,
                                    Url         = item.url,
                                    Name        = Txt_name.Text,
                                    CategoryId  = CategoryId,
                                    Type        = item.type,
                                    Username    = Txt_name.Text
                                };
                                dbDatabase.UpdateRow(data);
                            }
                            else if (Groups_Type == "Joined_MyGroups")
                            {
                                var item = _MyGroups_Data;
                                var data = new DataTables.GroupsTB
                                {
                                    Id          = item.Id,
                                    UserId      = item.UserId,
                                    GroupName   = Txt_name.Text,
                                    GroupTitle  = Txt_title.Text,
                                    Avatar      = item.Avatar,
                                    Cover       = item.Cover,
                                    About       = Txt_about.Text,
                                    Category    = CategoryText,
                                    Privacy     = item.Privacy,
                                    JoinPrivacy = item.JoinPrivacy,
                                    Active      = item.Active,
                                    Registered  = item.Registered,
                                    GroupId     = item.GroupId,
                                    Url         = item.Url,
                                    Name        = Txt_name.Text,
                                    CategoryId  = CategoryId,
                                    Type        = item.Type,
                                    Username    = Txt_name.Text
                                };
                                dbDatabase.UpdateRow(data);
                            }
                            else if (Groups_Type == "Search_Groups")
                            {
                                var item = _SearchGroups_Data;
                                var data = new DataTables.GroupsTB
                                {
                                    Id          = item.Id,
                                    UserId      = item.UserId,
                                    GroupName   = Txt_name.Text,
                                    GroupTitle  = Txt_title.Text,
                                    Avatar      = item.Avatar,
                                    Cover       = item.Cover,
                                    About       = Txt_about.Text,
                                    Category    = CategoryText,
                                    Privacy     = item.Privacy,
                                    JoinPrivacy = item.JoinPrivacy,
                                    Active      = item.Active,
                                    Registered  = item.Registered,
                                    GroupId     = item.GroupId,
                                    Url         = item.Url,
                                    Name        = Txt_name.Text,
                                    CategoryId  = CategoryId,
                                    Type        = item.Type,
                                    Username    = Txt_name.Text
                                };
                                dbDatabase.UpdateRow(data);
                            }
                            else if (Groups_Type == "Group_Data")
                            {
                                var item = _Group_Data;
                                var data = new DataTables.GroupsTB
                                {
                                    //Id = item.id,
                                    UserId      = item.user_id,
                                    GroupName   = Txt_name.Text,
                                    GroupTitle  = Txt_title.Text,
                                    Avatar      = item.avatar,
                                    Cover       = item.cover,
                                    About       = Txt_about.Text,
                                    Category    = CategoryText,
                                    Privacy     = item.privacy,
                                    JoinPrivacy = item.join_privacy,
                                    Active      = item.active,
                                    Registered  = item.registered,
                                    GroupId     = item.group_id,
                                    Url         = item.url,
                                    Name        = Txt_name.Text,
                                    CategoryId  = CategoryId,
                                    //Type = item.type,
                                    Username = Txt_name.Text
                                };
                                dbDatabase.UpdateRow(data);
                            }

                            dbDatabase.Dispose();

                            AndHUD.Shared.ShowSuccess(this, GetText(Resource.String.Lbl_YourGroupWasUpdated),
                                                      MaskType.Clear, TimeSpan.FromSeconds(2));
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is Error_Object error)
                        {
                            var errortext = error._errors.Error_text;
                            //Show a Error
                            AndHUD.Shared.ShowError(this, errortext, MaskType.Clear, TimeSpan.FromSeconds(2));

                            if (errortext.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(this);
                            }
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();
                        //Show a Error
                        AndHUD.Shared.ShowError(this, error, MaskType.Clear, TimeSpan.FromSeconds(2));
                    }

                    AndHUD.Shared.Dismiss(this);
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
コード例 #7
0
        //Get Articles API
        public async void Get_Articles_Api(string offset = "")
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    RunOnUiThread(() => { swipeRefreshLayout.Refreshing = false; });

                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)
                    .Show();
                }
                else
                {
                    var(Api_status, Respond) = await Client.Article.Get_Articles("25", offset);

                    if (Api_status == 200)
                    {
                        if (Respond is Get_Users_Articles_Object result)
                        {
                            RunOnUiThread(() =>
                            {
                                if (result.articles.Length <= 0)
                                {
                                    if (swipeRefreshLayout != null)
                                    {
                                        swipeRefreshLayout.Refreshing = false;
                                    }
                                }
                                else if (result.articles.Length > 0)
                                {
                                    if (ArticlesAdapter.ArticlesList.Count <= 0)
                                    {
                                        ArticlesAdapter.ArticlesList =
                                            new ObservableCollection <Get_Users_Articles_Object.Article>(
                                                result.articles);
                                        ArticlesAdapter.BindEnd();
                                    }
                                    else
                                    {
                                        //Bring new item
                                        var listnew = result.articles?.Where(c =>
                                                                             !ArticlesAdapter.ArticlesList.Select(fc => fc.id).Contains(c.id)).ToList();
                                        if (listnew.Count > 0)
                                        {
                                            var lastCountItem = ArticlesAdapter.ItemCount;

                                            //Results differ
                                            Classes.AddRange(ArticlesAdapter.ArticlesList, listnew);
                                            ArticlesAdapter.NotifyItemRangeInserted(lastCountItem, listnew.Count);
                                        }

                                        if (swipeRefreshLayout.Refreshing)
                                        {
                                            swipeRefreshLayout.Refreshing = false;
                                        }
                                    }
                                }
                            });
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is Error_Object error)
                        {
                            var errortext = error._errors.Error_text;
                            //Toast.MakeText(this, errortext, ToastLength.Short).Show();

                            if (errortext.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(this);
                            }
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();
                        //Toast.MakeText(this, error, ToastLength.Short).Show();
                    }

                    //Show Empty Page
                    //===========================================
                    RunOnUiThread(() =>
                    {
                        if (ArticlesAdapter.ArticlesList.Count > 0)
                        {
                            Articls_Empty.Visibility      = ViewStates.Gone;
                            ArticlsRecylerView.Visibility = ViewStates.Visible;
                        }
                        else
                        {
                            Articls_Empty.Visibility      = ViewStates.Visible;
                            ArticlsRecylerView.Visibility = ViewStates.Gone;
                        }

                        swipeRefreshLayout.Refreshing = false;

                        //Set Event Scroll
                        if (OnMainScrolEvent == null)
                        {
                            var xamarinRecyclerViewOnScrollListener =
                                new XamarinRecyclerViewOnScrollListener(mLayoutManager, swipeRefreshLayout);
                            OnMainScrolEvent = xamarinRecyclerViewOnScrollListener;
                            OnMainScrolEvent.LoadMoreEvent += Article_OnScroll_OnLoadMoreEvent;
                            ArticlsRecylerView.AddOnScrollListener(OnMainScrolEvent);
                            ArticlsRecylerView.AddOnScrollListener(new ScrollDownDetector());
                        }
                        else
                        {
                            OnMainScrolEvent.IsLoading = false;
                        }
                    });
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
                Get_Articles_Api(offset);
            }
        }
コード例 #8
0
        public async void Get_BlockedList_API()
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    swipeRefreshLayout.Refreshing = false;
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)
                    .Show();
                }
                else
                {
                    var(Api_status, Respond) = await Client.Global.Get_Blocked_Users();

                    if (Api_status == 200)
                    {
                        if (Respond is Get_Blocked_Users_Object result)
                        {
                            if (result.blocked_users.Length <= 0)
                            {
                                swipeRefreshLayout.Refreshing = false;
                                return;
                            }

                            var dbDatabase = new SqLiteDatabase();
                            if (mAdapter.mBlockedUsersList.Count > 0)
                            {
                                //Bring new users
                                var listnew = result.blocked_users.Where(c =>
                                                                         !mAdapter.mBlockedUsersList.Select(fc => fc.user_id).Contains(c.user_id)).ToList();
                                if (listnew.Count > 0)
                                {
                                    //Results differ
                                    Classes.AddRange(mAdapter.mBlockedUsersList, listnew);

                                    //Insert Or Replace Just New Data To Database
                                    dbDatabase.Insert_Or_Replace_BlockedUsersTable(
                                        new ObservableCollection <Get_Blocked_Users_Object.Blocked_Users>(listnew));
                                }
                            }
                            else
                            {
                                mAdapter.mBlockedUsersList =
                                    new ObservableCollection <Get_Blocked_Users_Object.Blocked_Users>(
                                        result.blocked_users);
                                mAdapter.BindEnd();

                                //Insert Or Replace Data To Database
                                dbDatabase.Insert_Or_Replace_BlockedUsersTable(mAdapter.mBlockedUsersList);
                            }

                            dbDatabase.Dispose();
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is Error_Object error)
                        {
                            var errortext = error._errors.Error_text;
                            //Toast.MakeText(this, errortext, ToastLength.Short).Show();

                            if (errortext.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(this);
                            }
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();
                        //Toast.MakeText(this, error, ToastLength.Short).Show();
                    }
                }

                //Show Empty Page >>
                //===============================================================
                if (mAdapter.mBlockedUsersList.Count > 0)
                {
                    BlockedUsersRecyler.Visibility = ViewStates.Visible;
                    BlockedUsers_Empty.Visibility  = ViewStates.Gone;
                }
                else
                {
                    BlockedUsersRecyler.Visibility = ViewStates.Gone;
                    BlockedUsers_Empty.Visibility  = ViewStates.Visible;
                }

                swipeRefreshLayout.Refreshing = false;
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
                Get_BlockedList_API();
            }
        }
コード例 #9
0
        public async void Get_NearByList_API(string offset = "")
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    swipeRefreshLayout.Refreshing = false;
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)
                    .Show();
                }
                else
                {
                    XamarinRecyclerViewOnScrollListener.IsLoading = true;

                    await GetPosition();

                    var dictionary = new Dictionary <string, string>
                    {
                        { "limit", "25" },
                        { "offset", offset },
                        { "gender", Filter_gender },
                        { "keyword", "" },
                        { "status", Filter_status },
                        { "distance", Filter_Distance },
                        { "lat", UserDetails.Lat },
                        { "lng", UserDetails.Lng }
                    };


                    var(Api_status, Respond) = await Client.Nearby.Get_Nearby_Users(dictionary);

                    if (Api_status == 200)
                    {
                        if (Respond is Get_Nearby_Users_Object result)
                        {
                            RunOnUiThread(() =>
                            {
                                if (result.nearby_users.Length <= 0)
                                {
                                    if (swipeRefreshLayout.Refreshing)
                                    {
                                        swipeRefreshLayout.Refreshing = false;
                                    }

                                    if (NearByAdapter.mNearByList.Count > 0)
                                    {
                                        Snackbar.Make(NearByRecylerView, GetText(Resource.String.Lbl_No_more_users),
                                                      Snackbar.LengthLong).Show();
                                    }
                                }
                                else if (result.nearby_users.Length > 0)
                                {
                                    if (NearByAdapter.mNearByList.Count <= 0)
                                    {
                                        NearByAdapter.mNearByList =
                                            new ObservableCollection <Get_Nearby_Users_Object.Nearby_Users>(
                                                result.nearby_users);
                                        NearByAdapter.BindEnd();
                                    }
                                    else
                                    {
                                        //Bring new item
                                        var listnew = result.nearby_users?.Where(c =>
                                                                                 !NearByAdapter.mNearByList.Select(fc => fc.user_id).Contains(c.user_id))
                                                      .ToList();
                                        if (listnew.Count > 0)
                                        {
                                            var lastCountItem = NearByAdapter.ItemCount;

                                            //Results differ
                                            Classes.AddRange(NearByAdapter.mNearByList, listnew);
                                            NearByAdapter.NotifyItemRangeInserted(lastCountItem, listnew.Count);
                                        }

                                        if (swipeRefreshLayout.Refreshing)
                                        {
                                            swipeRefreshLayout.Refreshing = false;
                                        }
                                    }
                                }
                            });
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is Error_Object error)
                        {
                            var errortext = error._errors.Error_text;
                            //Toast.MakeText(this, errortext, ToastLength.Short).Show();

                            if (errortext.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(this);
                            }
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();
                        //Toast.MakeText(this, error, ToastLength.Short).Show();
                    }
                }

                //Show Empty Page >>
                //===============================================================
                RunOnUiThread(() =>
                {
                    if (NearByAdapter.mNearByList.Count > 0)
                    {
                        NearByRecylerView.Visibility = ViewStates.Visible;
                        NearBy_Empty.Visibility      = ViewStates.Gone;
                    }
                    else
                    {
                        NearByRecylerView.Visibility = ViewStates.Gone;
                        NearBy_Empty.Visibility      = ViewStates.Visible;
                    }

                    swipeRefreshLayout.Refreshing = false;

                    //Set Event Scroll
                    if (OnMainScrolEvent == null)
                    {
                        var xamarinRecyclerViewOnScrollListener = new XamarinRecyclerViewOnScrollListener(mLayoutManager, swipeRefreshLayout);
                        OnMainScrolEvent = xamarinRecyclerViewOnScrollListener;
                        OnMainScrolEvent.LoadMoreEvent += NearBy_OnScroll_OnLoadMoreEvent;
                        NearByRecylerView.AddOnScrollListener(OnMainScrolEvent);
                        NearByRecylerView.AddOnScrollListener(new ScrollDownDetector());
                    }
                    else
                    {
                        XamarinRecyclerViewOnScrollListener.IsLoading = false;
                    }
                });
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
                Get_NearByList_API(offset);
            }
        }
コード例 #10
0
        //Event Save Data Page
        private async void SaveDataButton_OnClick(object sender, EventArgs eventArgs)
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)
                    .Show();
                }
                else
                {
                    //Show a progress
                    AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading) + "...");

                    var dictionary = new Dictionary <string, string>();

                    //dictionary.Add("page_id", Pages_Id);
                    dictionary.Add("page_name", Txt_name.Text);
                    dictionary.Add("page_title", Txt_title.Text);
                    dictionary.Add("page_description", Txt_about.Text);
                    dictionary.Add("page_category", CategoryId);

                    var(Api_status, Respond) = await Client.Page.Update_Page_Data(Pages_Id, dictionary);

                    if (Api_status == 200)
                    {
                        if (Respond is Update_Group_Data_Object result)
                        {
                            var cat = CategoriesController.ListCatigories_Names.FirstOrDefault(a =>
                                                                                               a.Catigories_Id == CategoryId);
                            if (cat != null)
                            {
                                CategoryText = cat.Catigories_Name;
                            }

                            // Update Page in DB
                            var dbDatabase = new SqLiteDatabase();
                            if (Pages_Type == "Liked_UserPages")
                            {
                                var item = _LikedPages_Data;
                                var data = new DataTables.PageTB
                                {
                                    PageId          = item.page_id,
                                    UserId          = item.user_id,
                                    PageName        = item.page_name,
                                    PageTitle       = item.page_title,
                                    PageDescription = item.page_description,
                                    Avatar          = item.avatar,
                                    Cover           = item.cover,
                                    PageCategory    = item.page_category,
                                    Website         = item.website,
                                    Facebook        = item.facebook,
                                    Google          = item.google,
                                    Vk                    = item.vk,
                                    Twitter               = item.twitter,
                                    Linkedin              = item.linkedin,
                                    Company               = item.company,
                                    Phone                 = item.phone,
                                    Address               = item.address,
                                    CallActionType        = item.call_action_type,
                                    CallActionTypeUrl     = item.call_action_type_url,
                                    BackgroundImage       = item.background_image,
                                    BackgroundImageStatus = item.background_image_status,
                                    Instgram              = item.instgram,
                                    Youtube               = item.youtube,
                                    Verified              = item.verified,
                                    Registered            = item.registered,
                                    Boosted               = item.boosted,
                                    About                 = item.about,
                                    Id                    = item.id,
                                    Type                  = item.type,
                                    Url                   = item.url,
                                    Name                  = item.name,
                                    // Rating = item.rating,
                                    Category    = item.category,
                                    IsPageOnwer = Convert.ToString(item.is_page_onwer),
                                    Username    = item.username
                                };
                                dbDatabase.UpdateRow(data);
                            }
                            else if (Pages_Type == "Liked_MyPages")
                            {
                                var item = _MyPages_Data;
                                var data = new DataTables.PageTB
                                {
                                    PageId          = item.PageId,
                                    UserId          = item.UserId,
                                    PageName        = item.PageName,
                                    PageTitle       = item.PageTitle,
                                    PageDescription = item.PageDescription,
                                    Avatar          = item.Avatar,
                                    Cover           = item.Cover,
                                    PageCategory    = item.PageCategory,
                                    Website         = item.Website,
                                    Facebook        = item.Facebook,
                                    Google          = item.Google,
                                    Vk                    = item.Vk,
                                    Twitter               = item.Twitter,
                                    Linkedin              = item.Linkedin,
                                    Company               = item.Company,
                                    Phone                 = item.Phone,
                                    Address               = item.Address,
                                    CallActionType        = item.CallActionType,
                                    CallActionTypeUrl     = item.CallActionTypeUrl,
                                    BackgroundImage       = item.BackgroundImage,
                                    BackgroundImageStatus = item.BackgroundImageStatus,
                                    Instgram              = item.Instgram,
                                    Youtube               = item.Youtube,
                                    Verified              = item.Verified,
                                    Registered            = item.Registered,
                                    Boosted               = item.Boosted,
                                    About                 = item.About,
                                    Id                    = item.Id,
                                    Type                  = item.Type,
                                    Url                   = item.Url,
                                    Name                  = item.Name,
                                    //Rating = item.Rating,
                                    Category    = item.Category,
                                    IsPageOnwer = Convert.ToString(item.IsPageOnwer),
                                    Username    = item.Username
                                };
                                dbDatabase.UpdateRow(data);
                            }
                            else if (Pages_Type == "Saerch_Pages")
                            {
                                var item = _SearchPages_Data;
                                var data = new DataTables.PageTB
                                {
                                    PageId          = item.PageId,
                                    UserId          = item.UserId,
                                    PageName        = item.PageName,
                                    PageTitle       = item.PageTitle,
                                    PageDescription = item.PageDescription,
                                    Avatar          = item.Avatar,
                                    Cover           = item.Cover,
                                    PageCategory    = item.PageCategory,
                                    Website         = item.Website,
                                    Facebook        = item.Facebook,
                                    Google          = item.Google,
                                    Vk                    = item.Vk,
                                    Twitter               = item.Twitter,
                                    Linkedin              = item.Linkedin,
                                    Company               = item.Company,
                                    Phone                 = item.Phone,
                                    Address               = item.Address,
                                    CallActionType        = item.CallActionType,
                                    CallActionTypeUrl     = item.CallActionTypeUrl,
                                    BackgroundImage       = item.BackgroundImage,
                                    BackgroundImageStatus = item.BackgroundImageStatus,
                                    Instgram              = item.Instgram,
                                    Youtube               = item.Youtube,
                                    Verified              = item.Verified,
                                    Registered            = item.Registered,
                                    Boosted               = item.Boosted,
                                    About                 = item.About,
                                    Id                    = item.Id,
                                    Type                  = item.Type,
                                    Url                   = item.Url,
                                    Name                  = item.Name,
                                    //Rating = item.Rating,
                                    Category    = item.Category,
                                    IsPageOnwer = Convert.ToString(item.IsPageOnwer),
                                    Username    = item.Username
                                };
                                dbDatabase.UpdateRow(data);
                            }
                            else if (Pages_Type == "Page_Data")
                            {
                                var item = _Page_Data;
                                var data = new DataTables.PageTB
                                {
                                    PageId          = item.page_id,
                                    UserId          = item.user_id,
                                    PageName        = item.page_name,
                                    PageTitle       = item.page_title,
                                    PageDescription = item.page_description,
                                    Avatar          = item.avatar,
                                    Cover           = item.cover,
                                    PageCategory    = item.page_category,
                                    Website         = item.website,
                                    Facebook        = item.facebook,
                                    Google          = item.google,
                                    Vk                = item.vk,
                                    Twitter           = item.twitter,
                                    Linkedin          = item.linkedin,
                                    Company           = item.company,
                                    Phone             = item.phone,
                                    Address           = item.address,
                                    CallActionType    = item.call_action_type,
                                    CallActionTypeUrl = item.call_action_type_url,
                                    BackgroundImage   = item.background_image,
                                    //BackgroundImageStatus = item.BackgroundImageStatus,
                                    Instgram   = item.instgram,
                                    Youtube    = item.youtube,
                                    Verified   = item.verified,
                                    Registered = item.registered,
                                    Boosted    = item.boosted,
                                    About      = item.about,
                                    //Id = item.id,
                                    //Type = item.t,
                                    Url  = item.url,
                                    Name = item.name,
                                    //Rating = item.rating,
                                    Category    = item.category,
                                    IsPageOnwer = Convert.ToString(item.is_page_onwer),
                                    Username    = item.username
                                };
                                dbDatabase.UpdateRow(data);
                            }

                            dbDatabase.Dispose();

                            AndHUD.Shared.ShowSuccess(this, GetText(Resource.String.Lbl_YourPageWasUpdated),
                                                      MaskType.Clear, TimeSpan.FromSeconds(2));
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is Error_Object error)
                        {
                            var errortext = error._errors.Error_text;
                            //Show a Error
                            AndHUD.Shared.ShowError(this, errortext, MaskType.Clear, TimeSpan.FromSeconds(2));

                            if (errortext.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(this);
                            }
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();
                        //Show a Error
                        AndHUD.Shared.ShowError(this, error, MaskType.Clear, TimeSpan.FromSeconds(2));
                    }

                    AndHUD.Shared.Dismiss(this);
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
コード例 #11
0
        //Get List Group Using API
        public async void Get_CommunitiesList_Group_API()
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    swipeRefreshLayout.Refreshing = false;
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)
                    .Show();
                }
                else
                {
                    var(Api_status, Respond) = await Client.Global.Get_Community(new Settings(), UserID);

                    if (Api_status == 200)
                    {
                        if (Respond is Get_Community_Object result)
                        {
                            if (result.Groups.Count <= 0 && result.likedPages.Count <= 0 && result.Pages.Count <= 0)
                            {
                                swipeRefreshLayout.Refreshing = false;
                            }

                            var dbDatabase = new SqLiteDatabase();

                            //Add Data
                            //=======================================
                            if (GroupsManage_Type == "Manage_UserGroups")
                            {
                                GroupsAdapter.mGroupsList =
                                    new ObservableCollection <Get_Community_Object.Group>(result.Groups);
                                GroupsAdapter.BindEnd();
                            }
                            else if (GroupsManage_Type == "Manage_MyGroups")
                            {
                                // Groups
                                if (GroupsAdapter.mGroupsList.Count > 0)
                                {
                                    //Bring new groups
                                    var listNew = result.Groups.Where(c =>
                                                                      !GroupsAdapter.mGroupsList.Select(fc => fc.GroupId).Contains(c.GroupId))
                                                  .ToList();
                                    if (listNew.Count > 0)
                                    {
                                        var chkList = listNew.Where(a => a.UserId != UserDetails.User_id).ToList();
                                        if (chkList.Count > 0)
                                        {
                                            //Results differ
                                            Classes.AddRange(GroupsAdapter.mGroupsList, chkList);
                                            GroupsAdapter.BindEnd();

                                            //Insert Or Replace Just New Data To Database
                                            if (UserID == UserDetails.User_id)
                                            {
                                                dbDatabase.Insert_Or_Replace_GroupsTable(
                                                    new ObservableCollection <Get_Community_Object.Group>(chkList));
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    var chkList = result.Groups.Where(a => a.UserId != UserDetails.User_id).ToList();
                                    if (chkList.Count > 0)
                                    {
                                        GroupsAdapter.mGroupsList =
                                            new ObservableCollection <Get_Community_Object.Group>(chkList);
                                        GroupsAdapter.BindEnd();

                                        //Insert Or Replace Just New Data To Database
                                        if (UserID == UserDetails.User_id)
                                        {
                                            dbDatabase.Insert_Or_Replace_GroupsTable(
                                                new ObservableCollection <Get_Community_Object.Group>(chkList));
                                        }
                                    }
                                }

                                //====================================

                                //Manage
                                if (ManageGroupsAdapter.mUserGroupsList.Count > 0)
                                {
                                    var chkListManage = result.Groups.Where(a => a.UserId == UserDetails.User_id)
                                                        .ToList();
                                    if (chkListManage.Count > 0)
                                    {
                                        //Bring new groups
                                        var listNew = chkListManage.Where(c =>
                                                                          !ManageGroupsAdapter.mUserGroupsList.Select(fc => fc.group_id)
                                                                          .Contains(c.GroupId)).ToList();
                                        if (listNew.Count > 0)
                                        {
                                            var list = chkListManage.Select(group =>
                                                                            new Get_User_Data_Object.Joined_Groups
                                            {
                                                id           = group.Id,
                                                user_id      = group.UserId,
                                                group_name   = group.GroupName,
                                                group_title  = group.GroupTitle,
                                                avatar       = group.Avatar,
                                                cover        = group.Cover,
                                                about        = group.About,
                                                category     = group.Category,
                                                privacy      = group.Privacy,
                                                join_privacy = group.JoinPrivacy,
                                                active       = group.Active,
                                                registered   = group.Registered,
                                                group_id     = group.GroupId,
                                                url          = group.Url,
                                                name         = group.Name,
                                                category_id  = group.CategoryId,
                                                type         = group.Type,
                                                username     = group.Username
                                            }).ToList();

                                            //Results differ
                                            Classes.AddRange(ManageGroupsAdapter.mUserGroupsList, list);
                                            ManageGroupsAdapter.BindEnd();

                                            //Insert Or Replace Just New Data To Database
                                            if (UserID == UserDetails.User_id)
                                            {
                                                dbDatabase.InsertOrReplace_ManageGroupsTable(
                                                    new ObservableCollection <Get_User_Data_Object.Joined_Groups>(list));
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    var chkListManage = result.Groups.Where(a => a.UserId == UserDetails.User_id)
                                                        .ToList();
                                    if (chkListManage.Count > 0)
                                    {
                                        var list = chkListManage.Select(group => new Get_User_Data_Object.Joined_Groups
                                        {
                                            id           = group.Id,
                                            user_id      = group.UserId,
                                            group_name   = group.GroupName,
                                            group_title  = group.GroupTitle,
                                            avatar       = group.Avatar,
                                            cover        = group.Cover,
                                            about        = group.About,
                                            category     = group.Category,
                                            privacy      = group.Privacy,
                                            join_privacy = group.JoinPrivacy,
                                            active       = group.Active,
                                            registered   = group.Registered,
                                            group_id     = group.GroupId,
                                            url          = group.Url,
                                            name         = group.Name,
                                            category_id  = group.CategoryId,
                                            type         = group.Type,
                                            username     = group.Username
                                        }).ToList();

                                        ManageGroupsAdapter.mUserGroupsList =
                                            new ObservableCollection <Get_User_Data_Object.Joined_Groups>(list);
                                        ManageGroupsAdapter.BindEnd();

                                        //Insert Or Replace Just New Data To Database
                                        if (UserID == UserDetails.User_id)
                                        {
                                            dbDatabase.InsertOrReplace_ManageGroupsTable(
                                                new ObservableCollection <Get_User_Data_Object.Joined_Groups>(list));
                                        }
                                    }
                                }

                                //====================================

                                // pages
                                if (result.Pages.Count > 0)
                                {
                                    var pagesList = new ObservableCollection <Get_Community_Object.Page>(result.Pages);

                                    //Update All Data To Database
                                    if (UserID == UserDetails.User_id)
                                    {
                                        dbDatabase.Insert_Or_Replace_PagesTable(pagesList);
                                    }
                                }

                                //====================================

                                // likedPages
                                if (result.likedPages.Count > 0)
                                {
                                    var likedPagesList =
                                        new ObservableCollection <Get_Community_Object.LikedPages>(result.likedPages);

                                    //Update All Data To Database
                                    if (UserID == UserDetails.User_id)
                                    {
                                        var list = likedPagesList.Select(page => new Get_Community_Object.Page
                                        {
                                            PageId          = page.PageId,
                                            UserId          = page.UserId,
                                            PageName        = page.PageName,
                                            PageTitle       = page.PageTitle,
                                            PageDescription = page.PageDescription,
                                            Avatar          = page.Avatar,
                                            Cover           = page.Cover,
                                            PageCategory    = page.PageCategory,
                                            Website         = page.Website,
                                            Facebook        = page.Facebook,
                                            Google          = page.Google,
                                            Vk                    = page.Vk,
                                            Twitter               = page.Twitter,
                                            Linkedin              = page.Linkedin,
                                            Company               = page.Company,
                                            Phone                 = page.Phone,
                                            Address               = page.Address,
                                            CallActionType        = page.CallActionType,
                                            CallActionTypeUrl     = page.CallActionTypeUrl,
                                            BackgroundImage       = page.BackgroundImage,
                                            BackgroundImageStatus = page.BackgroundImageStatus,
                                            Instgram              = page.Instgram,
                                            Youtube               = page.Youtube,
                                            Verified              = page.Verified,
                                            Registered            = page.Registered,
                                            Boosted               = page.Boosted,
                                            About                 = page.About,
                                            Id                    = page.Id,
                                            Type                  = page.Type,
                                            Url                   = page.Url,
                                            Name                  = page.Name,
                                            //Rating = page.Rating,
                                            Category    = page.Category,
                                            IsPageOnwer = page.IsPageOnwer,
                                            Username    = page.Username
                                        }).ToList();

                                        dbDatabase.Insert_Or_Replace_PagesTable(
                                            new ObservableCollection <Get_Community_Object.Page>(list));
                                    }
                                }
                            }

                            dbDatabase.Dispose();
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is Error_Object error)
                        {
                            var errorText = error._errors.Error_text;
                            //Toast.MakeText(this, errortext, ToastLength.Short).Show();

                            if (errorText.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(this);
                            }
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();
                        //Toast.MakeText(this, error, ToastLength.Short).Show();
                    }
                }

                //Show Empty Page >>
                //===============================================================
                if (GroupsAdapter.mGroupsList.Count > 0)
                {
                    GroupsSection.Visibility     = ViewStates.Visible;
                    GroupsRecylerView.Visibility = ViewStates.Visible;
                }
                else
                {
                    GroupsSection.Visibility     = ViewStates.Gone;
                    GroupsRecylerView.Visibility = ViewStates.Gone;
                }

                //if Manage_MyGroups list count == 0 >> show empty page
                if (ManageGroupsAdapter.mUserGroupsList.Count > 0)
                {
                    Txt_Count_ManageGroups.Text = ManageGroupsAdapter.mUserGroupsList.Count.ToString();

                    ManageGroupsSection.Visibility     = ViewStates.Visible;
                    ManageGroupsRecylerView.Visibility = ViewStates.Visible;
                }
                else
                {
                    Txt_Count_ManageGroups.Text = "0";

                    ManageGroupsSection.Visibility     = ViewStates.Gone;
                    ManageGroupsRecylerView.Visibility = ViewStates.Gone;
                }

                if (GroupsAdapter.mGroupsList.Count == 0 && ManageGroupsAdapter.mUserGroupsList.Count == 0)
                {
                    Groups_Empty.Visibility = ViewStates.Visible;

                    ManageGroupsSection.Visibility     = ViewStates.Gone;
                    ManageGroupsRecylerView.Visibility = ViewStates.Gone;

                    GroupsSection.Visibility     = ViewStates.Gone;
                    GroupsRecylerView.Visibility = ViewStates.Gone;
                }
                else
                {
                    Groups_Empty.Visibility = ViewStates.Gone;
                }

                swipeRefreshLayout.Refreshing = false;
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
                Get_CommunitiesList_Group_API();
            }
        }
コード例 #12
0
        //function Creat New Group
        private async void CreatButton_OnClick(object sender, EventArgs eventArgs)
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection),
                                   ToastLength.Short).Show();
                }
                else
                {
                    if (string.IsNullOrEmpty(Txt_name.Text))
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_name), ToastLength.Short).Show();
                    }
                    else if (string.IsNullOrEmpty(Txt_title.Text))
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_title), ToastLength.Short).Show();
                    }
                    else if (string.IsNullOrEmpty(Txt_about.Text))
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_about), ToastLength.Short).Show();
                    }
                    else if (string.IsNullOrEmpty(CategoryId))
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_Please_select_category), ToastLength.Short)
                        .Show();
                    }
                    else
                    {
                        //Show a progress
                        AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading) + "...");

                        var(Api_status, Respond) = await Client.Page.Create_Page(Txt_name.Text, Txt_title.Text,
                                                                                 CategoryId, Txt_about.Text);

                        if (Api_status == 200)
                        {
                            if (Respond is Create_Page_Object result)
                            {
                                if (result.page_data != null)
                                {
                                    var item = result.page_data;
                                    //Insert group data to database
                                    var page = new DataTables.PageTB
                                    {
                                        PageId          = item.page_id,
                                        UserId          = item.user_id,
                                        PageName        = item.page_name,
                                        PageTitle       = item.page_title,
                                        PageDescription = item.page_description,
                                        Avatar          = item.avatar,
                                        Cover           = item.cover,
                                        PageCategory    = item.page_category,
                                        Website         = item.website,
                                        Facebook        = item.facebook,
                                        Google          = item.google,
                                        Vk                    = item.vk,
                                        Twitter               = item.twitter,
                                        Linkedin              = item.linkedin,
                                        Company               = item.company,
                                        Phone                 = item.phone,
                                        Address               = item.address,
                                        CallActionType        = item.call_action_type,
                                        CallActionTypeUrl     = item.call_action_type_url,
                                        BackgroundImage       = item.background_image,
                                        BackgroundImageStatus = item.background_image_status,
                                        Instgram              = item.instgram,
                                        Youtube               = item.youtube,
                                        Verified              = item.verified,
                                        Registered            = item.registered,
                                        Boosted               = item.boosted,
                                        About                 = item.about,
                                        Id                    = item.id,
                                        Type                  = item.type,
                                        Url                   = item.url,
                                        Name                  = item.name,
                                        //Rating = item.rating,
                                        Category    = item.category,
                                        IsPageOnwer = Convert.ToString(item.is_page_onwer),
                                        Username    = item.username
                                    };

                                    var dbDatabase = new SqLiteDatabase();
                                    dbDatabase.InsertRow(page);
                                    dbDatabase.Dispose();

                                    AndHUD.Shared.ShowSuccess(this);
                                }
                            }
                        }
                        else if (Api_status == 400)
                        {
                            if (Respond is Error_Object error)
                            {
                                var errortext = error._errors.Error_text;
                                //Show a Error
                                AndHUD.Shared.ShowError(this, errortext, MaskType.Clear, TimeSpan.FromSeconds(2));

                                if (errortext.Contains("Invalid or expired access_token"))
                                {
                                    API_Request.Logout(this);
                                }
                            }
                        }
                        else if (Api_status == 404)
                        {
                            var error = Respond.ToString();
                            //Show a Error
                            AndHUD.Shared.ShowError(this, error, MaskType.Clear, TimeSpan.FromSeconds(2));
                        }

                        AndHUD.Shared.Dismiss(this);
                    }
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
コード例 #13
0
        private async void EditProfileButtonOnClick()
        {
            try
            {
                var local = Classes.MyProfileList.FirstOrDefault(a => a.user_id == S_UserId);
                if (local != null)
                {
                    local.first_name   = Txt_FirstName.Text;
                    local.last_name    = Txt_LastName.Text;
                    local.address      = Txt_location_text.Text;
                    local.working      = Txt_work_text.Text;
                    local.about        = S_About;
                    local.gender       = Txt_gender_text.Text;
                    local.website      = Txt_website_text.Text;
                    local.facebook     = Txt_facebook_text.Text;
                    local.google       = Txt_Google_text.Text;
                    local.twitter      = Txt_Twitter_text.Text;
                    local.youtube      = Txt_Youtube_text.Text;
                    local.vk           = Txt_VK_text.Text;
                    local.instagram    = Txt_Instagram_text.Text;
                    local.phone_number = Txt_mobile_text.Text;

                    SqLiteDatabase dbDatabase = new SqLiteDatabase();
                    dbDatabase.Insert_Or_Update_To_MyProfileTable(local);
                    dbDatabase.Dispose();
                }

                if (IMethods.CheckConnectivity())
                {
                    var dictionary = new Dictionary <string, string>();

                    if (!string.IsNullOrEmpty(Txt_FirstName.Text))
                    {
                        dictionary.Add("first_name", Txt_FirstName.Text);
                    }

                    if (!string.IsNullOrEmpty(Txt_LastName.Text))
                    {
                        dictionary.Add("last_name", Txt_LastName.Text);
                    }

                    if (!string.IsNullOrEmpty(S_About))
                    {
                        dictionary.Add("about", S_About);
                    }

                    if (!string.IsNullOrEmpty(Txt_facebook_text.Text))
                    {
                        dictionary.Add("facebook", Txt_facebook_text.Text);
                    }

                    if (!string.IsNullOrEmpty(Txt_Google_text.Text))
                    {
                        dictionary.Add("google", Txt_Google_text.Text);
                    }

                    if (!string.IsNullOrEmpty(Txt_Twitter_text.Text))
                    {
                        dictionary.Add("twitter", Txt_Twitter_text.Text);
                    }

                    if (!string.IsNullOrEmpty(Txt_Youtube_text.Text))
                    {
                        dictionary.Add("youtube", Txt_Youtube_text.Text);
                    }

                    if (!string.IsNullOrEmpty(Txt_Instagram_text.Text))
                    {
                        dictionary.Add("instagram", Txt_Instagram_text.Text);
                    }

                    if (!string.IsNullOrEmpty(Txt_VK_text.Text))
                    {
                        dictionary.Add("vk", Txt_VK_text.Text);
                    }

                    if (!string.IsNullOrEmpty(Txt_website_text.Text))
                    {
                        dictionary.Add("website", Txt_website_text.Text);
                    }

                    if (!string.IsNullOrEmpty(S_School))
                    {
                        dictionary.Add("school", S_School);
                    }

                    if (!string.IsNullOrEmpty(Txt_location_text.Text))
                    {
                        dictionary.Add("address", Txt_location_text.Text);
                    }

                    if (!string.IsNullOrEmpty(Txt_gender_text.Text))
                    {
                        dictionary.Add("gender", Txt_gender_text.Text.ToLower());
                    }

                    if (!string.IsNullOrEmpty(Txt_mobile_text.Text))
                    {
                        dictionary.Add("phone", Txt_mobile_text.Text);
                    }

                    var(Api_status, Respond) = await Global.Update_User_Data(dictionary);

                    if (Api_status == 200)
                    {
                        if (Respond is MessageObject result)
                        {
                            if (result.Message.Contains("updated"))
                            {
                                Toast.MakeText(this, result.Message, ToastLength.Short).Show();
                            }
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is ErrorObject error)
                        {
                            var errortext = error._errors.Error_text;


                            if (errortext.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(this);
                            }
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();
                    }
                }
                else
                {
                    Toast.MakeText(this, this.GetText(Resource.String.Lbl_Error_check_internet_connection), ToastLength.Short).Show();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #14
0
        private async void SaveDataButtonOnClick()
        {
            try
            {
                if (IMethods.CheckConnectivity())
                {
                    //Show a progress
                    AndHUD.Shared.Show(this, this.GetText(Resource.String.Lbl_Loading));

                    var dictionary = new Dictionary <string, string>
                    {
                        { "username", Txt_Username_text.Text },
                        { "email", Txt_Email_text.Text },
                        { "gender", GenderStatus },
                        { "phone_number", Phone_number },
                    };

                    var(Api_status, Respond) = await Global.Update_User_Data(dictionary);

                    if (Api_status == 200)
                    {
                        if (Respond is MessageObject result)
                        {
                            if (result.Message.Contains("updated"))
                            {
                                Toast.MakeText(this, result.Message, ToastLength.Short).Show();
                                AndHUD.Shared.Dismiss(this);
                            }
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is ErrorObject error)
                        {
                            var errortext = error._errors.Error_text;


                            if (errortext.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(this);
                            }

                            //Show a Error image with a message
                            AndHUD.Shared.ShowError(this, errortext, MaskType.Clear, TimeSpan.FromSeconds(2));
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();


                        //Show a Error image with a message
                        AndHUD.Shared.ShowError(this, error, MaskType.Clear, TimeSpan.FromSeconds(2));
                    }

                    AndHUD.Shared.Dismiss(this);
                }
                else
                {
                    Toast.MakeText(this, this.GetText(Resource.String.Lbl_Error_check_internet_connection), ToastLength.Short).Show();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #15
0
        //Event Edit
        private async void EditPost_OnClick(object sender, EventArgs eventArgs)
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)
                    .Show();
                }
                else
                {
                    //Show a progress
                    AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading) + "...");

                    var(Api_status, Respond) = await Client.Global.Post_Actions(IdPost, "edit", Txt_ContentPost.Text);

                    if (Api_status == 200)
                    {
                        if (Respond is Post_Actions_Object result)
                        {
                            if (result.Action.Contains(""))
                            {
                                Toast.MakeText(this, result.Action, ToastLength.Short).Show();
                                AndHUD.Shared.Dismiss(this);

                                // put the String to pass back into an Intent and close this activity
                                var resultIntent = new Intent();
                                resultIntent.PutExtra("PostId", IdPost);
                                resultIntent.PutExtra("PostText", Txt_ContentPost.Text);
                                SetResult(Result.Ok, resultIntent);
                                Finish();
                            }
                            else
                            {
                                //Show a Error image with a message
                                AndHUD.Shared.ShowError(this, result.Action, MaskType.Clear, TimeSpan.FromSeconds(2));
                            }
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is Error_Object error)
                        {
                            var errortext = error._errors.Error_text;
                            //Toast.MakeText(this, errortext, ToastLength.Short).Show();

                            if (errortext.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(this);
                            }
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();
                        //Toast.MakeText(this, error, ToastLength.Short).Show();
                    }

                    AndHUD.Shared.Dismiss(this);
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
コード例 #16
0
        //Api latest activities
        public async void Get_Activities()
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    Toast.MakeText(Context, GetString(Resource.String.Lbl_CheckYourInternetConnection),
                                   ToastLength.Short).Show();
                    LastActivitiesRecyclerView.Visibility       = ViewStates.Gone;
                    layout_SuggestionlLastactivities.Visibility = ViewStates.Gone;
                }
                else
                {
                    var(Api_status, Respond) = await Client.Global.Get_Activities();

                    if (Api_status == 200)
                    {
                        if (Respond is Activities_Object result)
                        {
                            this.Activity.RunOnUiThread(() =>
                            {
                                if (result.Activities.Count > 0)
                                {
                                    //Bring new groups
                                    var listnew = result.Activities.Where(c =>
                                                                          !LastActivitiesAdapter.mLastActivitiesList.Select(fc => fc.Id).Contains(c.Id))
                                                  .ToList();
                                    if (listnew.Count > 0)
                                    {
                                        //Results differ
                                        Classes.AddRange(LastActivitiesAdapter.mLastActivitiesList, listnew);
                                        LastActivitiesAdapter.BindEnd();
                                    }
                                    else
                                    {
                                        LastActivitiesAdapter.mLastActivitiesList =
                                            new ObservableCollection <Activities_Object.Activity>(result.Activities);
                                        LastActivitiesAdapter.BindEnd();
                                    }
                                }
                                else
                                {
                                    LastActivitiesAdapter.mLastActivitiesList =
                                        new ObservableCollection <Activities_Object.Activity>(result.Activities);
                                    LastActivitiesAdapter.BindEnd();
                                }
                            });
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is Error_Object error)
                        {
                            var errortext = error._errors.Error_text;
                            //Toast.MakeText(this.Context, errortext, ToastLength.Short).Show();

                            if (errortext.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(Activity);
                            }
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();
                        //Toast.MakeText(this.Context, error, ToastLength.Short).Show();
                    }

                    this.Activity.RunOnUiThread(() =>
                    {
                        if (LastActivitiesAdapter.mLastActivitiesList.Count > 0)
                        {
                            LastActivitiesRecyclerView.Visibility       = ViewStates.Visible;
                            layout_SuggestionlLastactivities.Visibility = ViewStates.Visible;
                        }
                        else
                        {
                            LastActivitiesRecyclerView.Visibility       = ViewStates.Gone;
                            layout_SuggestionlLastactivities.Visibility = ViewStates.Gone;
                        }
                    });
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
                Get_Activities();
            }
        }
コード例 #17
0
        //function Creat New Group
        private async void CreatButton_OnClick(object sender, EventArgs eventArgs)
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)
                    .Show();
                }
                else
                {
                    if (string.IsNullOrEmpty(Txt_name.Text))
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_name), ToastLength.Short).Show();
                    }
                    else if (string.IsNullOrEmpty(Txt_title.Text))
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_title), ToastLength.Short).Show();
                    }
                    else if (string.IsNullOrEmpty(Txt_about.Text))
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_Please_enter_about), ToastLength.Short).Show();
                    }
                    else if (string.IsNullOrEmpty(CategoryId))
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_Please_select_category), ToastLength.Short)
                        .Show();
                    }
                    else
                    {
                        //Show a progress
                        AndHUD.Shared.Show(this, "Loading...");

                        var(Api_status, Respond) = await Client.Group.Create_Group(Txt_name.Text, Txt_title.Text,
                                                                                   Txt_about.Text, CategoryId);

                        if (Api_status == 200)
                        {
                            if (Respond is Create_Group_Object result)
                            {
                                if (result.group_data != null)
                                {
                                    var item = result.group_data;
                                    //Insert group data to database
                                    var group = new DataTables.GroupsTB
                                    {
                                        Id          = item.id,
                                        UserId      = item.user_id,
                                        GroupName   = item.group_name,
                                        GroupTitle  = item.group_title,
                                        Avatar      = item.avatar,
                                        Cover       = item.cover,
                                        About       = item.about,
                                        Category    = item.category,
                                        Privacy     = item.privacy,
                                        JoinPrivacy = item.join_privacy,
                                        Active      = item.active,
                                        Registered  = item.registered,
                                        GroupId     = item.group_id,
                                        Url         = item.url,
                                        Name        = item.name,
                                        CategoryId  = item.category_id,
                                        Type        = item.type,
                                        Username    = item.username
                                    };

                                    var dbDatabase = new SqLiteDatabase();
                                    dbDatabase.InsertRow(group);
                                    dbDatabase.Dispose();

                                    AndHUD.Shared.ShowSuccess(this);
                                }
                            }
                        }
                        else if (Api_status == 400)
                        {
                            if (Respond is Error_Object error)
                            {
                                var errortext = error._errors.Error_text;
                                //Show a Error
                                AndHUD.Shared.ShowError(this, errortext, MaskType.Clear, TimeSpan.FromSeconds(2));

                                if (errortext.Contains("Invalid or expired access_token"))
                                {
                                    API_Request.Logout(this);
                                }
                            }
                        }
                        else if (Api_status == 404)
                        {
                            var error = Respond.ToString();
                            //Show a Error
                            AndHUD.Shared.ShowError(this, error, MaskType.Clear, TimeSpan.FromSeconds(2));
                        }

                        AndHUD.Shared.Dismiss(this);
                    }
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
コード例 #18
0
        //Get Data Market Using API
        public async void Get_DataMarket_Api(string offset = "")
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    Activity.RunOnUiThread(() => { swipeRefreshLayout.Refreshing = false; });
                    Toast.MakeText(Activity, Activity.GetString(Resource.String.Lbl_CheckYourInternetConnection),
                                   ToastLength.Short).Show();
                }
                else
                {
                    var(Api_status, Respond) = await Client.Market.Get_Products("", "35", offset);

                    if (Api_status == 200)
                    {
                        if (Respond is Get_Products_Object result)
                        {
                            Activity.RunOnUiThread(() =>
                            {
                                if (result.products.Length <= 0)
                                {
                                    if (swipeRefreshLayout.Refreshing)
                                    {
                                        swipeRefreshLayout.Refreshing = false;
                                    }
                                }
                                else if (result.products.Length > 0)
                                {
                                    if (MMarketAdapter.MarketList.Count <= 0)
                                    {
                                        MMarketAdapter.MarketList =
                                            new ObservableCollection <Get_Products_Object.Product>(result.products);
                                        MMarketAdapter.BindEnd();

                                        var animation = AnimationUtils.LoadAnimation(Activity,
                                                                                     Resource.Animation.slideUpAnim);
                                        MainRecyclerView.StartAnimation(animation);
                                    }
                                    else
                                    {
                                        //Bring new item
                                        //var exceptList = result.products?.ToList().Except(MMarketAdapter?.MarketList).ToList();

                                        var listnew = result.products?.Where(c =>
                                                                             !MMarketAdapter.MarketList.Select(fc => fc.id).Contains(c.id)).ToList();
                                        if (listnew.Count > 0)
                                        {
                                            var lastCountItem = MMarketAdapter.ItemCount;

                                            //Results differ
                                            Classes.AddRange(MMarketAdapter.MarketList, listnew);
                                            MMarketAdapter.NotifyItemRangeInserted(lastCountItem, listnew.Count);
                                        }

                                        if (swipeRefreshLayout.Refreshing)
                                        {
                                            swipeRefreshLayout.Refreshing = false;
                                        }
                                    }
                                }
                            });
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is Error_Object error)
                        {
                            var errortext = error._errors.Error_text;
                            //Toast.MakeText(this.Activity, errortext, ToastLength.Short).Show();

                            if (errortext.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(Activity);
                            }
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();
                        //Toast.MakeText(this.Activity, error, ToastLength.Short).Show();
                    }
                }

                //Show Empty Page >>
                //===============================================================
                Activity.RunOnUiThread(() =>
                {
                    swipeRefreshLayout.Refreshing = false;

                    if (MMarketAdapter.MarketList.Count > 0)
                    {
                        if (MainRecyclerView.Visibility == ViewStates.Gone)
                        {
                            MainRecyclerView.Visibility = ViewStates.Visible;
                        }

                        if (Market_Empty.Visibility == ViewStates.Visible)
                        {
                            Market_Empty.Visibility = ViewStates.Gone;
                        }
                    }
                    else if (MMarketAdapter.MarketList.Count <= 0)
                    {
                        MainRecyclerView.Visibility = ViewStates.Gone;
                        Market_Empty.Visibility     = ViewStates.Visible;
                    }

                    //Set Event Scroll
                    if (MarketMainScrolEvent == null)
                    {
                        var xamarinRecyclerViewOnScrollListener =
                            new XamarinRecyclerViewOnScrollListener(mLayoutManager, swipeRefreshLayout);
                        MarketMainScrolEvent = xamarinRecyclerViewOnScrollListener;
                        MarketMainScrolEvent.LoadMoreEvent += Market_FragmentOnScroll_OnLoadMoreEvent;
                        MainRecyclerView.AddOnScrollListener(MarketMainScrolEvent);
                        MainRecyclerView.AddOnScrollListener(new ScrollDownDetector());
                    }
                    else
                    {
                        MarketMainScrolEvent.IsLoading = false;
                    }
                });
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
                Get_DataMarket_Api(offset);
            }
        }
コード例 #19
0
        //Save data
        private async void SaveData_OnClick(object sender, EventArgs eventArgs)
        {
            try
            {
                if (IMethods.CheckConnectivity())
                {
                    //Show a progress
                    AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading));

                    string newFormat  = DateTime.ParseExact(Txt_Birthday_text.Text, "dd'.'MM'.'yyyy", CultureInfo.InvariantCulture).ToString("dd-MM-yyyy");
                    var    dictionary = new Dictionary <string, string>
                    {
                        { "username", Txt_Username_text.Text },
                        { "email", Txt_Email_text.Text },
                        { "birthday", newFormat },
                        { "gender", GenderStatus }
                    };

                    var(Api_status, Respond) = await Client.Global.Update_User_Data(new Settings(), dictionary);

                    if (Api_status == 200)
                    {
                        if (Respond is Update_User_Data_Object result)
                        {
                            if (result.message.Contains("updated"))
                            {
                                Toast.MakeText(this, result.message, ToastLength.Short).Show();
                                AndHUD.Shared.Dismiss(this);
                            }
                            else
                            {
                                //Show a Error image with a message
                                AndHUD.Shared.ShowError(this, result.message, MaskType.Clear, TimeSpan.FromSeconds(2));
                            }
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is Error_Object error)
                        {
                            var errortext = error._errors.Error_text;
                            //Toast.MakeText(this, errortext, ToastLength.Short).Show();

                            if (errortext.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(this);
                            }
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();
                        //Toast.MakeText(this, error, ToastLength.Short).Show();
                    }

                    AndHUD.Shared.Dismiss(this);
                }
                else
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)
                    .Show();
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
                //Show a Error image with a message
                AndHUD.Shared.ShowError(this, e.Message, MaskType.Clear, TimeSpan.FromSeconds(2));
            }
        }
コード例 #20
0
        //Get Photo API
        public async void Get_AlbumUser_Api(string offset = "")
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    RunOnUiThread(() => { swipeRefreshLayout.Refreshing = false; });

                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)
                    .Show();
                    ImagesRecylerView.Visibility = ViewStates.Visible;
                    photos_Empty.Visibility      = ViewStates.Gone;
                }
                else
                {
                    var(Api_status, Respond) = await Client.Album.Get_User_Albums(S_UserId, "35", offset);

                    if (Api_status == 200)
                    {
                        if (Respond is Get_User_Albums_Object result)
                        {
                            RunOnUiThread(() =>
                            {
                                if (result.albums.Count <= 0)
                                {
                                    if (swipeRefreshLayout != null)
                                    {
                                        swipeRefreshLayout.Refreshing = false;
                                    }
                                }
                                else if (result.albums.Count > 0)
                                {
                                    //Bring new groups
                                    var listNew = result.albums.Where(c =>
                                                                      !photosAdapter.mMyAlbumsList.Select(fc => fc.group_id).Contains(c.group_id))
                                                  .ToList();
                                    if (listNew.Count > 0)
                                    {
                                        //Results differ
                                        Classes.AddRange(photosAdapter.mMyAlbumsList, listNew);
                                        photosAdapter.BindEnd();
                                    }
                                    else
                                    {
                                        photosAdapter.mMyAlbumsList =
                                            new ObservableCollection <Get_User_Albums_Object.Album>(result.albums);
                                        photosAdapter.BindEnd();
                                    }
                                }
                            });
                        }
                    }
                    else if (Api_status == 400)
                    {
                        if (Respond is Error_Object error)
                        {
                            var errorText = error._errors.Error_text;
                            //Toast.MakeText(this, errortext, ToastLength.Short).Show();

                            if (errorText.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(this);
                            }
                        }
                    }
                    else if (Api_status == 404)
                    {
                        var error = Respond.ToString();
                        //Toast.MakeText(this, error, ToastLength.Short).Show();
                    }
                }

                //Show Empty Page >>
                //===============================================================
                RunOnUiThread(() =>
                {
                    if (photosAdapter.mMyAlbumsList.Count > 0)
                    {
                        ImagesRecylerView.Visibility = ViewStates.Visible;
                        photos_Empty.Visibility      = ViewStates.Gone;
                    }
                    else
                    {
                        ImagesRecylerView.Visibility = ViewStates.Gone;
                        photos_Empty.Visibility      = ViewStates.Visible;
                    }

                    swipeRefreshLayout.Refreshing = false;

                    //Set Event Scroll
                    if (OnMainScrolEvent == null)
                    {
                        var xamarinRecyclerViewOnScrollListener =
                            new XamarinRecyclerViewOnScrollListener(mLayoutManager, swipeRefreshLayout);
                        OnMainScrolEvent = xamarinRecyclerViewOnScrollListener;
                        OnMainScrolEvent.LoadMoreEvent += MyAlbums_OnScroll_OnLoadMoreEvent;
                        ImagesRecylerView.AddOnScrollListener(OnMainScrolEvent);
                        ImagesRecylerView.AddOnScrollListener(new ScrollDownDetector());
                    }
                    else
                    {
                        OnMainScrolEvent.IsLoading = false;
                    }
                });
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
                Get_AlbumUser_Api(offset);
            }
        }