The Windows Media Center Platform Team Blog RSS 2.0
 Thursday, November 22, 2007

We put the template support in for Visual Studio 2008 towards the very end of the 5.3 development cycle as a 'bonus' to fulfill community requests -- you'll notice we don't even mention it in the What's New section of the SDK documentation at all since we didn't know the street date for Visual Studio 2008.

There are three templates which ship in the 5.3 version:

Windows Media Center Application
A project for creating a Windows Media Center Application containing a page with four buttons which invoke a Media Center dialog box.

Windows Media Center Application - Background
A project for creating a Windows Media Center Background Application.

Windows Media Center Application - Fundamental
A project for creating a Windows Media Center Application containing the minimum code and markup required.

It just so happens that Visual Studio 2008 released to the general public a day or two before we released, so I've been scrambling to test out the SDK install on all sorts of permutations of Visual Studio installations -- the surface area for this testing is quite large when you look at the fact all of them can peacefully coexist with side by side installs. Last night we found an issue where one of the templates (the first one in the list above) isn't available in Visual Studio 2008 if the only development tool you have installed is a Visual Studio 2008 SKU.

Select one of the following to resolve...

  • Make sure you have a Visual Studio 2005 SKU installed (including any Express Edition) in addition to Visual Studio 2008 prior to installing the SDK.
  • Run a repair of the Windows Media Center SDK 5.3 if you've already got it and a Visual Studio 2008 SKU installed and are installing a Visual Studio 2005 SKU second.
Categories: SDK | Template | Comments [1] | # | Posted on Thursday, November 22, 2007 3:33:24 PM (GMT Standard Time, UTC+00:00)   
 Saturday, September 22, 2007

The day after the geek dinner Scott Hanselman and I sat down to chat about developing for Windows Media Center for Hanselminutes 82. The result is a pretty nice introduction to what you need for development, the tools included in the SDK, some of the samples which are included in the SDK and some basic beginner concepts. Here is a detailed list of links which corresponds to the various topics we covered during the podcast.

Enjoy...!

2:15 Software Development Kit http://www.microsoft.com/downloads/details.aspx?familyid=a43ea0b7-b85f-4612-aa08-3bf128c5873e&displaylang=en
2:29 Visual C# 2005 Express Edition http://msdn2.microsoft.com/en-us/express/aa975050.aspx
2:38 Media Center Markup Language http://msdn2.microsoft.com/en-us/library/bb189823.aspx
3:40 MCML Preview Tool http://msdn2.microsoft.com/en-us/library/bb189325.aspx
6:30 Z Sample Application http://blog.mediacentersandbox.com/IntroducingTheZSampleApplication.aspx
11:46 Remoting of the User Interface http://blog.mediacentersandbox.com/AQuickPeekUnderTheHoodPartOneOfFour.aspx and http://blog.mediacentersandbox.com/AQuickPeekUnderTheHoodPartTwoOfFour.aspx (we never got around to parts 3 and 4 -- they would have been much deeper than we really needed to go).
12:15 Remote Control and Input Handlers http://msdn2.microsoft.com/en-us/library/bb189195.aspx
18:08 Managed Code Object Model http://msdn2.microsoft.com/en-us/library/ms816271.aspx
19:00 Application Types Which Leverage MCML: Local and Web http://msdn2.microsoft.com/en-us/library/ms816272.aspx
21:00 Installation and Registration of Applications http://msdn2.microsoft.com/en-us/library/ms815407.aspx
23:10 Q Sample Application (Screenshot) http://play.mediacentersandbox.com/sample/5/q/screencap.png
24:14 MCML Sampler (Screenshot) http://play.mediacentersandbox.com/sample/5/mcmlsampler/screencap.png
25:01 Databinding in MCML http://msdn2.microsoft.com/en-us/library/bb188939.aspx
26:28 Defining a <UI> http://msdn2.microsoft.com/en-us/library/bb189704.aspx
27:37 <UI> Properties http://msdn2.microsoft.com/en-us/library/bb189635.aspx
28:04 Media Center Sandbox http://blog.mediacentersandbox.com
28:30 Visual Studio 2008 'Orcas' Templates from Aaron Stebner http://blogs.msdn.com/astebner/archive/2007/09/11/4873223.aspx
28:45 Using the Visual Studio Templates http://msdn2.microsoft.com/en-us/library/bb189732.aspx

Categories: Resources | Sample | SDK | Template | Comments [5] | # | Posted on Saturday, September 22, 2007 3:39:28 AM (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)   
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.