techno techno - 1 year ago 181
C# Question

Creating a FaceBook Like Button for C# Winforms Desktop Application

I want to link my winforms application to Facebook fanpage,So that a +1 is added when the user clicks the Like button on the Form .How can do it in C# winforms.Is it possible by invoking a URL.

Answer Source

You can get some LIKE button code: http://developers.facebook.com/docs/reference/plugins/like/ it will give you a few options, then you have a choice of delivery formats - choose IFRAME.

you'll get something that looks like this:

<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.webbod.info&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true">
</iframe>

You are only interested in the src and the dimensions.

In your winforms application you can host a webbrowser control size it to the dimensions and point it at the src - this will give you an embedded facebook like button.

Facebook allows people to Like URLs, so you'll need to provide one - in my example it's www.webbod.info, but anything should do and by varying the href part of the src url you can let people like any part of the application.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download