示例#1
0
        public async void Get_MyChanne_Info_Api()
        {
            try
            {
                if (!CrossConnectivity.Current.IsConnected)
                {
                    await DisplayAlert(AppResources.Label_Error, AppResources.Label_Check_Your_Internet, AppResources.Label_OK);
                }
                else
                {
                    Classes.MyChannelList.Clear();
                    Classes.VideoByMyChannelList.Clear();

                    var data_Channel = await API_Request.Get_Channel_Info_Http(API_Request.User_id);

                    if (data_Channel != null)
                    {
                        JObject Items = JObject.FromObject(data_Channel);

                        Classes.Channel ch = new Classes.Channel();

                        string id         = Items["id"].ToString();
                        string username   = Items["username"].ToString();
                        string email      = Items["email"].ToString();
                        string first_name = Items["first_name"].ToString();
                        string last_name  = Items["last_name"].ToString();
                        string gender     = Items["gender"].ToString();
                        string language   = Items["language"].ToString();
                        string avatar     = Items["avatar"].ToString();
                        string cover      = Items["cover"].ToString();
                        string about      = "";
                        try
                        {
                            about = Functions.StringNullRemover(Functions.DecodeStringWithEnter(Functions.DecodeString(Items["about"].ToString())));
                        }
                        catch (Exception ex)
                        {
                            var exception = ex.ToString();
                        }
                        string google   = Functions.StringNullRemover(Items["google"].ToString());
                        string facebook = Functions.StringNullRemover(Items["facebook"].ToString());
                        string twitter  = Functions.StringNullRemover(Items["twitter"].ToString());
                        string verified = Items["verified"].ToString();
                        string is_pro   = Items["is_pro"].ToString();
                        string url      = Items["url"].ToString();

                        ch.Channel_id         = id;
                        ch.Channel_username   = username;
                        ch.Channel_email      = email;
                        ch.Channel_first_name = first_name;
                        ch.Channel_last_name  = last_name;
                        ch.Channel_gender     = gender;
                        ch.Channel_language   = language;
                        ch.Channel_avatar     = avatar;
                        ch.Channel_cover      = cover;
                        ch.Channel_about      = about;
                        ch.Channel_google     = google;;
                        ch.Channel_facebook   = facebook;
                        ch.Channel_twitter    = twitter;
                        ch.Channel_verified   = verified;
                        ch.Channel_is_pro     = is_pro;
                        ch.Channel_url        = url;


                        if (Settings.DarkTheme)
                        {
                            ch.SC_BackgroundColor = "#bcbcbc";
                            ch.SC_TextColor       = "#ffff";
                        }
                        else
                        {
                            ch.SC_TextColor       = "#444";
                            ch.SC_BackgroundColor = "#ffff";
                        }

                        Avatar       = avatar;
                        URl          = url;
                        Id_MyChannel = id;

                        Classes.MyChannelList.Add(ch);

                        //Insert Or Update data at database
                        SQL_Commander.InsertOrUpdate_DataMyChanne_Credentials(ch);

                        AddlistItems();
                        MyVidoesListView.EndRefresh();
                    }
                    else
                    {
                        MyVidoesListView.EndRefresh();
                    }
                }
            }
            catch (Exception ex)
            {
                var exception = ex.ToString();
                MyVidoesListView.EndRefresh();
            }
        }