語言

PageContent.GetPageRootAsync(Boolean) 方法

定義

非同步載入並回傳 FixedPage 內容元素。

public:
 void GetPageRootAsync(bool forceReload);
public void GetPageRootAsync(bool forceReload);
member this.GetPageRootAsync : bool -> unit
Public Sub GetPageRootAsync (forceReload As Boolean)

參數

forceReload
Boolean

true即使 已載入並快FixedPage取,仍必須重新載入false;只有在沒有快取版本時才載入 。FixedPage

備註

GetPageRootAsync 非同步載入並解析 FixedPage 與此 PageContent相關資料流。 其他執行緒會在完成時 GetPageRootAsync 繼續運行。

以下步驟說明如何非同步載入 FixedPage 內容:

  1. 建立一個 GetPageRootCompletedEventHandler 代表並加入,這樣就能收到活動通知 GetPageRootCompleted 。

  2. 呼叫 GetPageRootAsync。

  3. 當 GetPageRootCompleted 事件發生且代理被呼叫時,內容 FixedPage 已完成載入。 載 FixedPage 入元素會透過 GetPageRootCompletedEventArgs.Result 屬性回傳。

欲了解更多關於該元素的 <PageContent> 資訊,請參閱 XPS 規範第 3 章,可於 XPS:規範與授權下載處取得。

此方法在任務中儲存所有非使用例外,該方法的同步對應程式可拋出這些例外。 如果回傳的任務中儲存了例外,該例外會在等待任務時拋出。 使用例外錯誤,例如 ArgumentException,仍會同步拋出。 關於儲存的例外,請參見由 GetPageRoot(Boolean)拋出的例外。

適用於

另請參閱