我已經基於測驗遊戲創建了Windows手機應用程序。我希望當用戶給出一些問題的正確答案時,問題標籤上的小勾號將會永久顯示。 我想存儲每個問題的分數,以便我可以在地名中顯示爲'您的分數'。即使應用已關閉,該分數也不會重置。在windows phone應用程序中存儲和獲取數據
0
A
回答
0
你可以使用應用程序IsolatedStorage保存文件。
#region Save and Load Parameters from the Application Storage
void saveToAppStorage(String ParameterName, String ParameterValue)
{
// use mySettings to access the Apps Storage
IsolatedStorageSettings mySettings = IsolatedStorageSettings.ApplicationSettings;
// check if the paramter is already stored
if (mySettings.Contains(ParameterName))
{
// if parameter exists write the new value
mySettings[ParameterName] = ParameterValue;
}
else
{
// if parameter does not exist create it
mySettings.Add(ParameterName, ParameterValue);
}
}
String loadFromAppStorage(String ParameterName)
{
String returnValue = "_notSet_";
// use mySettings to access the Apps Storage
IsolatedStorageSettings mySettings = IsolatedStorageSettings.ApplicationSettings;
// check if the paramter exists
if (mySettings.Contains(ParameterName))
{
// if parameter exists write the new value
mySettings.TryGetValue<String>(ParameterName, out returnValue);
// alternatively the following statement can be used:
// returnValue = (String)mySettings[ParameterName];
}
return returnValue;
}
#endregion
相關問題
- 1. 在Windows Phone應用程序中獲取SIM MSISDN和IMSI號碼
- 2. 在windows phone中存儲應用程序通用數據的位置?
- 3. 在Windows Phone 8應用程序中讀取JSON URL數據
- 4. 在Windows Phone 7中存儲數據
- 5. 在Windows Phone中存儲敏感數據
- 6. 在Windows Phone 8.1中獲取用戶數據通用應用程序
- 7. 如何在windows phone中存儲應用程序狀態
- 8. Windows 7 Phone應用程序存儲憑據的最佳方式
- 9. 從Windows Phone應用程序獲取未應答的呼叫數
- 10. 將用戶數據存儲在Windows 8 metro應用程序中
- 11. Windows Phone應用程序 - 開始頁面取決於FileExist在獨立存儲中
- 12. 存儲數據以供Android和Windows應用程序使用
- 13. 如何在Windows Phone 8應用程序中獲取ISO屬性?
- 14. 獨立存儲不工作在Windows Phone應用程序
- 15. 錯誤獲取HTTP Web響應在Windows Phone應用程序
- 16. 存儲在移動應用程序中的數據(Windows 8)
- 17. 如何在windows應用程序中存儲數據
- 18. 如何將數據存儲在.net Windows應用程序中
- 19. 將從Web服務接收的數據存儲在windows phone 7應用程序的隔離存儲中
- 20. 在Windows Phone應用程序中使用全局類在Windows Phone中保存數據
- 21. Windows 8應用程序和Windows Phone應用程序提交
- 22. 在Windows Phone 7應用程序中使用數據庫
- 23. 使用獨立存儲升級Windows Phone 7.5應用程序
- 24. 「Windows Phone應用程序」和「Silverlight for Windows Phone應用程序」有何區別?
- 25. Android應用程序開發 - 在數據庫中存儲和提取數據
- 26. Windows Phone應用程序內存消耗
- 27. 在Windows Mobile,Windows Phone 7和Windows Phone 8中開發應用程序
- 28. 獲取商店中的Windows Phone應用程序的版本
- 29. Windows Phone 7.1應用程序直接訪問Azure存儲
- 30. Windows Phone經過身份驗證的雲存儲應用程序
你有沒有做過這方面的任何研究嗎?您可以在Google或甚至StackOverflow上找到大量答案... –