The Windows Media Center Platform Team Blog RSS 2.0
 Friday, September 14, 2007

I'm pleased to announce the addition of Steven Harding to our Community Dev Expert team joining Niall and Andrew.

Steven is the author of Yougle, MoreWithMyMusic and EMUCenter for Windows Media Center in Windows Vista and several other experiences built for prior versions of Windows Media Center. He also has created a poker game timer which tells you the current blinds, the current ante and how long until they next go up -- all with text-to-speech announcements of blind increases and warnings when they are getting near.

In addition, he is a contributor to the The Digital Lifestyle Developer Blog (part of the excellent group of resources made available by Ian Dixon over at http://thedigitallifestyle.com/cs/).

Steven has contributed over 400 posts to our developer forums over at http://discuss.mediacentersandbox.com making him one of the most prolific and helpful individuals in the community. His passion for Windows Media Center and the platform shine through in his postings and advocacy on behalf of other developers.

You can identify Steven in the forums by his rather esoteric alias of IgnoranceIsBliss in the forums (perhaps he'll comment here on how he decided on that moniker) as well as a new banner in his postings that looks like this:

Congratulations, Steven -- certainly well deserved.

Categories: Discussion | Comments [0] | # | Posted on Friday, September 14, 2007 6:32:20 AM (GMT Standard Time, UTC+00:00)   
 Wednesday, September 12, 2007

This sample demonstrates how to use the PlaySound Element with the Timer Class to create a playback loop which does not use the PlayMedia Method and therefore is not reflected in the Windows Media Center user experience.

<Mcml xmlns="http://schemas.microsoft.com/2006/mcml">

 <UI Name="Default">

  <Locals>
   <Timer Name="MyTimer" Interval="10000" Enabled="true" AutoRepeat="true"/>
  </Locals>

  <Rules>
   <Rule>
    <Conditions>
     <Modified Source="[MyTimer.Tick]" InitialEvaluate="true"/>
    </Conditions>
    <Actions>
     <!-- MyContent.wav is of a known length which     -->
     <!--is slightly shorter than the interval defined -->
     <!--in the timer.                                 -->
     <PlaySound Sound="
file://MyContent.wav"/>
    </Actions>
   </Rule>
  </Rules>

  <Content>
   <Text Content="PlaySound + Timer" Color="White"/>
  </Content>

 </UI>

</Mcml>

Categories: Sample | Comments [0] | # | Posted on Tuesday, September 11, 2007 11:46:07 PM (GMT Standard Time, UTC+00:00)   
 Saturday, August 25, 2007

Use this guide to replace the button in the application template with the one from the Z sample application. This is a good example of separation of logic/data from the visuals enabling development of each to remain separate in a distributed development environment.

1.       Start a new application with the Windows Media Center Application template and complete the application as outlined in the readme.htm file.

2.       Using Windows Explorer copy the following files from the Z sample application source folder into the corresponding new application folders, overwriting existing files if present:

a.        \Markup\Button.mcml

b.       \markup\Styles.mcml

c.        \images\ButtonFocus.png

d.       \images\ButtonNonFocus.png

3.       Select the Images folder in Solution Explorer.

4.       Select Project > Add Existing Item from the menu.

5.       In the Add Existing Item dialog:

a.        Select Image Files in the Files of type drop down list.

b.       Navigate to the \Images folder for the project and multi-select ButtonFocus.png and ButtonNonFocus.png by clicking on them with the mouse while holding down the Control key on the keyboard.

c.        Click the Add button.

6.       Open Resources.resx for editing.

7.       In Resources.resx:

a.        Press Control+2 on the keyboard to switch to images.

b.       Drag and drop ButtonFocus.png, ButtonNonFocus.png and ButtonNonFocus.png from the Solution Explorer into Resource.resx to embed these files in the assembly.

8.       Double click \Markup\Button.mcml in Solution Explorer for to open for editing.

9.       Find and replace every instance of "resx://Z/Z" with "resx://[ApplicationName]/[ApplicationName]" where [ApplicationName] is the name of your project. For example: "resx://Z/Z.Resources/Styles" would read "resx://Application1/Application1.Resources/Styles"

10.    Double click \Markup\Styles.mcml in Solution Explorer for to open for editing.

11.    In Styles.mcml:

a.        Delete the following MCML: <Image Name="ContainerImage" Source="resx://Z/Z.Resources/Container" NineGrid="40,40,40,40"/>

b.       Add the following MCML: <Color Name="BackgroundColor" Color="Black"/>

c.        Find and replace every instance of "resx://Z/Z" with "resx://[ApplicationName]/[ApplicationName]" where [ApplicationName] is the name of your project.

12.    Select Compile and test using DevInstall.cmd or create the MSI as outlined in readme.htm to install and test.

Categories: Template | Comments [0] | # | Posted on Saturday, August 25, 2007 3:39:47 AM (GMT Standard Time, UTC+00:00)   
 Friday, August 24, 2007

Follow these steps to transform the C# Windows Media Center Application Template in the 5.2 version of the SDK into a background application.

1.       Create a new project using the Windows Media Center Application template in versions 5.2 or later of the Windows Media Center Software Development Kit.

2.       Finalize the project using the instructions outlined in the Readme.htm document included with the template.

3.       Double click Resources.rex in Solution Explorer to open for editing.

4.       In Resources.resx…

a.        Press Control+1 to select strings.

b.       Modify the DialogCaption string to read “Dialog Caption”.

c.        Press Control+5 to select files.

d.       Delete the 5 MCML files (Button, Controls, Menu, RepeatItem and Styles).

e.       Select File > Save from the menu.

5.       Delete the Markup folder in Solution Explorer.

6.       Double click Application.cs in Solution Explorer to open for editing.

7.       In Application.cs…

a.        Delete: private HistoryOrientedPageSession session;

b.       Delete: public Application() : this(null, null){}.

c.        Delete: public string[] MyData{…}

d.       Modify public Application(HistoryOrientedPageSession session, AddInHost host) to read as follows:

public Application(AddInHost host)

{

this.host = host;

singleApplicationInstance = this;

}

 

e.       Modify public void GoToMenu() to read as follows:

public void Start()

{

string temp = "Background applications do something here.";    

DialogTest(temp);

}

 

f.         Modify public void DialogTest(string strClickedText) to read as follows:

public void DialogTest(string strClickedText)

{

int timeout = 5;

bool modal = true;

string caption = Resources.DialogCaption;

 

if (host != null)

{

MediaCenterEnvironment.Dialog(strClickedText,

caption,

new object[] { DialogButtons.Ok },

timeout,

modal,

null,

delegate(DialogResult dialogResult) { });

}

else

{

Debug.WriteLine("DialogTest");

}

}

 

g.        Select File > Save from the menu.

8.       Double click Launch.cs in Solution Explorer to open for editing.

9.       In Launch.cs…

a.        Delete private static HistoryOrientedPageSession s_session;.

b.       Modify public void Launch(AddInHost host) as follows:

public void Launch(AddInHost host)

{

    Application app = new Application(host);

    app.Start();

}

 

c.        Select File > Save from the menu.

10.    Double click Registration.xml in Solution Explorer to open for editing.

11.    In Registration.xml modify <category category="More Programs"/> to read as follows:

<category category="Background"/>

 

12.    Select File > Save from the menu.

13.    In Solution Explorer select the [ApplicationName] project.

14.    Select Project > [ApplicationName] Properties from the menu.

15.    Delete the MCMLVerifier post-build event command line items in the Build Events tab of the properties (this line begins with “%windir%\eHome\McmlVerifier.exe…”).

16.    Select Build > Rebuild Solution from the menu.

17.    Run “DevInstall.cmd” from a command prompt with Administrator privileges to perform a development install or follow the instructions to generate an MSI and install.

18.    Launch Windows Media Center – the application should display a dialog shortly after Windows Media Center launches.

19.    Run “DevInstall.cmd /u” from a command prompt with Administrator privileges to perform a development install or uninstall using the MSI. Otherwise you will get a dialog box each time you launch Windows Media Center.

Categories: Template | Comments [2] | # | Posted on Friday, August 24, 2007 10:45:22 PM (GMT Standard Time, UTC+00:00)   
 Tuesday, August 07, 2007

An updated version of the Windows Media Center Software Development Kit is now available for download from http://www.microsoft.com/downloads/details.aspx?familyid=a43ea0b7-b85f-4612-aa08-3bf128c5873e&displaylang=en. This is the same link as before so no need to change your bookmarks. These links also persist in the navigation section at http://blog.mediacentersandbox.com/.

The following is a summary of the key changes to the Windows Media Center Software Development Kit for this version:

  • The Windows Media Center Application Step By Step document which helps you create a Windows Media Center application from an empty project using Media Center Markup Language (MCML), C# and Windows Installer XML (WiX).
  • The C# project template has been revised and now includes Windows Installer XML (WiX) 3.0 scripts for generating a setup program to install the application. See the Readme.htm file when you create a new application with the template for more information. This application template is the same result you get from working completely through the new Step By Step document.
  • The MCML file template has been revised to work better with the C# project template and includes the basic Properties, Locals, Rules, and Content elements typically needed.
  • A Visual Studio solution for the MCML Sampler making it easier to search, copy, and paste from the markup and code files.

I'd like to take a moment to thank our community of developers over at http://discuss.mediacentersandbox.com who provided lots of feedback on the Step By Step document to make it a great resource for beginners.

Charlie

Categories: SDK | Comments [1] | # | Posted on Monday, August 06, 2007 11:46:01 PM (GMT Standard Time, UTC+00:00)   
 Wednesday, August 01, 2007

A good part of my professional life last year was taken up working with Showtime and Method (among others) to get Showtime Interactive built while we were still creating the Windows Media Center Presentation Layer platform (Media Center Markup Language + .NET 2.0).

Thanks to our friends over in developer envangelism you can learn more about what it took to build this experience at http://www.microsoft.com/casestudies/casestudy.aspx?casestudyid=4000000490.

Charlie

Categories: Application | Comments [6] | # | Posted on Wednesday, August 01, 2007 4:41:45 PM (GMT Standard Time, UTC+00:00)   
 Monday, June 18, 2007

IgnoranceIsBliss continues his series on creating a Windows Media Center application using managed code (C#) and Media Center Markup Language (MCML). In his most recent post Stage 10 - Installing It he has the following to say about writing registry keys directly instead of using the Registration API:

1. Charlie, the Microsoft product director for Media Center extensibility (IE. the Media Center SDK) has informed me that MS won't guarantee that the method of registering plugins will remain the same. Of course, I then asked 'OK - then why do you TELL us to register them that way?' and there wasn't much of a response. I'm yet to see if this is still true in the newer version of the Media Center SDK.

2. If you run a 32 bit installation on a 64 bit version of Windows, your registry entries are placed in an entirely different tree. So the 64 bit version of Media Center can't actually see the keys you've created.. This means you MUST produce both a 64 and 32 bit version of your installer.

Microsoft themselves suggest you use WiX, which is an open source product of theirs that allows you to create installers - but since it's a complicated platform and I want to be able to take you through the basics without needing any additional software, I'm going to take you through the easy, but perhaps not officially supported method of adding registry keys directly.

In response...

A) The reason we provide an abstraction layer for the registry keys is simple: We can change the underlying methodologies for registering experiences without breaking the apps (or their installers). For example, suppose we change where Windows Media Center looks in the registry for applications. By writing registry keys yourself they may end up in a location we aren't polling -- and therefore the app won't appear. Using the API will always work even if we change things under the covers. Abstraction is good -- it helps you maintain forward compatibility.

B) There are a very few select OEM scenarios where writing the registry keys directly makes sense. Specifically, where you are using a single image for thousands of preinstalled machines. Outside of this specific scenario (i.e. if you aren't an OEM using this to prep machine images) there is no good reason to write the registry keys themselves, and to do so only increases the risk the installer will be possibly broken at some later date. I've even advised OEMs to use the Registration API during the preinstall phase rather than write registry keys.

C) We include writing the registry keys directly for those who are committed to only using a Visual Studio setup project. Effectively, the Windows Media Center Platform team does not recommend using the Visual Studio setup project because of it's inherent limitations (which are more than just this singular issue). As a bonus, using WiX also makes the installation solution accessible to folks using free tools (Visual C# 2005 Express Edition) as well.

D) WiX does carry a higher learning curve. Along with that comes much more granular control over the installer and, perhaps more importantly, a fundamental understand of what is happening when the user installs the application. FWIW, I personally found it difficult at first, but now that I've got a pretty good understanding of the pattern in the WXS file it's much more 'friendly' to me compared to a Visual Studio setup project -- which abstracts everything out too much in my opinion, and I'm not even a setup guru and love the abstraction to make it easier (just ask Aaron).

D) If you do follow IgnoranceIsBliss logic, just remember it's pretty unfriendly to force a user to figure out which installer to use (32 bit or 64 bit) -- especially given the actual library is identical for both (you don't need to compile for each in the context of a Windows Media Center application). Make it simple -- have a single installer. That means using the Registration API and WiX.

E) We revised this SDK documentation with the last release (see http://msdn2.microsoft.com/en-us/library/bb189827.aspx) which quickly vectors the reader back to 'use the Registration API'. We will make further clarifying changes in the future.

IgnoranceIsBliss has done a pretty good job of giving you a guide to creating a Windows Media Center application -- just make sure you use his documents as a supplement to the information in the Software Development Kit -- not in lieu of.

Charlie

Categories: SDK | Comments [3] | # | Posted on Monday, June 18, 2007 7:23:23 PM (GMT Standard Time, UTC+00:00)   
 Tuesday, May 15, 2007

Matt Ivers has a pretty good article on Code4Fun titled Control Windows Media Center using a Windows Mobile 5 Device. I haven't tried it out yet, but looks like a solid tutorial on how to create a background application.

Charlie

Categories: Application | Comments [2] | # | Posted on Tuesday, May 15, 2007 3:22:24 PM (GMT Standard Time, UTC+00:00)   
Blogroll
About

Disclaimer
All information available via this site is provided 'as is' with no warranties and confers no rights.

© Copyright 2008 Microsoft Corporation.

Sign In
All Content © 2008, Microsoft Corporation.