天天看點

Windows Phone 7 隔離存儲空間資料總管

我們知道Windows Phone 7 目前是不支援通路外部存儲空間的,我們的應用程式可以使用的資料空間包括隔離存儲空間(IsolatedStorage)和雲端(Could)空間。作為開發人員,我們以前隻能想象獨立存儲空間的存儲,今天推薦一個可以直接檢視我們Windows Phone 7的IsolatedStorage的資料總管。

我們下載下傳可執行檔案進行安裝

<a href="http://blog.51cto.com/attachment/201105/091341671.png" target="_blank"></a>

那麼怎麼在項目中使用這個工具呢?

首先我們需要添加該工具類的dll引用

<a href="http://blog.51cto.com/attachment/201105/091417477.png" target="_blank"></a>

接着我們需要在應用程式的啟動的時候添加如下代碼,在App.xaml.cs的Application_Launching 事件中

<a href="http://blog.51cto.com/attachment/201105/091446644.png" target="_blank"></a>

同樣,當程式被Tombstone再恢複的時候,我們也需要重新加載隔離存儲空間的内容

<a href="http://blog.51cto.com/attachment/201105/091511964.png" target="_blank"></a>

現在隔離存儲空間資料總管已經加載到我們的應用程式中了,我們如何檢視隔離存儲空間裡面的内容呢?

從啟動菜單中點選剛剛安裝的WP7 Isolated Storage Explorer(當然桌面會有快捷方式,點選其也可)

<a href="http://blog.51cto.com/attachment/201105/091540403.png" target="_blank"></a>

開打後,會發現我們的隔離存儲空間沒有什麼檔案,是的,該應用程式剛剛運作

<a href="http://blog.51cto.com/attachment/201105/091602910.png" target="_blank"></a>

我們添加一個檔案到隔離存儲空間後,會發現剛剛添加的txt檔案已經出現在隔離存儲空間資料總管中:

<a href="http://blog.51cto.com/attachment/201105/091635477.png" target="_blank"></a>

當然我們可以右擊Isolated Storage File 直接添加檔案夾、檔案等

<a target="_blank" href="http://blog.51cto.com/attachment/201105/2621421_1306459053.rar"></a>

<a href="http://down.51cto.com/data/2358246" target="_blank">附件:http://down.51cto.com/data/2358246</a>

    本文轉自xshf12345 51CTO部落格,原文連結:http://blog.51cto.com/alexis/575299,如需轉載請自行聯系原作者

繼續閱讀