The ball

Facebook, C# and ASP.NET MVC – Code samples for friends list, activities list and wall posts

August 11, 2010 by onishimura · 5 Comments
Filed under: .NET, ASP.NET MVC, Facebook 

A few weeks back I wrote about the official C# SDK from Facebook and provided some sample code demonstrating how to use it to get some basic information about the logged in user. Admittedly the initial sample asp.net mvc code was fairly simple in order for it to be straight forward and easy to understand. I’ve decided to expand a bit on the sample in order to demonstrate how to use the Open graph API to perform a few more interesting calls, notably:

  • Post to a user’s wall
  • Retrieve a list of the user’s friends
  • Retrieve a list of the user’s activities

The original sample code demonstrated how to authenticate a user and make calls using both the official C# sdk and a home grown solution. I’ve kept that approach but have organized and refactored the samples a bit better to make it hopefully more clear. The new version of the sample code allows you to login/out to facebook only on the home page. Once logged in you can go to the ‘Official’ and ‘Custom’ tabs to view your friends, activities or to post a message to your wall. While the functionality is the same between the two tabs, the code behind them is different. I assume most people would use the official SDK but I provided an alternative just as a point of interest. OK, I was bored really, and just wanted to see how it could be done differently.

Read more

Windows Phone 7 Tutorial – Creating a simple notes app with Silverlight Part 3

July 29, 2010 by onishimura · 2 Comments
Filed under: .NET, Silverlight, Windows Phone 7 

This is part 3 in a 3 part tutorial for creating a notes application using Silverlight and Windows Phone 7. The previous articles can be read here
Windows Phone 7 Tutorial – Creating a simple notes app with Silverlight Part 1
Windows Phone 7 Tutorial – Creating a simple notes app with Silverlight Part 2

Download the code here

Currently our application can display a list of notes, and create and save a new note. The last piece of the puzzle is to allow the user to delete an existing note. To accomplish this all we really need to do is add an application bar button to the details page, remove it from the working items list, and save it to isolated storage.

  1. Add the appbar.save.rest.png image in C:\Program Files\Microsoft SDKs\Windows Phone\v7.0\Icons to the Images folder in the project, and set it’s ‘Build Action’ to Content’, and it’s ‘Copy to Output Directory’ proerpty to ‘Copy if newer’.
  2. Read more

Windows Phone 7 Tutorial – Creating a simple notes app with Silverlight Part 2

July 27, 2010 by onishimura · Leave a Comment
Filed under: .NET, Silverlight, Windows Phone 7 

This is part 2 in a 3 part tutorial for creating a notes application using Silverlight and Windows Phone 7. The other articles can be read here
Windows Phone 7 Tutorial – Creating a simple notes app with Silverlight Part 1
Windows Phone 7 Tutorial – Creating a simple notes app with Silverlight Part 3

In part one of the tutorial we created the project, added a new Note class to serve as our model, and added a StorageHelper class to help us manage IsolatedStorage. The next step is to add support for adding a note to the app. We’ll keep it simple and just use a button on the main page’s application bar to add a note. When a user clicks the add note button on the main page, a new Windows Phone 7 page will load, which will enable the user to enter a note title and note text. They’ll also be able to save the note, or cancel the save, which will return them to the main page.

Read more

Windows Phone 7 Tutorial – Creating a simple notes app with Silverlight Part 1

July 25, 2010 by onishimura · Leave a Comment
Filed under: .NET, Silverlight, Windows Phone 7 

This is part 1 in a 3 part tutorial for creating a notes application using Silverlight and Windows Phone 7. The other articles can be read here
Windows Phone 7 Tutorial – Creating a simple notes app with Silverlight Part 2
Windows Phone 7 Tutorial – Creating a simple notes app with Silverlight Part 3

Admittedly a bouncing ball on Windows Phone 7 isn’t all that useful, so I decided to create a sample application that could do a little more than draw a ball or say ‘hello world’. Ideally I wanted to work with some of the core concepts on the phone, such as lists, navigation and the application bar. Additionally I wanted a Windows Phone 7 app that persisted it’s data, which meant working with Isolated Storage. Obviously this calls for a note-taking app…after all who doesn’t love taking notes? Notes are only second to bouncing balls in my book.

To keep the scope of the app small and focused, I wanted the note app to do only the following

  • View a list of notes
  • Add a note
  • Delete a note

Read more

Windows Phone 7 – List of Tutorials and Resources

July 22, 2010 by onishimura · 2 Comments
Filed under: Silverlight, Windows Phone 7, XNA 

Following up on yesterday’s post on Windows Phone 7 development, here’s a few of the tutorials and guides I’ve been looking at the past few days. There’s a lot of info to digest so I’ll be adding to this post as I come across more resoucres.

Tutorials and Samples

Read more

Windows Phone 7 and Silverlight – Getting started with a Bouncing Ball

July 20, 2010 by onishimura · 1 Comment
Filed under: Silverlight, Windows Phone 7 

The beta of the developer tools for Windows Phone 7 was released last week. I was curious to see how different/easy it was to develop for this platform so I decided to convert my old SL 3 bouncing ball app, done AGES ago, to Silverlight 4 and Windows Phone 7. The process was pretty painless and even allowed me to add a few features:

1. Install the tools from http://www.microsoft.com/downloads/details.aspx?FamilyID=c8496c2a-54d9-4b11-9491-a1bfaf32f2e3&displaylang=en if you haven’t already

2. Create a new Windows Phone Application (from templaes: Visual C# – Silverlight for Windows Phone – Windows Phone Application)

Read more

Facebook C# – Sample ASP.NET application and access tokens

July 19, 2010 by onishimura · Leave a Comment
Filed under: .NET, ASP.NET, Facebook 

Put together another quick sample app, this time for ASP.NET 4.0, instead of MVC.
I’ve also added an example of how to post to a user’s wall, using the Facebook C# SDK

Facebook ASPNET Sample

Read more

Official Facebook C# SDK Released

July 17, 2010 by onishimura · 6 Comments
Filed under: ASP.NET MVC, Facebook 

Looks like a brand new SDK to play with for facebook. While they have other sdks for python, php, javascript, etc, this is their first official C# SDK. Previously the primary SDK that was available was the Facebook Developers Toolkit, which hasn’t been updated in some time (and hasn’t been updated to support the open graph api as far as I can tell).

You can grab the code from github at http://github.com/facebook/csharp-sdk.

Read more

Fixing Facebook IE problems

July 14, 2010 by onishimura · Leave a Comment
Filed under: Facebook 

A friend of mine ran into this IE problem recently and it reminded me of one of the early snags I hit when developing a facebook application with the Open Graph API. IE is much more finicky about cross domain requests than other browsers, which can cause issues when authenticating with Facebook. The primary symptom of this problem is that a user can login to your site using the Facebook login button and firefox or chrome, but cannot log in via IE. The trick is that you need to also set the Base Domain field to handle multiple subdomains. So, if your Connect URL was http://www.somesite.com/, you’d set your Base Domain field to somesite.com.

Read more

Converting a Facebook Connect site to Open Graph step by step

June 7, 2010 by onishimura · 2 Comments
Filed under: Facebook 

A few weeks back I decided to upgrade one of my web apps to the Open Graph API. Previously it was running on Facebook Connect and using the Facebook Developers Toolkit on the backend. This still works fine, but it always felt like over kill. The simplicity of the new Open Graph api is compelling, and implementing it was pretty straight forward.

Read more

Next Page »