Facebook Friends Live Collection
Yesterday, I presented you with a demo video of my Facebook Friends Collection for Pivot. Today, I have a live collection for you to play with. (Please note that Pivot is required)
Improved Facebook Friend Demo (I can't seem to get it to run on IIS as GoDaddy has it configured. This is most likely due to the inability to add MIME types. On the plus side, kudos to the Pivot team for this, as it makes it so a LAMP environment can easily serve it up.)
To make the application work, I have developed an easy-to-use method for turning almost any class in to a collection. This method was utilized in the example below, which shows the inner workings of Facebook Friends.
{
private List _books = new List();
private List _activities= new List();
private List _interests = new List();
private List _movies= new List();
private List _music = new List();
private List _tv= new List();
[PivotItem(IsName = true)]
public string Name { get; set; }
[PivotItem(IsDescription = true)]
public string Desc { get; set; }
[PivotItem(FacetDisplayName = "Books", FacetType = FacetTypes.String, IsFacet = true,IsCollection = true)]
public List Books
{
get { return _books; }
set { _books = value; }
}
[PivotItem( IsImage = true)]
public string Image { get; set; }
[PivotItem(FacetDisplayName = "Gender", FacetType = FacetTypes.String, IsFacet = true)]
public string Sex { get; set; }
[PivotItem(FacetDisplayName = "Relationship Status", FacetType = FacetTypes.String, IsFacet = true)]
public string RelationshipStatus { get; set; }
[PivotItem(FacetDisplayName = "Political Views", FacetType = FacetTypes.String, IsFacet = true)]
public string PoliticalViews { get; set; }
[PivotItem(FacetDisplayName = "Birth Date", FacetType = FacetTypes.String, IsFacet = true)]
public string BirthDate { get; set; }
[PivotItem(FacetDisplayName = "Activities", FacetType = FacetTypes.String, IsFacet = true, IsCollection = true)]
public List Activities
{
get { return _activities; }
set { _activities = value; }
}
[PivotItem(FacetDisplayName = "TV Shows", FacetType = FacetTypes.String, IsFacet = true, IsCollection = true)]
public List Tv
{
get { return _tv; }
set { _tv = value; }
}
[PivotItem(FacetDisplayName = "Music", FacetType = FacetTypes.String, IsFacet = true, IsCollection = true)]
public List Music
{
get { return _music; }
set { _music = value; }
}
[PivotItem(FacetDisplayName = "Movies", FacetType = FacetTypes.String, IsFacet = true, IsCollection = true)]
public List Movies
{
get { return _movies; }
set { _movies = value; }
}
[PivotItem(FacetDisplayName = "Intrests", FacetType = FacetTypes.String, IsFacet = true, IsCollection = true)]
public List Interests
{
get { return _interests; }
set { _interests = value; }
}
}
In order to populate the collection, I do something like this:
<span>// </span>In this space, there are about forty (40) lines of code that pull the data out of the Facebook API from CodePlex
<span>// and put it in to an instance of the above class. Then I add the data to the collection as follows:</span>
friends.Items.Add(facebookUserInstance);
friends.CollectionName = "Facebook Friends";
friends.WriteCollectionToFileSystem("test1.cxml");
<span>// </span><span>Next, I run the two command line tools for converting my friends' pictures into deep-zoom images and voila! It is done!</span>
I will be posting the Project for how the above works once the source code is cleaned up a bit and I am able to provide better documentation.
If you would like a copy of it before then, feel free to ask. I would be happy to send it to you if you post a comment requesting it.






































