web metrics
July 2008 - Posts - Technoeuphoria!

July 2008 - Posts

Mix for Students: facebook development with .NET

I did a session on facebook development using the facebook developer toolkit where I also showed how I integrated my Piss Off Silverlight application into a facebook app, which I now call PissBook. I’ve registered the pissbook url but have yet to point it to my app as it seems that facebook isn’t allowing me to save it as “addable” on facebook :(  I forgot to put in the post add URL ^_^

 image

What I did was take this silverlight app:

image

And showed how you can make it work with data from facebook (or any other datasource for that matter). If you are using the default page generated by the Silverlight project, you would have something like:

image

on the Page_Load event, you should then be able to add values from your Request variable, in this case the logged in user name, and the friend’s name which i picked up from facebook’s friend-selector component, and pass these as InitParameters to my Silverlight Application.

image
I then needed to do a bit of tweaking in my App.xaml file on the Application_Startup method where I parsed the initialization Parameters and passed it to the constructor on my Page user control, which is basically my Silverlight application.

image

I then created a new constructor for my Page.xaml, which is more or less the same as the original one, except this accepts some parameters and assigns them to the textboxes in my application:

image

image

A simple application but it basically shows you how you can integrate your Silverlight applications with dynamic datasources through its InitParams property.

 

image

Code and slides are here:

* NOTE: for some reason, when you’re not logged in, facebook gives a 404 when i try to access the app directly from http://apps.facebook.com/facebooksession I’ll update this as soon as I find out a resolution.

this is apparently a 6-month old bug :( http://bugs.developers.facebook.com/show_bug.cgi?id=1406 still unresolved.

Win a Trip to Macau!

image

Send in your submissions now!

//These are one of those moments when I wish I DON’T work at Microsoft hehe

Embed a font

If you want to embed a font into your Silverlight applications, add the font into your project:

image

Set the Build Action file property to embedded resource:

image

Use the following code snippet to use the font as a font source for your components:

Assembly ass = Assembly.GetExecutingAssembly();
Stream stream = ass.GetManifestResourceStream("EmbeddedResource.Font.pricedow.ttf");
this.test.FontSource = new FontSource(stream);
this.test.FontFamily = new FontFamily("Pricedown");

XAML looking something like:

<Grid x:Name="LayoutRoot" Background="White">
    <Canvas>
        <TextBlock x:Name="test" FontFamily="annifont.ttf#Annifont" Text="grand theft auto IV" FontSize="30"/>    
    </Canvas>
    
</Grid>

And the result:

image

Posted by jocelyn | 1 comment(s)
Filed under: ,

Bored to death

It was raining and I was a bit lazy to go home early so I decided to look for something to do. I wanted to try out some of the basic networking stuff with Silverlight and remembered googlefight

image

 

 

I thought it was a simple enough concept to implement so I figured I’d give it a try. I had some time to kill before my 11:00pm conference call. So I came up with “Piss Off!”.

// I have a feeling this won’t be up here for long as it might offend some people :)

This was an exercise for me to try out the Live Search API. Code is found here:

SharePoint and Silverlight

3I did a session for the SharePoint forum held July 1, 2008 and for those who are interested to try out the S+S BluePrints for SharePoint, the samples have so far not been updated to work with Beta 2 yet. So while that’s on the way, and you want to give a hack at trying to get it working yourselves:

1. Follow the steps detailed on this blog on how to configure your server to be able to serve out Silverlight applications. The last step tells you how to add a mime type, but instead of using application/x-silverlight-2-b1, change it to application/x-silverlight-2-b2 instead

2. I haven’t had time to convert the rest of the applications but 3 of them, I’ve managed to convert and upload on my Sky Drive folder

One of the first things you need to do is have the breaking changes document on hand :) This blog post has the link to the breaking changes document as well as some additions and corrections on the document.

You will also need to make an update to the web part project.

There is a line where you’re supposed to specify the Silverlight version in your web part class. The property used to be “.Version”. This was updated to MinumumVersion, which you should then set to “2.0.30523” as below:

silverlightControl.MinimumVersion = "2.0.30523";

Posted by jocelyn | 1 comment(s)