设计并编写一个Windows Mobile 6.5今日界面
2009-10-16 21:33 王克伟 阅读(5038) 评论(19) 编辑 收藏 举报最近在开发ViewSonic的V901,使用Windows Mobile 6.5系统,480x800像素的高清屏幕着实也吸引了我自己,等开发好我自己也许也要买一台。既然是高清的,总得有个漂亮的今日界面,借此机会研究一把。ViewSonic V901网上已经有介绍了,附上截图:
如果你今日界面开发感兴趣,可以在读过这篇文章之后参考开发文档自己动手实现有创意,并且实用的今日插件,如果需要我的帮助可以联系我。如果你认为你的应用不错,可以考虑放到微软的应用程序商店。
先体验下Marketplace吧,目前可见的应用程序寥寥无几,并且全部是免费的,看来趋势不妙。
进入正题,可能很多还不清楚什么是Windows Mobile的今日界面,Windows Mobile 6.5 Professional的Today包括2种:the built-in Windows Default Today Screen(左图)和the Legacy Today Screen(中图)。并且它们是互斥的(右图)。
定制Today有3种方法:
1.扩展the built-in Windows Default Today,
2.编写一个the Legacy Today Screen Plugin,
3.编写一个界面应用程序完全替换掉built-in Today。
下图展示的是什么都没有的Today:
第1种方法较简单,也最快捷,其扩展方式是基于XML文件和注册表的,改改配配就搞定。你开发得到的plugin仍然支持默认的touch和gesture。
我们开发者要思考微软这么设计扩展方式有何好处?我们开发的程序能不能提供类似的扩展设计(比如程序的皮肤、多国语言支持、按键布局等等)?或者更简洁的?
第2种方法是旧版本遗留下来的,后面介绍其开发方法。
第3种方法定制最彻底,就像Moto Today一样,开发力度也最大。我更偏重这种方式,因为能够让我们的手机与众不同,起到产品标识的作用(要让用户认识到是这是你们公司的产品)。
手机用户可以选择第1种方式,业余开发者可以选择第2种,专业开发者可以选择第3种。
扩展the built-in Windows Default Today
1.能够定制哪些东西?
Create a new Today screen layout
Organize and remove plug-ins from the Today screen
Create and add custom plug-ins with custom assets and notifications
Customize the layout of plug-ins for portrait and landscape modes
Replace plug-in common controls, such as the List View and the Next Page Indicator
Customize the right soft key (SK2) for each custom plug-in page
Customize the Talk button for each custom plug-in page
Customize the tap gesture for each custom plug-in page
Limit the frequency of updates for custom plug-ins to conserve battery life
Add Favorites to the built-in Internet Explorer Mobile 6 Favorites plug-in
Change the background that is shared with the Lock screen and the Start screen
2.具体定制步骤?
定制工作主要分为3部分:注册表配置(包括两部分:Today整体配置部分,比如整体布局、所要使用的CPR文件等;数据源配置,比如配置按键的布局等)、CPR文件(基于XML)编写。
注册表配置
下图所示的是the built-in Windows Default Today在注册表中的位置:
HKEY_LOCAL_MACHINE\Software\Microsoft\CHome\ExtensibilityXML里面的XML字符串数据示例:
<!-- Today Screen Plug-in Settings -->
<Plugin>
<Plugins Order="CClock;CAppointments;CEmail;CVoicemail;DocFavs" CPRFileName="EnterpriseHS.cpr">
<CustomPlugin Name="DocFavs" LocName="Document Favorites" GUID="{F0A1B246-6E64-40cd-8E15-347D29FF6F18}">
<DataSource>Software\MyKey\TitaniumPlugins\DocFavs</DataSource>
<Layout>DocFavs</Layout>
</CustomPlugin>
</Plugins>
</Plugin>
数据源定义插件的行为,看看自定义插件的数据源是如何定义的:
HKLM\Software\MyKey\TitaniumPlugins\DocFavs
Pages = "page1;page2;page3"
Updated = "0"
HKLM\Software\MyKey\TitaniumPlugins\DocFavs\page1
FileImage = "\Windows\TextDocIcon.png"
Line1 = "Summary"
Line2 = "summary.docx"
Line3 = "Jan 16, 2009"
PageCounter = "1"
[SK2Text] = “Details”
[SK2URL] = “..\ExampleCustomPlugin\FileDetails.lnk”
[ActionURL] = “..\ExampleCustomPlugin\TextDoc.lnk”
[TalkURL] = “..\ExampleCustomPlugin\FileDetails.lnk”
HKLM\Software\MyKey\TitaniumPlugins\DocFavs\page2
FileImage = "\Windows\SpreadsheetIcon.png"
Line1 = "Annual Stats"
Line2 = "stats.xls"
Line3 = "Dec 28, 2008"
PageCounter = "2"
[SK2Text] = “Details”
[SK2URL] = “..\ExampleCustomPlugin\FileDetails.lnk”
[ActionURL] = “..\ExampleCustomPlugin\SpreadSheets.lnk”
[TalkURL] = “..\ExampleCustomPlugin\FileDetails.lnk”
HKLM\Software\MyKey\TitaniumPlugins\DocFavs\page3
FileImage = "\Windows\NoteIcon.png"
Line1 = "Meeting Notes"
Line2 = "meeting01.txt"
Line3 = "Jan 15, 2009"
PageCounter = "3"
[SK2Text] = “Details”
[SK2URL] = “..\ExampleCustomPlugin\FileDetails.lnk”
[ActionURL] = “..\ExampleCustomPlugin\Notes.lnk”
[TalkURL] = “..\ExampleCustomPlugin\FileDetails.lnk”
HKLM\Software\MyKey\TitaniumPlugins\DocFavs\CondensedPage
DocFavsSmallIcon = "\Windows\DocFavsSmallIcon.png"
DocFavsCondensedText = "Condensed at-a-glance data"
以下是对上面每项值的解释:
Pages
Lists the page names that are used to look up the subkeys for each plug-in page. The list does not include a subkey for the condensed view of the plug-in.
Page
A subkey that contains a set of controls contained in a plug-in page.
CondensedPage
A subkey that contains a set of controls displayed by the condensed view of the plug-in page.
Updated
Specifies whether plug-in content should be updated.
DelayedPageDataLoading
Specifies when plug-in content should be updated.
SK2Text
Specifies the text string that is displayed on the SK2.
SK2URL
Specifies the action that is taken when user selects the SK2. The SK2URL value is a string value which contains the location of a link file.
ActionURL
Specifies the action that is taken when user taps the plug-in. The ActionURL value is a string value which contains the location of a link file.
TalkURL
Specifies the action that is taken when user selects the Talk button. The TalkURL value is a string value which contains the location of a link file.
CPR文件配置
CPR文件编写内容较多,在此略过,你可以参照SDK文档和默认的CPR文件修改非常容易。可以看到微软默认的CPR文件位置如下图:
所要做的工作主要有:
创建插件布局模板
自定义插件的通用控件
最后你可能需要测试、优化Performance和UX,参考文档,里面有很好的建议。(我想每个优秀的软件在开发过程中都需要注意Performance和UX。)
下篇文章介绍编写一个the Legacy Today Screen Plugin。
出处: http://wangkewei.cnblogs.com/
版权声明: 本文的版权归作者与博客园共有。转载时须注明本文的详细链接,否则作者将保留追究其法律责任的权利。
您可以从这里更方便的找到我的文章。