2014/12/16

[筆記] Windows Store App 使用 SuspensionManager 無法儲存頁面狀態的問題

其實在開發 Store App 時如果新增的頁面是 BasicPage.xaml 以上的頁面,就會自動在方案下面開一個 common 目錄,並放一些預設的 Helper 來協助快速開發 App, 其中 SuspensionManager.cs 就是用來提供儲存狀態的 Helper Class



然後按照: Saving and Restoring State in a Windows 8 XAML App 提供的操作方式


1.在 App 的 OnLaunched 加入
 SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

2.在 App 的 OnSuspending 加入
 await SuspensionManager.SaveAsync();
記得 OnSuspending  要 async 

3.在 App 中的 OnLaunched 判斷
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
 await SuspensionManager.RestoreAsync();
}


就可以實作出暫停/回復狀態的 App 了

2014/12/08

[筆記] Windows Store App 多國語系開發

之前無聊自己摸 Android App 時發現 Android App 的 resource 設定可以很快速的開發出多國語言版本,但寫  Windwos Store  App 時參考了兩三本書都沒有提到有關 string resource 的設定

Android 的 resource 除了 string resource 之外還有 layout, image 等等,而且在開啟專案時預設的範本就會有,只要添加新的語系目錄或是解析度目錄就可以了

微軟的預設範本只有 Assets目錄,沒有類似 android 下面的 res/values-{loc} 目錄

直到找到這篇  快速入門:使用字串資源 (XAML)

才知道原來微軟也有一樣的東西!!!!!


[筆記] Windows Store App 使用 Web Service 的權限問題

App capability declarations (Windows Runtime apps)


這問題困擾了好久,在我開發的電腦上存取 web service 時都不會有這個錯誤,但匯出安裝封裝給同事測試時大家都炸掉,炸掉的畫面如下