Share via


Configure Items in the Menus for Launching Applications (Compact 7)

3/12/2014

On the sample home screen of your device, the main menu, by default, lists the menu items and settings items for Windows Embedded Compact 7 applications and control panel applications that you specifically include in the run-time image.

You can modify the default settings for the items on the menus. For example, you can change the order of menu items and edit or remove the text descriptions that accompany each menu item.

You can also add menu items to start custom Microsoft Silverlight for Windows Embedded-based applications that you develop, build, and include in the run-time image.

Prerequisites

You must have an OS design that includes an application launcher to complete the following procedures. For more information, see Create and Prepare the OS Design and Application Launcher Project.

Change the Order of Menu Items

You can reorganize items in the main menu or control panel menu.

To change the order of menu items displayed on the main menu

  1. In Visual Studio, open Main_Default.xml, located in %_WINCEROOT%\Public\Shell\Oak\XRShell\Src.

  2. Rearrange the order of Item elements, including @CESYSGEN conditional statements that enclose elements that are dependent on build variables, as follows:

    • Item elements defined at the top of the XML element tree appear at the beginning of the menu.
    • Item elements defined at the bottom of the XML element tree appear at the end of the menu.

To change the order of menu items displayed in the control panel menu

  1. Open Setting_Default.xml, located in %_WINCEROOT%\Public\Shell\Oak\XRShell\Src.

  2. Rearrange the order of SettingItem elements, including @CESYSGEN conditional statements that enclose elements that are dependent on build variables, as follows:

    • SettingItem elements defined at the top of the XML element tree appear at the beginning of the menu.
    • SettingItem elements defined at the bottom of the XML element tree appear at the end of the menu.

Delete Text in a Menu Item

You can delete the title or descriptive text that accompanies each Path element in a menu.

To delete text on a menu item

  1. Open the .xrsl file that defines the menu item. It can be one of the following:

    File

    Menu item

    Main_browser.xrsl

    The Browser item in the main menu.

    Main_music.xrsl

    The Music item in the main menu.

    Main_photo.xrsl

    The Photo item in the main menu.

    Main_settings.xrsl

    The Settings item in the main menu.

    Main_video.xrsl

    The Video item in the main menu.

    Setting_audio.xrsl

    The Audio item in the control panel menu.

    Setting_bluetooth.xrsl

    The Bluetooth item in the control panel menu.

    Setting_datetime.xrsl

    The Date and Time item in the control panel menu.

    Setting_display.xrsl

    The Display item in the control panel menu.

    Setting_ethernet.xrsl

    The Ethernet item in the control panel menu.

    Setting_networking.xrsl

    The Networking item in the control panel menu.

    Setting_regional.xrsl

    The Regional Settings item in the control panel menu.

    Setting_wifi.xrsl

    The Wi-Fi item in the control panel menu.

    Sample home screen .xrsl files are located at %_WINCEROOT%\public\shell\oak\XRShell\src.

  2. Remove the text that identifies the menu item:

    1. In the .xrsl file, locate the Name element.

    2. Delete the content in the Name element start and end tags, convert the start and end tags to an empty element, and then add a Text attribute that is set to an empty string as follows:

      <Name _locId="IDName" Text=" " />
      
  3. Remove the text that describes the menu item:

    1. In the .xrsl file, locate the Description element.

    2. Delete the content in the Description element start and end tags, convert the start and end tags to an empty element, and then add a Text attribute that is set to an empty string as follows:

      <Description _locId="IDDescription" Text=" " />
      

Add a New Menu Item

You can add new items to the main menu that start new Silverlight for Windows Embedded applications. Menu items can include both text and a XAML Path element that resembles an icon.

To create a custom Path element that resembles an icon for your menu item

  1. In Expression Blend, on the File menu, click New Project.

  2. In Project types, select Windows Embedded.

  3. Type a project name, and then click OK.

  4. Paste the following XAML, which contains a sample home screen Path element, into Expression Blend:

    <UserControl
       xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
       xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
       x:Class="TestPathElement2.MainPage"
       Width="640" Height="480">
    
    <Grid x:Name="LayoutRoot" Background="Gray">
    <Path xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation" Data="F1M168.556,119.535L168.804,120.336C169.268,122.352,169.536,124.303,169.571,126.264L169.519,127.503
    167.379,131.946C164.669,136.934,161.492,141.63,157.905,145.976L153,151.373 153,148.227 153,145.433
    154.819,143.432C159.954,137.209,164.211,130.234,167.399,122.697z
    M153,101.029C153,101.029,163.571,105.171,166.857,114.028L167.569,116.336
    165.53,121.907C162.419,129.262,158.265,136.069,153.254,142.142L153,142.421
    153,130.948C153,115.406,153,101.029,153,101.029z M90,77.5C83.096,77.5 77.5,83.096 77.5,90 77.5,96.904
    83.096,102.5 90,102.5 96.904,102.5 102.5,96.904 102.5,90 102.5,83.096 96.904,77.5 90,77.5z
    M90,76C97.732,76 104,82.268 104,90 104,97.732 97.732,104 90,104 82.268,104 76,97.732 76,90 76,82.268
    82.268,76 90,76z M90,73.996C81.161,73.996 73.996,81.161 73.996,90 73.996,98.839 81.161,106.004
    90,106.004 98.839,106.004 106.004,98.839 106.004,90 106.004,81.161 98.839,73.996 90,73.996z
    M145.118,63.013C145.118,63.013 148.096,63.013 148.096,63.013 148.929,68.966 149.048,76.47
    155.241,83.973 160.004,89.689 165.364,94.809 169.056,99.453 173.938,105.528 177.391,113.15
    177.391,120.891 177.391,133.277 171.438,145.541 167.387,152.33 167.387,152.33 165.482,152.33
    165.482,152.33 168.341,145.9 174.057,135.3 173.579,123.988 173.342,117.676 170.96,110.887
    166.912,105.886 162.386,100.05 154.763,95.405 148.096,94.93 148.096,94.93 148.096,162.453
    148.096,162.453 148.096,167.813 144.88,172.695 140.236,176.268 135.71,179.84 129.754,181.984
    124.516,181.984 121.18,181.984 118.083,180.913 115.941,179.125 113.678,177.339 112.368,174.72
    112.368,171.624 112.368,166.742 115.702,161.857 120.228,158.286 124.754,154.593 130.469,152.212
    135.233,152.212 139.402,152.212 142.974,152.808 145.118,154.831 145.118,154.831 145.118,63.013
    145.118,63.013z M90,61.988C105.47,61.988 118.012,74.53 118.012,90 118.012,105.47 105.47,118.012
    90,118.012 74.53,118.012 61.988,105.47 61.988,90 61.988,74.53 74.53,61.988 90,61.988z
    M90,60C73.431,60 60,73.431 60,90 60,106.569 73.431,120 90,120 106.569,120 120,106.569 120,90
    120,73.431 106.569,60 90,60z M90,8.028C135.272,8.028,171.972,44.728,171.972,90L171.671,95.963
    167.342,91.008C163.169,86.436 159.143,82.186 157,78.686 154.091,73.934 151.429,59 151.429,59
    151.429,59 140.964,59 140.964,59 140.964,59 140.964,148.714 140.964,148.714 140.964,148.714
    133.286,146.571 125.714,150 118.143,153.429 110.398,158.075 108.429,167.857L108.183,169.879
    106.52,170.307C101.184,171.399 95.659,171.972 90,171.972 50.387,171.972 17.337,143.874
    9.693,106.52L9.461,105 10.226,105C16.781,105 43,105 43,105 51.284,105 58,98.284 58,90 58,81.716
    51.284,75 43,75 43,75 16.781,75 10.226,75L9.461,75 9.693,73.48C17.337,36.126,50.387,8.028,90,8.028z
    M90,2C138.601,2 178,41.399 178,90 178,93.038 177.846,96.039 177.546,98.997L176.97,102.772
    176.25,101.655 173.587,98.171 174,90C174,43.608 136.392,6 90,6 43.608,6 6,43.608 6,90 6,136.392
    43.608,174 90,174 95.799,174 101.461,173.412 106.929,172.293L108.084,171.996 108.171,174.076
    108.593,175.991 107.735,176.212C102.006,177.384 96.075,178 90,178 41.399,178 2,138.601 2,90 2,41.399
    41.399,2 90,2z" UseLayoutRounding="False" Stretch="Fill" Margin="4,0" >
        <Path.Fill>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                       <GradientStop Color="White" Offset="0"/>
                       <GradientStop Color="#4CFFFFFF" Offset="1"/>
            </LinearGradientBrush>
        </Path.Fill>
      </Path>
    </Grid>
    </UserControl>
    
  5. Customize or redraw the Path element into a shape that complements your application. For more information, see Draw a shape or path in your project (https://go.microsoft.com/fwlink/p/?LinkId=212266).

To add a new menu item that launches a customized Silverlight for Windows Embedded application

  1. Open a text editor.

  2. Paste the following XML code into the text editor:

    <?xml version="1.0" encoding="utf-8"?>
    <XRShellShortcut>
    
      <Name _locId="IDName">Shortcut_Name</Name>
      <Description _locId="IDDescription">Shortcut_Description</Description>
      <Target>\Windows\application.exe</Target>
      <Args></Args>
      <Icon>
        <![CDATA[
                <!--Add XAML Path Element here--> 
     ]]>
    </Icon>
    
    </XRShellShortcut>
    
  3. In the CDATA section in the Icon element, paste the Path element, including all of its attributes and child XAML elements, from the Expression Blend project that you created earlier.

  4. In the Name element, replace "Shortcut_Name" with the name of your application.

  5. In the Description element, replace "Shortcut_Description" with a description for your application.

  6. In the Target element, replace "\Windows\application.exe" with the path to the .exe for your application.

  7. Save the file as an .xrsl file in %_WINCEROOT%\Public\Shell\Oak\XRShell\Src. For main menu items, prefix the file name with "Main_". For settings menu items, prefix the filename with "Setting_". For example, save your file as Main_Application.xrsl.

  8. In %_WINCEROOT%\Public\Shell\Oak\Xrshell\Src, open either Main_default.xml for the main menu or Setting_default.xml for the Settings menu.

  9. Add an Item element that references your .xrsl file. For guidelines on where to add the element in the element tree, see Change the Order of Menu Items.

    Note

    If the menu item is visible only when a specific variable or SYSGEN is set in the build, put the entry inside a @CESYSGEN conditional statement. Replace BUILD_VARIABLE_TO_SET with the name of the SYSGEN or variable.

    For example:

    <!--
    ; @CESYSGEN IF BUILD_VARIABLE_TO_SET
    -->
    <Item Widget="Main_Item">
            <File>Main_Application.xrsl</File>
    </Item>
    <!--
    ; @CESYSGEN ENDIF
    -->
    
  10. Open %_WINCEROOT%\Public\Shell\Oak\Files\Shell.bib.

  11. In the FILES list of the shell.bib file, add an entry for the .xrsl file after the entries for default .xrsl files such as Main_Photo.xrsl.

    Note

    If the menu item is visible only when a specific variable or SYSGEN is set in the build, put the entry inside a @CESYSGEN conditional statement. Replace BUILD_VARIABLE_TO_SET with the name of the SYSGEN or variable.

    For example:

    ; @CESYSGEN IF BUILD_VARIABLE_TO_SET
    
    Main_Application.xrsl   $(_FLATRELEASEDIR)\Main_Application.xrsl                            NK SH
    ; @CESYSGEN ENDIF
    
  12. Open %_WINCEROOT%\Public\Shell\Oak\Files\Shell.dat.

  13. In shell.dat, locate the section titled "Shortcuts for binaries built before shell in _DEPTREES."

  14. Add an entry for the new menu item under "root:-Directory("\XRShell\__Storage\Main").

    Note

    If the menu item appears only if a specific variable or SYSGEN is set in the build, put the entry inside a @CESYSGEN conditional statement. Replace BUILD_VARIABLE_TO_SET with the name of the SYSGEN or variable.

    For example:

    ; @CESYSGEN IF BUILD_VARIABLE_TO_SET
    Directory("\XRShell\__Storage\Main"):-File("Main_Application.xrsl",
    "\windows\Main_Application.xrsl")
    ; @CESYSGEN ENDIF
    
  15. If Platform Builder is currently attached to a virtual CEPC, on the Target menu, click Detach Device.

  16. To rebuild the run-time image, on the Build menu, click Rebuild Solution.

Next Steps

Continue to customize your application launcher as you like by using the procedures in this section. After you complete your customizations, you can use the procedures in Build and Run the Application Launcher to rebuild the theme DLL by using the Command Prompt window in Visual Studio before you rebuild your run-time image.

See Also

Concepts

Create an Application Launcher in Silverlight for Windows Embedded