1. 在Windows Phone 7中最簡(jiǎn)單的操作IsolatedStorge的代碼: SaveNote()將文本框內(nèi)容保存到Note.txt中,E " /> 美女脱了内裤张开腿让男人桶到爽,国产亚洲精品久久久久久入口,伦理片 a在线线版韩国

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

Windows Phone 7 Tips (2)

  上一篇Tips:Windows Phone 7 Tips (1), 今天也是分享10個(gè)Windows Phone 7 技巧,并提供離線文檔下載。
  1. 在Windows Phone 7中最簡(jiǎn)單的操作IsolatedStorge的代碼: SaveNote()將文本框內(nèi)容保存到Note.txt中,Edit()讀取Note.txt到文本框中。

  2. Windows Phone 7中的Orientation。

  分為 Portrait(豎屏)和Landscape(直屏)和PortraitOrLandscape(豎屏或橫屏,在切換橫豎屏?xí)r會(huì)自動(dòng)切換)。并且又分為支持方向和啟動(dòng)方向,支持方向支持Portrait、Landscape和PortraitOrLandscape,啟動(dòng)方向支持Landscape、LandscapeLeft、LandscapeRight、Portrait、PortraitDown和PortraitUp。

  3. Windows Phone 7中常見的UI布局控件比較。

  Canvas:絕對(duì)定位控件,速度快,可用于游戲

  Grid:網(wǎng)格定位控件,比較常用。

  StackPanel:自動(dòng)定位控件,推薦使用與小區(qū)域。

  4. 簡(jiǎn)單敘述下Windows Phone 7中的生命周期。以下的一張圖會(huì)對(duì)你有所幫助:

  具體的應(yīng)用程序的事件及什么時(shí)候觸發(fā)如下表: 

Application EventOccurs WhenYour Actions
Application_LaunchingThe user taps the entry for an application on the installed applications screen, and a new instance of an application is created.Do not read application settings from the isolated storage as that will slow down the loading process; do not attempt to restore transient state. When an application launches, it should always appear as a new instance.
Application_ActivatedFor this event to occur, two conditions must be met: (1) the user navigates away from your application, either by using a launcher or a chooser, or by starting another application and (2) the user then comes back to your application by either completing the launcher or chooser or using the hardware Back button. This event is not raised when an application is first launched.The application should allow the user to continue interaction as if she had never left the application; transient state information should be restored, but the application should not attempt to read the contents of the isolated storage to avoid potential slowdown.
Application_DeactivatedThe user navigates away from your application either by invoking a launcher or a chooser, or by launching another application. This event is not raised when your application is closing.You should save all transient (i.e., related to the current application session) state into the State dictionary. You should save persistent state to an isolated storage. Applications are given ten seconds to complete this event; after ten seconds, if this event is still not completed, an application will be terminated and not tombstoned.
Application_ClosingThe user uses the Back key to navigate past the first page of your application.

Save all of the persistent state into the isolated storage. 

  5. 確保你的Windows Phone 7 應(yīng)用程序的第一個(gè)頁(yè)面在5秒內(nèi)加載渲染好,在20秒內(nèi)你的應(yīng)用程序可用!

  6. Windows Phone 7 中圖片為Resource和Content的區(qū)別: 生成方式為Resource的圖片會(huì)被編譯到應(yīng)用程序集(DLL)里,而生成方式為Content的圖片則會(huì)被部署到XAP包中。

  當(dāng)你把你的圖片copy到項(xiàng)目中,圖片的生成動(dòng)作默認(rèn)是資源(Resource),但我通常選擇Content以獲取更快的速度。我們應(yīng)該如何選擇圖片的生成方式(Build Action)呢? 每種生成方式都有其用武之地:設(shè)置生成方式為Content意味著應(yīng)用程序可以更快的加載圖片資源;將生成方式設(shè)為Resource對(duì)你重新部署程序非常有用,這對(duì)類庫(kù)項(xiàng)目十分合適的。

  7. Windows Phone 7中的物理回退鍵:在Tips (1)中曾講到如何在PhoneApplicationPage_BackKeyPress事件中禁用物理回退鍵,即e.Cancel = true; 如果我們不編寫代碼,則當(dāng)我們點(diǎn)擊回退鍵時(shí),Windows Phone 7會(huì)做哪些事情呢?據(jù)我所知,有如下三種情況:

  (1). 當(dāng)你點(diǎn)擊回退按鈕式,程序必須返回上一個(gè)頁(yè)面。

  (2). 如果你是在程序的第一個(gè)頁(yè)面點(diǎn)擊回退按鈕,則應(yīng)用程序必須推出。

  (3). 如果你的應(yīng)用程序真在現(xiàn)實(shí)一個(gè)對(duì)話框或者Context Menu,點(diǎn)擊回退按鈕時(shí),Windows Phone 7自動(dòng)關(guān)閉對(duì)話框或者 Context Menu。

  8. 在Windows Phone 7 應(yīng)用程序會(huì)有兩種不同數(shù)據(jù):持久性數(shù)據(jù)(Persistent Data)和瞬態(tài)狀態(tài)(Transient State)。

  持久性數(shù)據(jù):如配置文件(settings)、隔離存儲(chǔ)空間(IsolatedStorage)。

  瞬態(tài)狀態(tài):存在于某個(gè)特定的程序回話中,如頁(yè)面狀態(tài),web 請(qǐng)求緩存,瞬態(tài)狀態(tài)以PhoneApplicationService.State 屬性存在。

 有效性范圍存儲(chǔ)位置讀/寫
持久性數(shù)據(jù)Phone上的所有應(yīng)用程序IsolatedStorage程序打開/關(guān)閉,或者程序運(yùn)行時(shí)
瞬態(tài)狀態(tài)應(yīng)用程序回話PhoneApplicationService的State屬性程序無(wú)效/激活時(shí)

  9. 我們最好不要在應(yīng)用程序的Application_Launching和Application_Activated 事件中從隔離存儲(chǔ)空間中加載數(shù)據(jù),因?yàn)檫@樣會(huì)使我們的程序啟動(dòng)變慢。

  10. IsolatedStorageSetttings 類提供一個(gè)簡(jiǎn)單序列化數(shù)據(jù),我們可以使用現(xiàn)有的序列化方法(如json等)將數(shù)據(jù)持久到隔離存儲(chǔ)空間中。

  CHM文件下載:(41KB)

it知識(shí)庫(kù)Windows Phone 7 Tips (2),轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 美女伸开两腿让我爽 | 欧美久久综合性欧美 | 259luxu高跟黑色丝袜系列 | 久热人人综合人人九九精品视频 | 亚洲 欧美 另类 中文 在线 | 黄梅戏mp3大全 | 丰满少妇发泄14p | 欧美2019高清hd巨大 | chinesetoilet美女沟 | 狠狠色丁香婷婷久久综合 | 99热都是精品| 公粗挺进了我的密道在线播放贝壳 | 国产精品亚洲第一区二区三区 | 超碰高清熟女一区二区 | 99久久婷婷国产麻豆精品电影 | 秋霞电影网视频一区二区三区 | 久久99国产精品自在自在 | 免费亚洲视频在线观看 | 影音先锋色小姐 | 97精品少妇偷拍蜜桃AV | 亚洲精品免费视频 | 欧美一道本一区二区三区 | 中文字幕午夜乱理片 | 国产AV精品久久久毛片 | 色拍拍噜噜噜啦啦新网站 | 日韩影院久久 | 国产精品乱码一区二区三 | 亚洲 日韩经典 中文字幕 | 艳鉧动漫1~6全集观看在线 | 久久国产欧美 | 富婆大保健嗷嗷叫普通话对白 | 精品一区二区三区四区五区六区 | 饥渴的护士自慰被发现 | 国产乱码精品一区二区三区四川 | 九色91精品国产网站 | 共妻肉多荤文高h一女n男 | 干极品美女 | 国产看午夜精品理论片 | 和搜子的日子 在线观看 | 大地影院在线播放 | 无码日韩人妻精品久久蜜桃入口 |