コード例 #1
0
 private void _UpdateCoverPic()
 {
     if (_coverPic != null)
     {
         _coverPic = null;
         _NotifyPropertyChanged("CoverPic");
     }
 }
コード例 #2
0
        public string[] GetWordsFromPhoto(FacebookPhoto photo, FacebookPhotoAlbum album)
        {
            if (photo == null)
            {
                return(null);
            }

            return(GetWords(photo.Caption, (album.Owner != null) ? album.Owner.Name : ""));
        }
コード例 #3
0
 private void IndexTags(FacebookPhoto photo)
 {
     if (photo.Tags != null)
     {
         foreach (FacebookPhotoTag tag in photo.Tags)
         {
             string[] words = GetWordsFromTag(tag);
             MergeForwardIndexItem(photo, words);
         }
     }
 }
コード例 #4
0
        private FacebookPhoto _DeserializePhoto(JSON_OBJECT jsonPhoto)
        {
            Uri linkUri   = _SafeGetUri(jsonPhoto, "link");
            Uri sourceUri = _SafeGetUri(jsonPhoto, "src");
            Uri smallUri  = _SafeGetUri(jsonPhoto, "src_small");
            Uri bigUri    = _SafeGetUri(jsonPhoto, "src_big");

            var photo = new FacebookPhoto(_service)
            {
                PhotoId = _SafeGetId(jsonPhoto, "pid"),
                AlbumId = _SafeGetId(jsonPhoto, "aid"),
                OwnerId = _SafeGetId(jsonPhoto, "owner"),
                Caption = _SafeGetString(jsonPhoto, "caption"),
                Created = _SafeGetDateTime(jsonPhoto, "created") ?? _UnixEpochTime,
                Image   = new FacebookImage(_service, sourceUri, bigUri, smallUri, null),
                Link    = linkUri,
            };

            return(photo);
        }
コード例 #5
0
        public FacebookPhoto GetPhoto(string photoId)
        {
            _Verify();

            var photoMap = new METHOD_MAP
            {
                { "method", "photos.get" },
                { "pids", photoId },
            };

            string result = Utility.FailableFunction(() => _SendRequest(photoMap));

            List <FacebookPhoto> response = _jsonSerializer.DeserializePhotosGetResponse(result);

            FacebookPhoto photo = response.FirstOrDefault();

            Assert.IsNotNull(photo);

            return(photo);
        }
コード例 #6
0
        public object[] GetRelevantFacebookObjects(object o)
        {
            List <object> objects = new List <object>();

            FacebookContact contact = o as FacebookContact;

            if (contact != null)
            {
                foreach (var post in _service.RawNewsFeed)
                {
                    if (post.ActorUserId == contact.UserId)
                    {
                        objects.Add(post);
                    }

                    foreach (var comment in post.Comments)
                    {
                        if (comment.FromUserId == contact.UserId)
                        {
                            objects.Add(comment);
                        }
                    }
                }

                foreach (var album in _service.RawPhotoAlbums)
                {
                    if (album.OwnerId == contact.UserId)
                    {
                        objects.Add(album);
                    }

                    foreach (var photo in album.Photos)
                    {
                        if (photo.OwnerId == contact.UserId)
                        {
                            objects.Add(photo);
                            continue;
                        }

                        foreach (var tag in photo.Tags)
                        {
                            if (tag.Contact != null && tag.Contact.UserId == contact.UserId)
                            {
                                objects.Add(photo);
                                goto next;
                            }
                        }

                        next :;
                    }
                }
            }

            FacebookPhoto p = o as FacebookPhoto;

            if (p != null)
            {
                objects.Add(p.Album);

                if (p.Album.Owner != null)
                {
                    objects.Add(p.Album.Owner);
                }

                foreach (var tag in p.Tags)
                {
                    if (tag.Contact != null && !objects.Contains(tag.Contact))
                    {
                        objects.Add(tag.Contact);
                    }
                }
            }

            FacebookPhotoAlbum a = o as FacebookPhotoAlbum;

            if (a != null)
            {
                if (a.Owner != null)
                {
                    objects.Add(a.Owner);
                }

                foreach (var photo in a.Photos)
                {
                    objects.Add(photo);

                    foreach (var tag in photo.Tags)
                    {
                        if (tag.Contact != null && !objects.Contains(tag.Contact))
                        {
                            objects.Add(tag.Contact);
                        }
                    }
                }
            }

            ActivityPost activityPost = o as ActivityPost;

            if (activityPost != null)
            {
                if (activityPost.Actor != null)
                {
                    objects.Add(activityPost.Actor);
                }

                if (activityPost.Target != null)
                {
                    objects.Add(activityPost.Target);
                }

                foreach (var comment in activityPost.Comments)
                {
                    objects.Add(comment);
                }
            }

            ActivityComment activityComment = o as ActivityComment;

            if (activityComment != null)
            {
                if (activityComment.FromUser != null)
                {
                    objects.Add(activityComment.FromUser);
                }
            }

            objects.Sort(new SearchResultsComparer());
            return(objects.ToArray());
        }
コード例 #7
0
 public string[] GetWordsFromPhoto(FacebookPhoto photo)
 {
     return(GetWordsFromPhoto(photo, photo.Album));
 }