Code based dialogs in media center

March 10th, 2010

I’ve written a few posts on how to implement dialog boxes in media center (Adding a version checker and Simpler popup dialog). They are both great examples of how to trigger a dialog box in mcml. Suppose though you want to do it all from within code, not within mcml. Why would you want to do that? Well, for one it means not having any AddIn calls in your mcml, and AddIn calls mean you can’t use the mcml preview tool – which significantly hampers development. For this example, I’m going to repeat the Adding a version checker example, but all in code.

So, to trigger a dialog from your code, the first thing you need to do is to build some buttons;

ArrayListDataSet dialogButtons = new ArrayListDataSet();
dialogButtons.Add("Download Now");
dialogButtons.Add("Remind me later");
dialogButtons.Add("Ignore");

This adds 3 buttons to the dialog. Obviously add as many or as few as you like. The next thing you need to do is to add the call to open the dialog;

String dialogText="There is a new version available";
String dialogTitle="New Version";
Microsoft.MediaCenter.Hosting.AddInHost.Current
.MediaCenterEnvironment.Dialog(dialogText
, "dialogTitle, dialogButtons, 30, true, null
, new Microsoft.MediaCenter.DialogClosedCallback(versionCallback));

This will open a dialog as a modal dialog with a timeout of 30 seconds. When it is closed, the method versionCallback will be called, so now we need to write that method;

public void versionCallback(Microsoft.MediaCenter.DialogResult result)
{
    if (result.ToString() == "100")
    {
        InstallNewVersion();
    }
    if (result.ToString() == "101")
    {
        RemindLater();
    }
    if (result.ToString() == "102")
    {
        IgnoreNewVersion();
    }
}

And obviously fill in the appropriate actions for each method.

Finally, you may want to block this dialog from triggering when you are in the debugger (since it won’t work), so put an if statement round it to stop it running in debug mode;

#if(!DEBUG)
   String dialogText="There is a new version available";
   String dialogTitle="New Version";
   Microsoft.MediaCenter.Hosting.AddInHost.Current
.MediaCenterEnvironment.Dialog(dialogText
  , "dialogTitle, dialogButtons, 30, true, null
  , new Microsoft.MediaCenter.DialogClosedCallback(versionCallback));
#endif

And that’s it – an mcml dialog operated entirely from your code.

Spotify headed for the US

February 7th, 2010

In an interview with Billboard this week, Spotify CEO Daniel Ek confirmed that Spotify are just a month or two from launching Spotify in the US. Apparently they have got a data center set up, and are in the final stages of setting up agreements and educating US record companies about the Spotify concept. He also announces that they are in the process of expanding the capabilities and integration that Spotify has to help drive the all important purchases that they need to make their business profitable.

Personally I’m bracing myself for the mass of new Songler users when this launches in the US. I’m sure Spotify have a similar sense of dread – it’s not easy launching a popular product in the worlds largest market.

SeeSaw launched

January 29th, 2010

After Project Kangaroo was shut down, the technology was bought up by Arqiva and re-branded as SeeSaw. Since then they have been working on content agreements with various providers, and now have agreements with 4oD, Five and BBC Worldwide, and are working on more agreements with other providers. Read the rest of this entry »

Spotify banned at Oxford University

January 19th, 2010

Shocking news from the worlds top university – Oxford University have banned the use of Spotify on their network. The justification is that it is a P2P bandwidth hog. There is of course something in that – it does use P2P technology, and it does need at least a 256kbit connection while it is running. If every student tried to run Spotify at once, it would undoubtedly cripple the network. That’s a very big if though.

The reason this is shocking is that for years the music industry has been chasing universities to get them to stop students from stealing music, and then along comes a legal service and the university blocks it. These students (except the PPE ones) are smart people who will find other less legal ways to get their music if the legal ones are blocked, and that doesn’t help anyone.

Update: Manchester University bans Spotify too. Could be a bad trend for fans of free legal music.

Anyway, if you are currently at Oxford missing Spotify, why not try listening to last.fm through Songler. Fantastic way to get your music, and not blocked!

Flash in Media Center

November 30th, 2009

Microsoft made use of Flash in Media Center for it’s integration with MSN Player. That was a startling announcement one month ago since it was assumed that Microsoft wanted to promote Silverlight over Flash, and would never allow Flash in Media Center. So, in the past month what has happened about that? Unfortunately it seems to have moved backwards again. First of all, the UK integration with MSN Player has disappeared, only to be replaced by the Sky subscription service. I think that is a major mistake by Microsoft, because I don’t think anyone will pay for a very cut down version of Sky on their PC, and it would have been better to have a working internet TV solution available.

Secondly, I have been trying to find out how independent developers such as myself can make use of Flash in Media Center. A friend of a friend managed to get this unofficial response;

As far as I know, the Platform/APIs are only available for internal use. We don’t have any plan to release public documentation on that at this moment.

So that means that until Microsoft change their minds or someone manages to dissect the delivered code to work out how to use the libraries in an unsupported way, we are stuck without Flash support for independent developer.

BBC iPlayer on the Xbox

November 30th, 2009

bbx_xboxThere was an interesting article in The Telegraph over the weekend which claimed that the BBC will not be bringing the iPlayer to the Xbox 360, unlike the PS3 and Wii which already have excellent integration. It is claimed that this is because Microsoft are demanding that it only be made available to Xbox Gold subscribers, and the BBC are saying that that is unreasonable. As you will see from my post about Sky integration, I’m really down on requiring Xbox gold membership to access services like that. Gold membership should be about getting you access to servers that run online gaming. It should not be about bringing you access to third party software that is free elsewhere. Well done BBC for sticking up to Microsoft, and I hope Sky see sense too.

Of course if you want to watch iPlayer on the Xbox 360, just install TunerFreeMCE on your PC and access it via Media Center. The latest version of TunerFreeMCE includes wmv streaming of BBC programs, so works great on extenders like the Xbox 360 too.

Sky and Flash in media center

October 22nd, 2009

With the public release of Windows 7, there have been some interesting developments;

1) Here in the UK, the Internet TV Beta 2 link has disappeared from our menus. I suspect that is because it was really buggy (I often got errors that my video library was unavailable). Hopefully it just means that a new better version is on the way

2) An advert for Sky Player has appeared in the menus;
sky

Read the rest of this entry »

Windows Home Server Cannot Even Mount Backups

September 12th, 2009

backup

Windows Home Server has had it’s fair share of embarrassing issues that really shouldn’t happen to a server. First of all, it didn’t really support the sort of home power users who were buying it, because it didn’t support backing up 64bit systems for the first year after launch. Secondly, it was corrupting files (I personally lost a few photos to that when they were corrupted while rotating them). Thirdly, until recently you couldn’t back up the server itself, so it was a fairly lousy place to store files.

Now a new issue is becoming more common, which is the inability to recover backups. More and more users are reporting that when trying to mount a backup, the process gets to 81% and then gives the error “Cannot mount the backup”. This was meant to be resolved with Power Pack 3, but from personal experience, I can tell you that it is not, even in the final version. To make matters worse, the symptoms are that you can mount a backup once on each client machine, and then never again. So you get the false sense of security that everything is working fine if you check the backups, but it fails as soon as you really need it. Read the rest of this entry »

Auto Play DVDs in Media Center in Windows 7

September 7th, 2009

autoplay7

One of my great annoyances with Windows 7 is that you don’t have the option to auto-play DVDs with Media Center. I logged it as a bug during the testing phase, and was informed that it was intentional – something along the lines of if you wanted to use Media Center, it would be open already, so auto-play wasn’t appropriate.

Anyway, I disagree, and fortunatly someone has come up with a fix for the problem. Mikinho over at Seven Forums has produced a simple registry change to get Media Center added to the DVD movie auto play options. I tested it out, and it all works great; Read the rest of this entry »

Fix table rendering problems in IE8

August 6th, 2009

Those of you who do any serious web design know that using tables to define the layout of your page is so 1995. The only way to design your page is with css.

Those of you who actually really do any serious web site coding also know that you will sooner or later be asked to work on a site that makes heave use of tables, and when faced with re-coding the whole system to use css or sticking with tables, it’s often going to be stick with tables.

Unfortunatly, IE8 has a nasty habit of simply ignoring any table cell widths you specify and rendering them as whatever size it sees fit on a truly random basis (refresh the page and see a different layout!). Fortunatly I found a solution to get IE to behave nice again. You can use the table-layout: fixed style to get it behaving well again, so just stick the following in your stylesheet (you do at least have one stylesheet don’t you?);

table{
  table-layout:fixed;
}

And there you have it – freedom to continue coding like it’s Web 1.0 time!