Friday, September 21, 2007

Bookvar meets Facebook. Introducing FaceBookvar ;)

What I really like about our mind mapping tool Bookvar is its high extensibility model. You can not only create your own custom skin, but you can develop custom functionality using our add-in model.

Bookvar add-ins

Bookvar's add-ins model is build on newly created (and not yet released) .NET Framework 3.5 Add-in model. You can read more about it on the MSDN Magazine (1, 2) or on the add-ins team blog. Basically the idea is that the whole add-in lifecycle is managed by the framework and only you have to provide is hook where add-in developers can put their custom, domain specific logic. In our case this is done by deriving from our base view classes (more on add-ins views and adapters here) and marking the class with the AddIn attribute.

 [AddIn("Bookvar Facebook AddIn", Version = "1.0.0.0")]

 public class FacebookAddin : EditableBookvarAddinView

 {

   public override Topic Execute(Topic topic)

   {

Building sample add-in - The Idea

Recently I'm spending more and more time on Facebook. You may be familiar that Facebook is not only a social networking site, but it is also a platform. So what that this means? It means that your whole social network that you have build in Facebook can be access programmatically. Did you figure out my idea yet? Yes that's right. I have decided to create an add-in that will visualize your friends in the form of mind map with you at the center.

Time estimate

My initial estimate for the add-in was 2 hours and I hope will finish within maximum of 3 hours. As it always happens in software industry I finished it within 6 hours ;) But if it straight forward what why it took me so long to do this? Let me explain you.

Facebook.NET

I have previously research about .NET libraries build for Facebook and have found these two - Facebook Developer's Toolkit and Facebook.NET both open source and hosted on CodePlex. The first one is build by Clarity Consulting for the Microsoft Visual Studio Express Team. The second is build by Nikhil Kothari. Knowing that Nikhil is an architect at ASP.NET team I was pretty sure that I will use his stuff. I did look at both libraries source codes and after reading this one I was convinced I will use Facebook.NET (more info about it here).

Sometimes shit happens, sometimes more frequently

So far so good. But then the problems occurred. As one of my colleagues used to say: Sometimes shit happens, sometimes more frequently. First the Facebook.NET library comes with a windows forms control that you can use in your project to log into Facebook (Facebook did not have an authentication API). This is good, but Bookvar is build on WPF and it is not trivial to integrate windows form control in WPF app that is using the new add-in model. So what I first did is extending Nikhil's code with a WPF control that has the same functionality. It worked (Nikhil I can send you the sources), but I decide to try using his windows forms control. I first try to use WindowsFormsHost, but then figure it out it want to the job, because I needed to host user control. Googling around I find this solution that did the job the way I needed. Another problem came out when I tried to play smart and reuse the application ID and secret key of Facebook Developer's toolkit library for interfacing with Facebook. These keys are given to you when you register your application at Facebook. Apparently I receive some problems with logging into the system using Nikhil's control. After some debugging the problem was found and I registered Bookvar as an application in Facebook. Conclusion: Don't try to play smart when you are interacting with third parties. Play by their rules and execute each step in their guides.

Result - demo of the add-in

You can see the final result in this short screencast:

Next steps: source code and custom add-in development

Are you interested in the source code? It will be publicly available when we launch our site and the first public release of Bookvar. If you are eager to look at it you can drop me an email or face

book me :)

Are you interested in creating your own custom add-ins? If you want to try the new .NET add-in model and build the best of breed Bookvar add-ins again you have to wait for our site to become live, where we will have a whole section for dedicated to developers.

While you are waiting for the public beta release of Bookvar my suggestion is to have fun in Facebook and expand your network.

Conclusion - better together

Facebook is a great platform that offers new kind of applications and distribution channel. Stay tuned to see what ideas we have in this space.

Bookvar is a interactive tool that allow you to express your thoughts and data in a way you have never used before.

3 comments:

metallman said...

really very very good post with a lot of helpful resources :-) I'm eager to see a full version of the bookvar :-) i think it will hit down all other mind mapping tools :-) keep on improving bookvar guys

Nikhil Kothari said...

Great to hear you're using Facebook.NET.

Feel free to ping me via my contact form on my page. I'd love to see what you had to do to make it work better with WPF, and if appropriate extend Facebook.NET to directly cater to the WPF scenario.

Anonymous said...

Who knows where to download XRumer 5.0 Palladium?
Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!