`
剑锋无刃
  • 浏览: 31991 次
  • 性别: Icon_minigender_1
  • 来自: 长沙市
最近访客 更多访客>>
社区版块
存档分类
最新评论

windows phone 7项目的结构体系

阅读更多

首先建一个windows phone 7的项目



 2接下来我们讨论一下着一堆文件干什么用?

 

 

  • Propertys\WMAppmanifest.xml  

这个档案是记录了应用程序的相关属性描述,以及定义应用程序的功能性;我们不妨打开这个文件看一下都有什么?

 

<?xml version="1.0" encoding="utf-8"?>

<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2009/deployment" AppPlatformVersion="7.1">
  <App xmlns="" ProductID="{7db581a7-1c45-48c6-94b8-fdfaaf4f5e8a}" Title="sdkSimpleMotionCS" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal"  Author="sdkSimpleMotionCS author" Description="Sample description" Publisher="sdkSimpleMotionCS">
    <IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
    <Capabilities>
      <Capability Name="ID_CAP_GAMERSERVICES"/>
      <Capability Name="ID_CAP_IDENTITY_DEVICE"/>
      <Capability Name="ID_CAP_IDENTITY_USER"/>
      <Capability Name="ID_CAP_LOCATION"/>
      <Capability Name="ID_CAP_MEDIALIB"/>
      <Capability Name="ID_CAP_MICROPHONE"/>
      <Capability Name="ID_CAP_NETWORKING"/>
      <Capability Name="ID_CAP_PHONEDIALER"/>
      <Capability Name="ID_CAP_PUSH_NOTIFICATION"/>
      <Capability Name="ID_CAP_SENSORS"/>
      <Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
      <Capability Name="ID_CAP_ISV_CAMERA"/>
      <Capability Name="ID_CAP_CONTACTS"/>
      <Capability Name="ID_CAP_APPOINTMENTS"/>
    </Capabilities>
    <Tasks>
      <DefaultTask  Name ="_default" NavigationPage="MainPage.xaml"/>
    </Tasks>
    <Tokens>
      <PrimaryToken TokenID="sdkSimpleMotionCSToken" TaskName="_default">
        <TemplateType5>
          <BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
          <Count>0</Count>
          <Title>sdkSimpleMotionCS</Title>
        </TemplateType5>
      </PrimaryToken>
    </Tokens>
  </App>
</Deployment>

 

 那么,这些代码又起到什么作用呢?

 

<!--[if !supportLists]-->·         <!--[endif]-->ProductID:代表应用程序的 GUID 字符串

<!--[if !supportLists]-->·         <!--[endif]-->Title:项目的名称

<!--[if !supportLists]-->·         <!--[endif]-->RuntimeType:设定应用程序是 Silverlight 或是 XNA 的类型

<!--[if !supportLists]-->·         <!--[endif]-->Version:应用程序的版本编号

<!--[if !supportLists]-->·         <!--[endif]-->Genre Silverlight ---> apps.normal  XNA---->apps.game 

<!--[if !supportLists]-->·         <!--[endif]-->Author:开发者名称

<!--[if !supportLists]-->·         <!--[endif]-->Description:应用程序的描述

 

  Publisher:这个值预设会是项目的名称,如果应用程序有使用到 Push 的相关功能

   <Capabilities>区域代码功能:描述了应用能够使用的功能性,例如能不能使用网络的功能或是存取媒体柜 (Media library) 的内容;在一般的情形下,我们是不需要去修改到这个部分的,假设当你移除了某些功能,例如说移除了 WebBrowser 的部分

<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />

那么当你在程序代码中有使用到 WebBrowser 相关的功能时,程序便会出错了,而 unhandle exception Silverlight for Windows Phone 中是会直接关闭应用程序的,所以你看到的情形就会是『疑?我的程序怎么自动消失了』。

  <Tasks>:NavigationPage 的部分,假设你的起始页面 (第一个显示的 Page) 名称不是 MainPage 的话,可以在这边做对应的修改。

  <Tokens>:设定当你的应用程序加到 Tile (也就是首页的地方) 之后相关的设定;要特别注意 TaskName 这个地方的设定是在Tile点下你的应用程序之后,会去启动应用程序的相关设定,跟上面提到 <Tasks> Name 的属性是有相对应的关系的。BackgroundImageURI 是当你的应用程序锚定到首页 (Pin to Start) 之后的背景图案。

  • App.xaml

App.xaml App.xaml.cs 这两个档案,预设包含了 Lifecycle (应用程序生命周期) 的相关事件处理,包含初次启动、失去焦点 (通常发生在使用者启动另外一个应用程序) 等等的相关处理;这部分在这系列中谈到生命周期的部分会再跟各位说明。而其中也可以去定义一些全局的资源 (resource) 或是全局的方法来使用,

  • MainPage.xaml

预设的起始页面档案

  • ApplicationIcon.png (63 * 63 pixels)

应用程序行表中使用的图形,如果没有指定则会缩小 Background 的图形作为列表的应用程序图形

  • Background.png (173 * 173 pixels)

<!--[if !supportLists]-->·         <!--[endif]-->作为 Tile (位于首页上应用程序的链接) 上的应用程序的背景图案,支持 jpgpng 文件格式

<!--[if !supportLists]-->·         <!--[endif]-->过大或是太小的图形将会被自动缩放

  • SplashScreenImage.jpg (480 * 800 pixels)  

应用程序启动后,Mainpage.xaml 加载完成之前的等待画面

 

 

  • 大小: 19.7 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics