共用方式為


PageAsyncTask.State 屬性

定義

取得會表示工作狀態的物件。

public:
 property System::Object ^ State { System::Object ^ get(); };
public object State { get; }
member this.State : obj
Public ReadOnly Property State As Object

屬性值

Object,表示工作狀態。

範例

下列程式碼範例會建立三個非同步工作,並為它們提供其 State 屬性的唯一值。 此範例是類別概觀中找到較大範例的 PageAsyncTask 一部分。

PageAsyncTask asyncTask1 = new PageAsyncTask(slowTask1.OnBegin, slowTask1.OnEnd, slowTask1.OnTimeout, "Async1", true);
PageAsyncTask asyncTask2 = new PageAsyncTask(slowTask2.OnBegin, slowTask2.OnEnd, slowTask2.OnTimeout, "Async2", true);
PageAsyncTask asyncTask3 = new PageAsyncTask(slowTask3.OnBegin, slowTask3.OnEnd, slowTask3.OnTimeout, "Async3", true);

// Register the asynchronous task.
Page.RegisterAsyncTask(asyncTask1);
Page.RegisterAsyncTask(asyncTask2);
Page.RegisterAsyncTask(asyncTask3);
Dim asyncTask1 As New PageAsyncTask(AddressOf slowTask1.OnBegin, AddressOf slowTask1.OnEnd, AddressOf slowTask1.OnTimeout, "Async1", True)
Dim asyncTask2 As New PageAsyncTask(AddressOf slowTask2.OnBegin, AddressOf slowTask2.OnEnd, AddressOf slowTask2.OnTimeout, "Async2", True)
Dim asyncTask3 As New PageAsyncTask(AddressOf slowTask3.OnBegin, AddressOf slowTask3.OnEnd, AddressOf slowTask3.OnTimeout, "Async3", True)

' Register the asynchronous task.
Page.RegisterAsyncTask(asyncTask1)
Page.RegisterAsyncTask(asyncTask2)
Page.RegisterAsyncTask(asyncTask3)

備註

屬性 State 是在建構函式中設定,無法在非同步工作執行期間修改。 您可以將唯一字串值指派給其各自的 State 屬性,以區分頁面中的非同步工作。

適用於