The Windows Media Center Platform Team Blog RSS 2.0
 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)   
Monday, August 27, 2007 3:21:26 AM (GMT Standard Time, UTC+00:00)
please add another project type to the MCE SDK that already has this pre-baked
Monday, August 27, 2007 3:25:32 AM (GMT Standard Time, UTC+00:00)
Hi casey -- we are thinking about it, and will probably release this as a separate template from the SDK in the short term. No ETA on when -- probably in the next month or so.
Comments are closed.
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.