The power of MVVM…

Everyone, and by that I mean anyone that has been coding for more than a year, talks about decoupling and layers. It’s all about building an n-tier architecture, and about decoupling the layer so that they can be changed later on.

And however much I understand this, and like it, and use it, I still argue that it is sometimes overkill. And even though I definitely can argue both sides of this topic, I am not even going to get started doing so. Maybe I will in a later post, when I feel like getting flamed… :)

This post is about how decoupling your view from your view logic using MVVM can really be helpful. And I am not going to talk about how unit testing will help or anything like that. I am going to explain why MVVM is more important than just testing by showing an example…

More...

Accessing Azure Development Storage from Silverlight

I have recently worked on several projects that have been built to utilize the Microsoft cloud platform called Azure. Azure offers a lot of really interesting benefits, and especially when it comes to being elastic. You can basically throw however much data you want at it, and as long as you are willing to pay for it, it will handle it. It doesn’t matter if you throw data at it that needs to be computed, or if you throw vast amounts of data that needs to be stored. Azure will handle it for you.

On top of that, it is really easy to build for. There isn’t really a whole lot to learn before one can get up and running in the cloud. Microsoft even offers a sweet SDK that gives you access to the cloud based services locally on your machine. It offers you the ability to deploy your webroles (web applications) straight to a local “cloud” and debug it. So you don’t even need to have an Azure account to starting to work with it.

More...

Code for the SLAMD session tonight

Tonight, I presented a talk about MVVM “in the real world” at the Silverlight and Mobile Developer user group on Wellington.

For those of you who were there, I am sorry that it wasn’t better organized. I just ended up with way too much work the last 2 weeks, so I didn’t have enough time to structure it all enough. I decided that it was more important to get the code built than to have a  lot of PowerPoint slides.

As I did promise, I you can download the code below and I have also added the IDispatchService that I talked about as well. It will give you the ability to marshal execution back to the UI thread from a ViewModel. Just call IDispatchService.BeginInvoke() and pass in a lambda expression or a method to execute on the UI thread.

For those of you who weren’t at the user group, or were there and thought that what I said was completely impossible to understand, I just want to explain what is in the download.

More...

Windows Phone 7 Push Notifications Revisited

A couple of weeks ago…ehh…well…let’s at least call it a couple of weeks ago (it might have been longer to be honest) I posted a blog post about using push notification on the Windows Phone 7 platform. It included more or less everything you needed to start sending push notifications on the pre-beta version of the platform.

However, about a week ago (once again…+- a couple of days) Microsoft released the new beta version of the developer tools as well as the emulator. And I assume they also pushed I to the lucky bastards that already have phones.

In this new beta, they have changed the API for the notifications, and hence destroyed my previous code. So I have updated my sample to use the new tools and the new APIs. So here I go again…

More...

Using Windows Phone 7 Push Notifications

Windows Phone 7 is still not released, and the APIs, SDK, emulator and so on is till far from complete. Having said that, people are still getting revved up about the platform and have already started to develop on it. I think this is cool, and makes me believe that there will be some really good apps on the market place already on the launch day. Unfortunately, I have been too busy to get too down a dirty with it. I definitely hope to change this, and have decided to build a game. Hopefully it will be complete by launch and I can sell 2 or 3 copies.

But, to be honest, I still feel that the SDK and APIs are changing a bit too much for me to get REALLY excited about it. I really hope that there is a new refresh on the way soon. Cause at the present, I find that there are just too many unknown things that make the development hard. You never know if the issue you are experiencing is due to you doing something wrong or due to a bug in the OS. And if it is a bug in the OS, you don’t really know when or how it will be fixed. And I really don’t want to spend my time working around things now, just to end up with weird an unnecessary workarounds in the code when the final version is released. Having said that, it still doesn’t stop you from playing around with the platform. I can still build most of my game logic and even test it in the browser based version of Silverlight while I wait for the next refresh. One feature that I wanted to try out straight away however is the push notification. Why? Well…let’s just say that I have my reasons…

More...

I got to leave my mark on TechEd US

As you probably know, TechEd US has just passed. I didn’t get to go (like always), but I did get to make my mark on the conference. I got to build one of the apps that Microsoft demoed on stage. I have actually built a bunch of demo apps for Microsoft and their conferences the last year. At some point, I will actually try to find them at some point a post some videos of them here. But they involve a CRM demo with a phone company, a SharePoint demo with a racing team and some other bits and pieces. Anyhow…this year my demo was a Word add-in, and my personal opinion about this project, before it got started, was that it sucked. I I’m not very fond of building Word add-ins as you might have guessed.

More...

Windows Phone 7 Training

The day before yesterday I was part of a Windows Phone 7 training day here in Wellington, New Zealand. Most of the day was presented by Nigel Parker, Web Development Advisor for Microsoft New Zealand, but I got to present some code demos for the attending developers. At the training, I promised to upload my sample code, so I did. But I also added some of my thoughts after the event. Sorry…

More...

Cool INotifyPropertyChanged implementation

While working on a little MVVM thingy the other day, I ran into a sweet little piece of code that I wanted to share. I have seen several version of this around the web, but this is where I found this particular version. The piece of code gets rid of the ugly part of the INotifyPropertyChanged interface. The part where you use strings to identify what property has changed. I understand that that is how you have to do it, but it feels messy. A common solution is to add constants to hold the strings, but that is not a very much better solution. it is still messy. So how can we handle it in a safe way? Well…one idea would be to do it like this…

More...

Subtitling videos

A couple of weeks ago, Microsoft asked me to add closed captioning to the videos on the www.office2010themovie.com. And no…not automated subtitles that converts to what is said into text, like YouTube does…just subtitles from a file. This is not very complicated, not even when you add the fact that the videos are actually being streamed using Smooth Streaming. But I wanted roll it al into a control, to make it fast and easy to add subtitles to any MediaElement in future projects…

More...

Using SharePoint thmx files to style Silverlight

A couple of weeks ago, I requested to build a code sample for Microsoft. It was supposed to make it possible to restyle a Silverlight application based on a SharePoint 2010 theme. In SharePoint 2010, theming is based on OpenXML, and saved as files with an extension of “thmx”.

But I guess the first question would be WHY you would use a huge thmx file just to restyle a Silverlight application… Well, imagine that you are building Silverlight applications that are to be used inside a SharePoint application. Imagine how nice it would be if the Silverlight applications would change appearance if you changed the theme of the SharePoint site. That way, changing the theme would not be a problem, and would not cause a whole lot of rework.

More...