自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Windows Mobile 6.5中Widgets開發(fā)初體驗(yàn)

移動(dòng)開發(fā)
Windows Mobile 6.5的DTK終于發(fā)布了,其中最吸引人的是兩個(gè)功能:Widgets和Gesture API。Widgets是近來非常流行的一項(xiàng)技術(shù),用于顯示一些常用信息,比如天氣、股票、新聞和體育等。Google Android和Symbian上已經(jīng)有了類似的技術(shù),可以說,Widgets是很好地結(jié)合了移動(dòng)設(shè)備與互聯(lián)網(wǎng)的技術(shù)。雖然Widgets開發(fā)簡單,但很有可能改變移動(dòng)互聯(lián)網(wǎng)的未來格局。

Widgets開發(fā)環(huán)境

好了,我們先要看一下,如何為Windows Mobile 6.5開發(fā)一個(gè)Widgets控件。首先,我們需要下載Windows Mobile 6.5的DTK,下載鏈接為:

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=20686a1d-97a8-4f80-bc6a-ae010e085a6e

Windows Mobile 6.5的DTK需要與Windows Mobile 6 SDK配合使用,Windows Mobile 6 SDK的下載地址:

http://www.microsoft.com/downloads/details.aspx?familyid=06111a3a-a651-4745-88ef-3d48091a390b&displaylang=en

由于很多Widgets都需要聯(lián)網(wǎng),所以測試環(huán)境也需要ActiveSync的支持。Vista應(yīng)該使用Windows Mobile Device Center 6.1,下載地址:

http://www.microsoft.com/windowsmobile/en-us/help/synchronize/device-center-download.mspx

編寫Widgets

接下來,我們就可以來進(jìn)行一個(gè)Widgets開發(fā)了。首先創(chuàng)建一個(gè)WidgetDemo的文件夾,創(chuàng)建一個(gè)叫做widget.htm的文件,將下面的HTML代碼拷貝到文件中:

  1. <html> 
  2. <head>   
  3. <title>Cool Widget!</title>   
  4. </head>   
  5. <body>   
  6. I'm a cool windows mobile 6.5 widget   
  7. <!-- Search Google --> 
  8. <form method="get" action="http://www.google.cn/custom" target="google_window"> 
  9. <table bgcolor="#ffffff"> 
  10. <tr><td nowrap="nowrap" valign="top" align="left" height="32"> 
  11. <a href="http://www.google.com/"> 
  12. <img src="http://www.google.com/logos/Logo_25wht.gif" border="0" alt="Google" align="middle"></img></a> 
  13. <label for="sbi" style="display: none">????????</label></tr> 
  14. <tr> 
  15. <input type="text" name="q" size="31" maxlength="150" value="" id="sbi"></input> 
  16. <label for="sbb" style="display: none">??????</label> 
  17. <input type="submit" name="sa" value="??" id="sbb"></input> 
  18. <input type="hidden" name="client" value="pub-9289651901062754"></input> 
  19. <input type="hidden" name="forid" value="1"></input> 
  20. <input type="hidden" name="ie" value="UTF-8"></input> 
  21. <input type="hidden" name="oe" value="UTF-8"></input> 
  22. <input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1"></input> 
  23. <input type="hidden" name="hl" value="zh_CN"></input> 
  24. </td></tr></table> 
  25. </form> 
  26. <!-- Search Google --> 
  27. </body>   
  28. </html> 

這個(gè)Widget就是調(diào)用Google的搜索頁面。原來的Widget Demo沒有Google搜索的代碼,我從網(wǎng)上找了一個(gè)示例加了進(jìn)去。接下來,創(chuàng)建一個(gè)叫做config.xml的文件,將下列代碼拷貝到文件中

 

這是一個(gè)描述性的XML文件,結(jié)構(gòu)非常清晰,不需要多做解釋了。注意content,icon和access network三個(gè)節(jié)點(diǎn)。Content的src就是我們剛編寫的widget.htm, 允許Widget訪問網(wǎng)絡(luò),icon則是顯示在Windows Mobile開始菜單里的圖標(biāo)。

項(xiàng)目結(jié)構(gòu)

現(xiàn)在有了三個(gè)文件,我們使用WinZip將其壓縮成一個(gè)ZIP文件。特別需要指出的是,我們不能壓縮這三個(gè)文件所在的文件夾,必須選中所有文件之后進(jìn)行壓縮。然后我們將WidgetDemo.zip的擴(kuò)展名改為WidgetDemo.wgt。

部署Widget

到這里,Widget開發(fā)就完成了。通過ActiveSync或者共享目錄,將Widget拷貝到Windows Mobile 6.5的模擬器中。

Widgets頁面1 Widgets頁面2

我們使用File Explorer來找到這個(gè)Widget文件,點(diǎn)擊之后,會(huì)提示是否安裝并運(yùn)行這個(gè)Widget。

安裝Widget之后,會(huì)自動(dòng)運(yùn)行,Google的圖標(biāo)來源于網(wǎng)絡(luò),所以可能會(huì)顯示慢一些。如果Google圖標(biāo)沒有顯示出來,則說明網(wǎng)絡(luò)連接不通:

手機(jī)草圖Widgets頁面

輸入關(guān)鍵字,點(diǎn)擊button,Widget會(huì)自動(dòng)啟動(dòng)IE Mobile,顯示搜索結(jié)果。

在使用時(shí),我們可以在開始菜單里找到相應(yīng)的圖標(biāo),可以打開Widget。還需要說明的是,如何卸載這個(gè)Widget。

在開始菜單 - Setting – System - Remove Programs里,可以看到我們的Widget,與卸載普通的應(yīng)用程序沒有區(qū)別。

第一個(gè)Widgets項(xiàng)目

 

我們的Widget被安裝在\Program Files\Widgets\User\7的目錄里,目錄的序號(hào)與安裝順序有關(guān),比如1里就是內(nèi)置的Live Search。

寫在最后

寫到這里,Widget開發(fā)就完成了,怎么樣?簡單吧。Widget開發(fā)的簡單性,正是它未來可能締造輝煌的主要優(yōu)勢(shì)。任何熟悉HTML和JavaScript的人都可以開發(fā)出功能豐富的Widget,而Widget又可以像普通應(yīng)用程序一樣使用。

雖然不像Palm的WebOS那樣具有顛覆性,但是依托于目前的技術(shù),才能獲得大多數(shù)開發(fā)者的支持?,F(xiàn)在只有Windows Mobile 6.5支持Widget,但其他移動(dòng)設(shè)備是否有可能支持Widget呢?一切皆有可能。

總之,一句話,大有可為!

【編輯推薦】

  1. Windows Mobile 6.5將在5月推出
  2. 微軟稱已完成Windows Mobile6.5開發(fā)
  3. 微軟開始組織開發(fā)大型Windows Mobile應(yīng)用程序
  4. 微軟將推出Windows Mobile應(yīng)用軟件商店
  5. Windows Mobile上實(shí)現(xiàn)自動(dòng)拼寫和匹配

  1. <?xml version="1.0" encoding="utf-8" ?>   
  2. <widget version="1.0"   
  3. xmlns="http://www.w3.org/ns/widgets"   
  4. id="">   
  5. <name>My first widget</name>   
  6. <content src="widget.htm" type="text/html" />   
  7. <access network="true" />   
  8. <icon src="icon.png"/>   
  9. <description>This is my first widget,   
  10. it won't make a lot of money on the   
  11. marketplace but at least is cute!</description>   
  12. </widget> 
責(zé)任編輯:彭凡 來源: cnblogs
相關(guān)推薦

2010-05-23 10:29:29

Widget開發(fā)

2009-03-12 08:34:54

2011-09-08 10:18:09

Windows MobWidgets

2011-04-25 16:40:21

開發(fā)環(huán)境搭建Windows Mob

2011-09-08 10:04:07

Windows MobWidget

2012-05-16 10:50:17

Windows Pho

2009-05-18 09:06:37

微軟WMWindows Mob

2009-02-22 09:04:51

WM 6.5SoftKey改進(jìn)

2009-08-10 09:46:06

中國移動(dòng)Mobile

2009-06-04 14:18:44

Windows Mob工具包

2009-05-19 10:44:23

微軟Windows mob移動(dòng)OS

2011-04-25 17:17:55

Gesture APIWindows Mob

2009-06-01 08:48:44

微軟Windows Mob移動(dòng)OS

2009-04-28 09:47:44

WM6.5Windows Mob智能手機(jī)

2011-09-15 15:03:10

2009-02-17 10:41:38

Windows Mob操作高清照片

2010-03-26 09:13:00

Windows Mob系統(tǒng)更新

2010-02-02 17:04:38

Windows MobWindows Mob下載

2012-08-01 14:12:43

Windows Ser

2013-07-19 15:05:04

點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)