コード例 #1
0
ファイル: HistoryPage.xaml.cs プロジェクト: netcharm/PixivWPF
 public void AddToHistory(Pixeez.Objects.UserBase user)
 {
     if (HistoryItems.Items is ObservableCollection <PixivItem> )
     {
         Application.Current.HistoryAdd(user, HistoryItems.Items);
         UpdateDetail();
     }
 }
コード例 #2
0
        public static async Task <Pixeez.Objects.UserBase> GetAjaxUserProfile(this long id, Pixeez.Tokens tokens = null)
        {
            Pixeez.Objects.UserBase result = null;
            if (tokens == null)
            {
                tokens = await CommonHelper.ShowLogin();
            }
            if (tokens == null)
            {
                return(result);
            }

            var url       = GetAjaxUserProfileUrl(id);
            var json_text = await Application.Current.GetRemoteJsonAsync(url);

            if (!string.IsNullOrEmpty(json_text))
            {
                try
                {
                    var user = JToken.Parse(json_text).ToObject <AjaxUserProfileData>();
                    if (!user.Error)
                    {
                        var profile = user.Profile;
                        if (profile is AjaxUserProfile)
                        {
                            var user_profile = new Pixeez.Objects.Profile();
                            user_profile.Contacts = new Pixeez.Objects.Contacts();
                            //user_profile.id

                            //result = profile.user;
                        }
                    }
                }
                catch (Exception ex) { ex.ERROR("GetAjaxUserProfile"); }
            }
            return(result);
        }
コード例 #3
0
        public static async Task <Pixeez.Objects.UserBase> GetAjaxUser(this long id, Pixeez.Tokens tokens = null)
        {
            Pixeez.Objects.UserBase result = null;
            if (tokens == null)
            {
                tokens = await CommonHelper.ShowLogin();
            }
            if (tokens == null)
            {
                return(result);
            }

            var url       = GetAjaxUserUrl(id);
            var json_text = await Application.Current.GetRemoteJsonAsync(url);

            if (!string.IsNullOrEmpty(json_text))
            {
                try
                {
                    var user = JToken.Parse(json_text).ToObject <AjaxUserData>();
                    if (!user.Error)
                    {
                        var info = await tokens.GetUserInfoAsync(id.ToString());

                        if (info is Pixeez.Objects.UserInfo)
                        {
                            info.Cache();
                            info.user.Cache();
                            result = info.user;
                        }
                    }
                }
                catch (Exception ex) { ex.ERROR("GetAjaxUser"); }
            }
            return(result);
        }