• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Uk Media Center User Group   April 2009
 

Uk Media Center User Group April 2009

on

  • 665 views

An introduction to developing Media Center add-ins, given to the UK Media Center and Windows Home Server user group meeting in Birmingham, April 2009.

An introduction to developing Media Center add-ins, given to the UK Media Center and Windows Home Server user group meeting in Birmingham, April 2009.

Statistics

Views

Total Views
665
Views on SlideShare
664
Embed Views
1

Actions

Likes
0
Downloads
0
Comments
0

1 Embed 1

http://www.lmodules.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Uk Media Center User Group   April 2009 Uk Media Center User Group April 2009 Presentation Transcript

    • Developing Media CenterPresentation Layer Applications
      Andrew Cherry
      Digital Living Solutions Ltd
    • A bit about me
      UK Media Center & WHS User Group
      23-Apr-2009
      2
      Digital Living Solutions Ltd
      Hampshire based, specialising in digital home installation, integration, and software development (including Media Center)
      Microsoft MVP for Media Center since July 2007
      “Community Dev Expert” for the Media Center Sandbox (Microsoft-run developer forum for Media Center)
    • Purpose of today's session
      Remove the mystery behind Media Center development
      Give you a taster of how straightforward it is to develop for Media Center
      Hopefully inspire you to take the next step and start developing your own add-ins!
      23-Apr-2009
      UK Media Center & WHS User Group
      3
    • Why develop for Media Center?
      Potential reach
      Every Vista Home Premium/Ultimate system has Media Center on it already!
      Cost of entry
      All the tools you need are free – Visual C# Express, Media Center SDK
      You can develop some fun stuff!
      Limited only by your imagination and patience!
      23-Apr-2009
      UK Media Center & WHS User Group
      4
    • Media Center Presentation Layer (MCPL)
      Core building block of Media Center
      The core UI for Vista Media Center is written in MCML
      XML based Markup Language
      Developed (and optimised) specifically for Media Center
      Used in conjunction with “backend” C# code
      Applications = code + markup
      Code = “application logic”, Markup = UI
      Model-View-Controller pattern
      23-Apr-2009
      UK Media Center & WHS User Group
      5
    • Media Center Markup Language“Code Behind”
      Application logic (code + data)
      Managed code language (e.g. C#)
      Cannot directly modify view properties
      Can respond to view events
      Non-visual, code only
      Known as a “ModelItem”
      23-Apr-2009
      UK Media Center & WHS User Group
      6
      Model
      View
      • Look and behaviour
      • Media Center Markup Language
      • Can read/write model properties
      • Can respond to model changes
      • Visual + UI logic
      • Known as a “ViewItem”
    • Media Center Markup LanguageWhy Model-View Separation?
      23-Apr-2009
      UK Media Center & WHS User Group
      7
      Rendering
      Engine
      User Experience
      Framework
      Messaging
      System
      Native code (e.g. C++)
      DirectX 9+
      Managed code (e.g. C#)
      .NET Framework 2.0
    • The Bad News
      “Windows 1.0 programmers had a straightforward life. They had almost no choices about how to do things; either there was an application programming interface (API), or there wasn’t, and most of the time there wasn’t. This meant that developers had to build almost everything by hand.”
      23-Apr-2009
      UK Media Center & WHS User Group
      8
      MCPL = Windows 1.0
      Windows Forms 2.0 Programming, Chris Sells & Michael Weinhardt
    • Media Center Markup LanguageBasics
      “UI” encapsulates the definition of the user interface at a specific level
      All content appears within a Content element, within the UI element
      23-Apr-2009
      UK Media Center & WHS User Group
      9
      <Mcmlxmlns="http://schemas.microsoft.com/2006/mcml">
      <UI Name="UI name">
      <Content>
      ...
      </Content>
      </UI>
      </Mcml>
    • Media Center Markup LanguageVisual Primitives
      Three visual primitives
      <Text>
      <Graphic>
      <ColorFill>
      23-Apr-2009
      UK Media Center & WHS User Group
      10
      <Text Content="Hello World!" Color="White"
      Font="Arial,30" />
      <Graphic Content="resx://addin/addin.resources/image" />
      <ColorFill Content="Red" />
    • Media Center Markup LanguageVisual Primitives
      Two “non-visible” container primitives
      <Panel>
      <Clip>
      Seven layout modes
      Form
      Anchor
      Dock
      Flow
      23-Apr-2009
      UK Media Center & WHS User Group
      11
      • Grid
      • Scale
      • Rotate
    • Media Center Markup LanguageAnatomy of a button
      23-Apr-2009
      UK Media Center & WHS User Group
      12
      Button background – no focus
      Button background – with focus
      Button text
      Play
      Play
      Dormant Button text
      Play
    • Media Center Markup LanguageAnatomy of a button
      Use a combination of visual primitives, layouts, and rules to generate effects
      23-Apr-2009
      UK Media Center & WHS User Group
      13
      <Content>
      <Panel Name="Panel" Margins="10,0,10,0" MinimumSize="[Size]" MaximumSize="[Size]" Layout="Anchor">
      <Children>
      <Clip Name="Fade" FadeSize="10" FadeAmount="1.0" FarOffset="-40" ShowFar="true" ShowNear="false" Visible="true">
      <LayoutInput>
      <AnchorLayoutInput Left="Parent,0" Top="Parent,0" Right="Parent,1" Bottom="Parent,1"/>
      </LayoutInput>
      <Children>
      <Text Name="Text" Content="[Description]" Margins="10,8,10,8" Color=“White" Font=“Segoe Media Center,20”/>
      </Children>
      </Clip>
      <Graphic Name="Background" Content=“[NoFocusImage]" MinimumSize=“[Size]" MaximumSize=“[Size]"/>
      </Children>
      </Panel>
      </Content>
      Play
    • Media Center Markup LanguageAnatomy of a button
      Use a combination of visual primitives, layouts, and rules to generate effects
      23-Apr-2009
      UK Media Center & WHS User Group
      14
      <Content>
      <Panel Name="Panel" Margins="10,0,10,0" MinimumSize="[Size]" MaximumSize="[Size]" Layout="Anchor">
      <Children>
      <Clip Name="Fade" FadeSize="10" FadeAmount="1.0" FarOffset="-40" ShowFar="true" ShowNear="false" Visible="true">
      <LayoutInput>
      <AnchorLayoutInput Left="Parent,0" Top="Parent,0" Right="Parent,1" Bottom="Parent,1"/>
      </LayoutInput>
      <Children>
      <Text Name="Text" Content="[Description]" Margins="10,8,10,8" Color=“White" Font=“Segoe Media Center,20”/>
      </Children>
      </Clip>
      <Graphic Name="Background" Content=“[NoFocusImage]" MinimumSize=“[Size]" MaximumSize=“[Size]"/>
      </Children>
      </Panel>
      </Content>
      Play
    • Media Center Markup LanguageAnatomy of a button
      Use a combination of visual primitives, layouts, and rules to generate effects
      23-Apr-2009
      UK Media Center & WHS User Group
      15
      <Content>
      <Panel Name="Panel" Margins="10,0,10,0" MinimumSize="[Size]" MaximumSize="[Size]" Layout="Anchor">
      <Children>
      <Clip Name="Fade" FadeSize="10" FadeAmount="1.0" FarOffset="-40" ShowFar="true" ShowNear="false" Visible="true">
      <LayoutInput>
      <AnchorLayoutInput Left="Parent,0" Top="Parent,0" Right="Parent,1" Bottom="Parent,1"/>
      </LayoutInput>
      <Children>
      <Text Name="Text" Content="[Description]" Margins="10,8,10,8" Color=“White" Font=“Segoe Media Center,20”/>
      </Children>
      </Clip>
      <Graphic Name="Background" Content=“[NoFocusImage]" MinimumSize=“[Size]" MaximumSize=“[Size]"/>
      </Children>
      </Panel>
      </Content>
      Play
    • Media Center Markup LanguageAnatomy of a button
      Use a combination of visual primitives, layouts, and rules to generate effects
      23-Apr-2009
      UK Media Center & WHS User Group
      16
      <Content>
      <Panel Name="Panel" Margins="10,0,10,0" MinimumSize="[Size]" MaximumSize="[Size]" Layout="Anchor">
      <Children>
      <Clip Name="Fade" FadeSize="10" FadeAmount="1.0" FarOffset="-40" ShowFar="true" ShowNear="false" Visible="true">
      <LayoutInput>
      <AnchorLayoutInput Left="Parent,0" Top="Parent,0" Right="Parent,1" Bottom="Parent,1"/>
      </LayoutInput>
      <Children>
      <Text Name="Text" Content="[Description]" Margins="10,8,10,8" Color=“White" Font=“Segoe Media Center,20”/>
      </Children>
      </Clip>
      <Graphic Name="Background" Content=“[NoFocusImage]" MinimumSize=“[Size]" MaximumSize=“[Size]"/>
      </Children>
      </Panel>
      </Content>
      Play
    • Media Center Markup LanguageAnatomy of a button
      Use a combination of visual primitives, layouts, and rules to generate effects
      23-Apr-2009
      UK Media Center & WHS User Group
      17
      <Content>
      <Panel Name="Panel" Margins="10,0,10,0" MinimumSize="[Size]" MaximumSize="[Size]" Layout="Anchor">
      <Children>
      <Clip Name="Fade" FadeSize="10" FadeAmount="1.0" FarOffset="-40" ShowFar="true" ShowNear="false" Visible="true">
      <LayoutInput>
      <AnchorLayoutInput Left="Parent,0" Top="Parent,0" Right="Parent,1" Bottom="Parent,1"/>
      </LayoutInput>
      <Children>
      <Text Name="Text" Content="[Description]" Margins="10,8,10,8" Color=“White" Font=“Segoe Media Center,20”/>
      </Children>
      </Clip>
      <Graphic Name="Background" Content=“[NoFocusImage]" MinimumSize=“[Size]" MaximumSize=“[Size]"/>
      </Children>
      </Panel>
      </Content>
      Play
    • Media Center Markup LanguageAnatomy of a button
      Use a combination of visual primitives, layouts, and rules to generate effects
      23-Apr-2009
      UK Media Center & WHS User Group
      18
      <Rules>
      <Rule>
      <Conditions>
      <Equality Source="[Input.KeyFocus]“ Value="true"/>
      </Conditions>
      <Actions>
      <Set Target="[Background.Content]" Value="[FocusImage]”/>
      </Actions>
      </Rule>
      <Condition Source="[Model.Dormant]" SourceValue="true">
      <Actions>
      <Set Target="[Text.Color]" Value=“[DormantBlue]"/>
      </Actions>
      </Condition>
      <Rules>
      Play
    • Media Center Markup LanguageAnatomy of a button
      Use a combination of visual primitives, layouts, and rules to generate effects
      23-Apr-2009
      UK Media Center & WHS User Group
      19
      <Rules>
      <Rule>
      <Conditions>
      <Equality Source="[Input.KeyFocus]“ Value="true"/>
      </Conditions>
      <Actions>
      <Set Target="[Background.Content]" Value="[FocusImage]”/>
      </Actions>
      </Rule>
      <Condition Source="[Model.Dormant]" SourceValue="true">
      <Actions>
      <Set Target="[Text.Color]" Value=“[DormantBlue]"/>
      </Actions>
      </Condition>
      <Rules>
      Play
    • Media Center Markup LanguageAnatomy of a button
      Use a combination of visual primitives, layouts, and rules to generate effects
      23-Apr-2009
      UK Media Center & WHS User Group
      20
      <Rules>
      <Rule>
      <Conditions>
      <Equality Source="[Input.KeyFocus]“ Value="true"/>
      </Conditions>
      <Actions>
      <Set Target="[Background.Content]" Value="[FocusImage]”/>
      </Actions>
      </Rule>
      <Condition Source="[Model.Dormant]" SourceValue="true">
      <Actions>
      <Set Target="[Text.Color]" Value=“[DormantBlue]"/>
      </Actions>
      </Condition>
      <Rules>
      Play
    • Media Center Markup LanguageModelItems
      Built-in objects “known” to MCML – can be inherited from
      Can be used safely to interact with View Items(Model Items are created on the application thread)
      Model Items can trigger actions in their associated View (using the FirePropertyChangedmethod)
      Have special functions in the Media Center environment (e.g. ArrayListDataSet)
      23-Apr-2009
      UK Media Center & WHS User Group
      21
    • Media Center Markup LanguageBuilt-in ModelItem Examples
      ArrayListDataSet
      BooleanChoice
      ByteRangedValue
      Choice
      Command
      EditableText
      Image
      IntRangedValue
      ListDataSet
      ModelItem
      RangedValue
      VirtualList
      23-Apr-2009
      UK Media Center & WHS User Group
      22
    • The Media Center API
      Access to non-visual elements of Media Center
      Transport and volume controls
      Launch applications and navigate to pages
      Play media
      Show dialogs
      Control DVD Changers
      Access scheduled and recorded TV metadata
      23-Apr-2009
      UK Media Center & WHS User Group
      23
    • Examples of add-ins for Media Center
      23-Apr-2009
      UK Media Center & WHS User Group
      24
      GridSearch for Media CenterTM © JFDI Engineering
    • Examples of add-ins for Media Center
      23-Apr-2009
      UK Media Center & WHS User Group
      25
      Niveus Weather © Niveus Media, Inc.
    • Examples of add-ins for Media Center
      23-Apr-2009
      UK Media Center & WHS User Group
      26
      Life|Ware © Exceptional Innovation, LLC
    • Examples of add-ins for Media Center
      23-Apr-2009
      UK Media Center & WHS User Group
      27
      Niveus Movie Library © Niveus Media, Inc.
    • Where next?
      Read the SDK help file from start to finish!
      Play with the MCML Sampler in the SDK
      Install and play with the Q and Z applications
      Experiment with creating your own controls
      Experiment with creating layouts
      Get help from the community
      http://discuss.mediacentersandbox.com
      Start developing!
      23-Apr-2009
      UK Media Center & WHS User Group
      28