1. 在Windows Phone 7中最簡單的操作IsolatedStorge的代碼: SaveNote()將文本框內容保存到Note.txt中,E " /> 毛片内射久久久一区,美国ZOOM动物在线观看,亚洲欧美国产综合在线

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

Windows Phone 7 Tips (2)

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

  2. Windows Phone 7中的Orientation。

  分為 Portrait(豎屏)和Landscape(直屏)和PortraitOrLandscape(豎屏或橫屏,在切換橫豎屏時會自動切換)。并且又分為支持方向和啟動方向,支持方向支持Portrait、Landscape和PortraitOrLandscape,啟動方向支持Landscape、LandscapeLeft、LandscapeRight、Portrait、PortraitDown和PortraitUp。

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

  Canvas:絕對定位控件,速度快,可用于游戲。

  Grid:網格定位控件,比較常用。

  StackPanel:自動定位控件,推薦使用與小區域。

  4. 簡單敘述下Windows Phone 7中的生命周期。以下的一張圖會對你有所幫助:

  具體的應用程序的事件及什么時候觸發如下表: 

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 應用程序的第一個頁面在5秒內加載渲染好,在20秒內你的應用程序可用!

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

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

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

 ?。?). 當你點擊回退按鈕式,程序必須返回上一個頁面。

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

 ?。?). 如果你的應用程序真在現實一個對話框或者Context Menu,點擊回退按鈕時,Windows Phone 7自動關閉對話框或者 Context Menu。

  8. 在Windows Phone 7 應用程序會有兩種不同數據:持久性數據(Persistent Data)和瞬態狀態(Transient State)。

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

  瞬態狀態:存在于某個特定的程序回話中,如頁面狀態,web 請求緩存,瞬態狀態以PhoneApplicationService.State 屬性存在。

 有效性范圍存儲位置讀/寫
持久性數據Phone上的所有應用程序IsolatedStorage程序打開/關閉,或者程序運行時
瞬態狀態應用程序回話PhoneApplicationService的State屬性程序無效/激活時

  9. 我們最好不要在應用程序的Application_Launching和Application_Activated 事件中從隔離存儲空間中加載數據,因為這樣會使我們的程序啟動變慢。

  10. IsolatedStorageSetttings 類提供一個簡單序列化數據,我們可以使用現有的序列化方法(如json等)將數據持久到隔離存儲空間中。

  CHM文件下載:(41KB)

it知識庫Windows Phone 7 Tips (2),轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 中文字幕亚洲欧美日韩2019 | 亚洲欧美国产综合在线 | 国产午夜一级鲁丝片 | 肉多的小说腐小说 | 国产精华av午夜在线观看 | 国产成人在线免费 | 三叶草成人 | 无码观看AAAAAAAA片 | 精品久久久久久久国产潘金莲 | 亚洲国产在线精品国偷产拍 | 丰满的女朋友 在线播放 | 國産麻豆AVMDMD0179| 欧美一区二区三区激情视频 | 亚洲国产在线99视频 | 永久久久免费人妻精品 | 久久精品九九亚洲精品天堂 | 亚洲福利电影一区二区? | 99久久久国产精品免费蜜臀 | 亚州笫一色惰网站 | 亚洲AV永久无码精品澳门 | 色橹橹欧美在线观看视频高清 | 69精品国产人妻蜜桃国产毛片 | 老外的好大c的我好爽 | 久久棋牌评测 | 色就色 综合偷拍区欧美 | 一区二区视频在线观看高清视频在线 | 欧美eee114 | 午夜在线观看免费完整直播网页 | 三级黄视频 | 国产学生在线播放精品视频 | GAY东北澡堂激情2022 | 秋霞电影网午夜免费鲁丝片 | 国产精品久久久久久无码专区 | 亚洲免费大全 | 欧美午夜精品久久久久久浪潮 | 青青草原伊人 | 亚洲视频一区在线 | 边摸边吃奶边做激情叫床视 | 三级黄在线 | 国产AV高清怡春院 | caoporen超碰在线视频 |