11 February, 2011

WP7: Enum.GetNames not present?

It has really been a source of great pain, that “someone” forgot to put in the Enum.GetNames() method in the SL-subset of .NET. Only the Enum.GetName() is present!

Anyway – a utility class I found in a blog comment somewhere came in quite handy:

public class Enum<T>
public static IEnumerable<string> GetNames()
var type = typeof(T);

if (!type.IsEnum)
throw new ArgumentException("Type '" + type.Name + "' is not an enum");

return (from field in type.GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static)
where field.IsLiteral
select field.Name).ToList();

You use it like this:

var names = Enum<StockExchange>.GetNames();

(here the StockExchange is an enum.)

Technorati Tags:

Azure: How to create local emulator storage

If you find yourself attempting to start up on Azure/Cloud development, you might encounter an error in the emulator when lauching this saying that it is unable to start the storage?

The reason is, that you initially need to initialize the (local) data storage to be able to support the emulator. The key to this is the console utility called DSInit (found in the below command prompt).


To setup this storage in a local SQLServer, you go this command: DSInit /SqlInstance:. /forceCreate

It will ultimately present you with this prompt:


Update (26/5/2011):
This has been moved in version 1.4 of the SDK. DsInit.exe is now found at:
”C:\Program Files\Windows Azure SDK\v1.4\bin\devstore>DSInit.exe”


Technorati Tags:

06 February, 2011

WP7 development tools update (January 2011)

Okay – the update to WP7 development tools is available for download. It includes a new emulator (with copy/paste) and some other minor updates. See full details in the below link.


Technorati Tags:

04 February, 2011

WP7: How to receive streaming video in your application

I yesterday set out to produce a streaming video client as a POC. Basically, I wanted the ability to show live video feeds on the phone and that without having to download the video onto the device first.

Therefore, the solution should be to receive a video in a streaming manner from a resource (server) on the internet.


How to do?

It turns out it is pretty easy to create. MS has creating a streaming video client control (Microsoft.Web.Media.SmoothStreaming, Link) that should be able to do the job, but it is not all that easy to use. On CodePlex, some guys have made a control that in contrast makes it very easy to set up. This framework is called SMF (Silverlight Media Framework) and includes a SMFPlayer control (http://smf.codeplex.com/)

The references you need to have in your project are shown below.


You need to add these to ref. in your page XAML:


and finally the player is embedded like this:

MediaSource="http://ecn.channel9.msdn.com/o9/content/smf/smoothcontent/bbbwp7/big buck bunny.ism/manifest"/>

That is basically all there is to it. Of-course a lot of properties/settings can me tweaked to make the player look/behave as you prefer – but a basic setup is the above. Note the mediaSource here is the bugsbunny sample stream; in this case hosted on a channel9-server.

Not sure as to why SMF suggests that you should reference the Microsoft.Web.SmoothStreaming assembly, as the project runs fine without it. But that’s what they state?

Happy coding!

Technorati Tags: ,

iPhone/XCode - not all cases are equal!

This bit me! Having made some changes to an iPhone application (Obj-C); everything worked fine in the simulator. But, when deploying the s...