Pdc ro 2010 Windows Phone 7 Programming Model

  • View
    106

  • Download
    1

  • Category

    Mobile

Preview:

Citation preview

Welcome!

Windows Phone 7 Programming Model

Catalin GheorghiuI Computer Solutions

Agenda• What we will not talk about• Application Life Cycle• Navigation• Task Programming Model• Input layout• Performance Tricks• Q&A

<Application.ApplicationLifetimeObjects> <shell:PhoneApplicationService Launching="Application_Launching" Closing="Application_Closing" Activated="Application_Activated" Deactivated="Application_Deactivated"/> </Application.ApplicationLifetimeObjects>

Application Lifecycle

Navigation <HyperlinkButton Content="Page 1" NavigateUri="/Page1.xaml" /> <HyperlinkButton Content="P1" NavigateUri="/P1" />

Task Programming Model• Task– new Task().Show()– Task.Show()

• Choosers– Chooser :

ChooserBase<TaskEventArgs>– event Completed

Tasks• EmailComposeTask

Use this to allow users to send email from your application• MarketplaceLauncher

Allows an application to launch the Marketplace application• MediaPlayerLauncher

Allows an application to launch the media player• PhoneCallTask

Allows an application to launch the Phone application; use this to allow users to make a phone call from your application

• SearchTask Allows an application to launch the Web Search application

• SmsComposeTask Allows and application to launch the SMS application

• WebBrowserTask Allows an application to launch the Web Browser application

Choosers

• SaveEmailAddressTask • SavePhoneNumberTask • EmailAddressChooserTask• CaptureCameraTask• PhotoChooserTask

InputScope<TextBox Height="31" HorizontalAlignment="Left" Margin="16,173,0,0" Name="textBox1" Text="TextBox" VerticalAlignment="Top" Width="449">

<TextBox.InputScope> <InputScope>

<InputScope.Names> <InputScopeName NameValue =

"EmailNameOrAddress“/> </InputScope.Names>

</InputScope> </TextBox.InputScope>

</TextBox>

Performance Tricks• JPEG vs. PNG• Content vs. Resource• Assembly Loading• LayoutUpdated vs. ctor• Use SplashSxcreenImage.jpg• Animations in CompositorThread

Frame Rate Counters•Compositor Thread Rate (30<x<=60)•UI Thread Rate (> 20)•Memory Usage for Textures•Number of Surfaces•Number of Implicit Surfaces•Fill Rate Counter (1=480x500)

• Application Life CycleLaunching, Closing, Activated, Deactivated

• Navigation1.Uri="/JUMP1/{num}" MappedUri="/Page1.xaml?id={num}" 2. <HyperlinkButton NavigateUri="/JUMP1/1/>3. NavigationService.Navigate(new Uri("/Page1.xaml?id=1", UriKind.Relative)5. NavigationContext.QueryString["id"]

• Task Programming ModelChoosers, Launchers

• InputScopeHow and when

• Performance TricksUse JPEG, use Content build action, change Splash, control memory by using of External Content,…

Recap & Q&A

Resources:• Windows Phone Training Kit

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=ca23285f-bab8-47fa-b364-11553e076a9a

• Damir’s bloghttp://developers.de/blogs/damir_dobric/default.aspx

Contact:• My Blog

http://ronua.ro/CS/blogs/catalin/default.aspx• My Mail

catalin.gheorghiu@ronua.ro