Windows Phone 7架构
Windows Phone 7的系统内核还是Windows CE,它是基于Windows CE 6.0 R3版本,所以从这个层面来讲操作系统内核基本没有变化,主要是将Shell和Application Layer的东西有较大变化,Application Layer是采用了.Net Framework托管的环境CLR,有两种编程Framework,Silverlight和XNA。以下是系统软件架构图:
更细致来看Windows Phone分成四个Layer,以下为Rich总结的四个层面:
CoreKernel is the indivisible minimum kernel (controlling the processor, memory and critical hardware)
Kernel includes everything else that runs in the kernel (e.g. logical kernel abstractions including threads, processes, etc., networking stack, device drivers, printer drivers, graphics & media drivers,KTM, ETW, etc.)
CoreOS is the core (mostly user-mode) OS substrate upon which the OS itself depends (e.g. Win32, COM, OLE, RPC, WMI, DirectX, etc.)
OS is the remaining set of other high-level essential and non-essential features that may, or may not, be installed by the OEM/user/etc. (e.g. Explorer, Silverlight, .NET, Media Center, IIS, etc.)
WP7开发
参照上图的功能层次我们可以看一下每个层面进行开发采用的环境和工具。
环境
开发语言
开发工具
部署工具
应用程序层
CLR
C#/VB
Visual Studio 2010 for Windows Phone
Visual Studio 2010 for Windows Phone
OS层
Native Code
C/C++
Visual Studio C++ 2008 sp1 or other tools
Platform Builder for Windows Phone
Kernel层(主要是BSP)
Native Code
C/C++
Visual Studio C++ 2008 sp1 or other tools
Platform Builder for Windows Phone
开发工具下载:
Visual Studio 2010 for Windows Phone可以通过微软网站免费下载
Visual Studio C++ 2008 sp1是需要花钱买的
Platform Builder for Windows Mobile的时候是可以公开下载的,但是for Windows Phone版本只面向OEM厂商开放,做ROM就是用这个工具。
通过这样的规则可以比较方便的理解和分析在任何时候用户点击后退键将发生什么情况。还有一个事实需要说明一下,在WP7中,同一个应用程序在系统中只能有一个实例,意味着你如果开着应用程序,通过开始键再打开一个,系统会把你原来那个实例杀掉。 3. Data Binding
Data Binding是微软实现将两个对象的属性之间建立桥接关系的一种便捷方式,Target和Source有三种绑定方式,OneTime,OneWay和TwoWay,一般来说你开发的应用程序通过MVVM的模式来进行设计,将数据和界面分离,然后通过Data Binding的方式自动关联界面的空间和你Model的数据。所以一般Target是你的UIElement,Source是你的ViewModel,当然你也可以将UIElement作为Source绑定到另外一个UIElement进行联动,更多信息请参考MSDN。 4. Execution Model
关于应用程序执行过程,新的7.1Mango版本差别比较大是引入和Dormant(休眠)状态,即当你的应用层被中断(例如来电话,或者用户点击开始键、搜索键等)时,你的程序线程将被终止,但内存还将保存,这点比7.0中直接进入Tombstone(墓碑,即内存也释放)好很多。