예제 #1
0
        private void PopulateUserProfile()
        {
            try
            {
                var     requestTokenKey    = Session["requesttokenkey"].ToString();
                var     requestTokenSecret = Session["requesttokensecret"].ToString();
                var     verifier           = Request.QueryString["oauth_verifier"];
                MySpace offSiteMySpace     = new MySpace(Constants.ConsumerKey, Constants.ConsumerSecret, requestTokenKey, requestTokenSecret, true, verifier);


                Session["accesstokenkey"]        = offSiteMySpace.OAuthTokenKey;
                Session["accesstokensecret"]     = offSiteMySpace.OAuthTokenSecret;
                Application["accesstokensecret"] = offSiteMySpace.OAuthTokenSecret;

                Session["offSiteMySpace"] = offSiteMySpace;

                var user = (BasicProfile)JsonConvert.Import(typeof(BasicProfile), offSiteMySpace.GetCurrentUser());
                Dictionary <string, string> profileFields = new Dictionary <string, string>();
                // Add Items to UserProfile Class which are to be featched in user profile
                profileFields.Add("fields", "aboutme,age,birthday,books,children,gender,interests,lookingfor,movies,music,profilesong,relationshipstatus,religion,sexualorientation,status,mszodiacsign,currentlocation");
                var profile = (UserProfile)JsonConvert.Import(typeof(UserProfile), offSiteMySpace.GetPerson(user.UserId.ToString(), profileFields));

                offSiteMySpace.GetVideosCategory(user.UserId.ToString(), "11");
                ExtendedP.Text = "My Books are : " + ConvertStringArrayToStringJoin(profile.person.books)
                                 + "<br/>  Intrests:" + ConvertStringArrayToStringJoin(profile.person.interests)
                                 + "<br/>  Movies I Like:" + ConvertStringArrayToStringJoin(profile.person.movies)
                                 + "<br/>  My Music:" + ConvertStringArrayToStringJoin(profile.person.music) + "<br/>  Relationship Status:" + profile.person.relationshipstatus;

                Session["UserID"]     = user.UserId;
                imageProfile.ImageUrl = user.LargeImage;
                lblAge.Text           = profile.person.age;
                lblCity.Text          = profile.person.currentlocation.locality;
                lblCountry.Text       = profile.person.currentlocation.country;
                lblGender.Text        = profile.person.gender;
                lblMarital.Text       = profile.person.relationshipstatus;
                lblName.Text          = user.Name;
                lblProfileUrl.Text    = user.WebUri;
                lblRegion.Text        = profile.person.sexualorientation;
            }
            catch (Exception ex)
            {
                ExtendedP.Text = "An Error occured: " + ex.Message;
            }
        }
예제 #2
0
        private void LoggedIn()
        {
            this.MySpace = new MySpace(Constants.ConsumerKey, Constants.ConsumerSecret, Session["OAuthRequestToken"].ToString(), string.Empty, true, Session["varifier"].ToString());

            var user = (BasicProfile)JsonConvert.Import(typeof(BasicProfile), MySpace.GetCurrentUser());

            Session["userID"] = this.UserId = user.UserId;


            Dictionary <string, string> profileFields = new Dictionary <string, string>();

            profileFields.Add("fields", "aboutme,age,birthday,books,children,gender,interests,lookingfor,movies,music,profilesong,relationshipstatus,religion,sexualorientation,status,mszodiacsign");

            this.ExtendedProfile = (UserProfile)JsonConvert.Import(typeof(UserProfile), this.MySpace.GetPerson(this.UserId.ToString(), profileFields));

            //this.Friends = (FriendProfile)JsonConvert.Import(typeof(FriendProfile), this.MySpace.GetFriends(this.UserId.ToString(), profileFields));

            Dictionary <string, string> resultformat = new Dictionary <string, string>();

            resultformat.Add("format", "xml");

            this.FriendActivities = XDocument.Parse(this.MySpace.GetFriendsActivities(this.UserId.ToString(), resultformat));
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["offSiteMySpace"] != null)
            {
                try
                {
                    MySpace myspaceClient = (MySpace)Session["offSiteMySpace"];
                    var     user          = (BasicProfile)JsonConvert.Import(typeof(BasicProfile), myspaceClient.GetCurrentUser());
                    Dictionary <string, string> profileFields = new Dictionary <string, string>();
                    // Add Items to UserProfile Class which are to be featched in user profile
                    profileFields.Add("fields", "aboutme,age,birthday,books,children,gender,interests,lookingfor,movies,music,profilesong,relationshipstatus,religion,sexualorientation,status,mszodiacsign,currentlocation");
                    var profile = (UserProfile)JsonConvert.Import(typeof(UserProfile), myspaceClient.GetPerson(user.UserId.ToString(), profileFields));



                    Session["UserID"]     = user.UserId;
                    imageProfile.ImageUrl = user.LargeImage;
                    lblAge.Text           = profile.person.age;
                    lblCity.Text          = profile.person.currentlocation.locality;
                    lblCountry.Text       = profile.person.currentlocation.country;
                    lblGender.Text        = profile.person.gender;
                    lblMarital.Text       = profile.person.relationshipstatus;
                    lblName.Text          = user.Name;
                    lblProfileUrl.Text    = user.WebUri;
                    lblRegion.Text        = profile.person.sexualorientation;

                    PopulateVideos(myspaceClient, user.UserId.ToString());
                }
                catch (Exception ex)
                {
                    divPhotos.InnerHtml = "An Error occured: " + ex.Message;
                }
            }
            else
            {
                Response.Redirect("/default.aspx");
            }
        }
예제 #4
0
        private void PopulateUserProfile()
        {
            if (State.OAuthOpenID != null)
            {
                var verifier      = Request.QueryString["oauth_verifier"];
                var myspaceClient = new MySpace(Constants.ConsumerKey, Constants.ConsumerSecret, State.OAuthOpenID.RequestToken, string.Empty, true, verifier);;
                var user          = (BasicProfile)JsonConvert.Import(typeof(BasicProfile), myspaceClient.GetCurrentUser());
                Dictionary <string, string> profileFields = new Dictionary <string, string>();
                // Add Items to UserProfile Class which are to be featched in user profile
                profileFields.Add("fields", "aboutme,age,birthday,books,children,gender,interests,lookingfor,movies,music,profilesong,relationshipstatus,religion,sexualorientation,status,mszodiacsign");

                var profile = (UserProfile)JsonConvert.Import(typeof(UserProfile), myspaceClient.GetPerson(user.UserId.ToString(), profileFields));

                Session["UserID"]     = user.UserId;
                imageProfile.ImageUrl = user.LargeImage;
                lblAge.Text           = profile.person.age;
                lblCity.Text          = profile.person.currentlocation.locality;
                lblCountry.Text       = profile.person.currentlocation.country;
                lblGender.Text        = profile.person.gender;
                lblMarital.Text       = profile.person.relationshipstatus;
                lblName.Text          = user.Name;
                lblProfileUrl.Text    = user.WebUri;
                lblRegion.Text        = profile.person.sexualorientation;

                PopulatePhotos(myspaceClient, user.UserId);
            }
        }