Friday, May 16, 2008

Silverlight Streaming and Isolated Storage

Microsoft is really pushing to enhance their presence online with Silverlight. A service that they provide for people is part of the Live.com site. Microsoft Silverlight Streaming is a Silverlight app and media hosting site that Microsoft provides with 10G of online space. This is a free service from them.

With Silverlight 2.0 beta1, the app compiles into an .xap file that can be uploaded to the Streaming service I went over this in a previous post. To test this out I made a small sample of a TicTacToe game. I got lazy and made it use colors instead of graphics for each square. I also just had the computer pick a random empty square to make things simpler. One thing that I wanted to test out was the isolated storage so that you could keep track of your scores locally on the machine since this is a web-based app. It was pretty easy to setup IsolatedStorage to save this data using a stream writer. IsolatedStorage is very limted, but for this example I am only storing 3 ints, so I was not worried.

One interesting thing is that a Technical Evangelist from Microsoft (who will remain nameless) said that you could not store data locally using a Silverlight application. During his MSDN Roadshow, I pointed out that actually you could do that and he was abit surprised. Of course then he stated that Microsoft might just remove that ability plus it is very limited storage, so to be careful with it.



People always ask for source code for samples like this, so here is the source. Now, I know this little game is not that exciting, but it's Silverlight, with local storage, and using the Silverlight Streaming site, so that is what is cool.

No comments: