DispatcherPriority DispatcherPriority DispatcherPriority DispatcherPriority Enum


描述使用 Dispatcher 叫用作業的優先權。Describes the priorities at which operations can be invoked by way of the Dispatcher.

public enum class DispatcherPriority
public enum DispatcherPriority
type DispatcherPriority = 
Public Enum DispatcherPriority


ApplicationIdle ApplicationIdle ApplicationIdle ApplicationIdle 2

列舉值為 2。The enumeration value is 2. 在應用程式閒置時處理作業。Operations are processed when the application is idle.

Background Background Background Background 4

列舉值為 4。The enumeration value is 4. 在完成所有其他的非閒置作業後處理作業。Operations are processed after all other non-idle operations are completed.

ContextIdle ContextIdle ContextIdle ContextIdle 3

列舉值為 3。The enumeration value is 3. 在完成背景作業後處理作業。Operations are processed after background operations have completed.

DataBind DataBind DataBind DataBind 8

列舉值為 8。The enumeration value is 8. 以同等於資料繫結的優先權處理作業。Operations are processed at the same priority as data binding.

Inactive Inactive Inactive Inactive 0

列舉值為 0。The enumeration value is 0. 未處理作業。Operations are not processed.

Input Input Input Input 5

列舉值為 5。The enumeration value is 5. 以同等於輸入的優先權處理作業。Operations are processed at the same priority as input.

Invalid Invalid Invalid Invalid -1

列舉值為 -1。The enumeration value is -1. 優先權無效。This is an invalid priority.

Loaded Loaded Loaded Loaded 6

列舉值為 6。The enumeration value is 6. 在完成配置和轉譯時,但剛好於輸入優先權項目接受服務之前處理作業。Operations are processed when layout and render has finished but just before items at input priority are serviced. 當引發載入事件時特別會使用此項目。Specifically this is used when raising the Loaded event.

Normal Normal Normal Normal 9

列舉值為 9。The enumeration value is 9. 以一般優先權處理作業。Operations are processed at normal priority. 這是一般的應用程式優先權。This is the typical application priority.

Render Render Render Render 7

列舉值為 7。The enumeration value is 7. 以同等於轉譯的優先權處理作業。Operations processed at the same priority as rendering.

Send Send Send Send 10

列舉值為 10。The enumeration value is 10. 在其他非同步作業之前處理作業。Operations are processed before other asynchronous operations. 這是最高的優先權。This is the highest priority.

SystemIdle SystemIdle SystemIdle SystemIdle 1

列舉值為 1。The enumeration value is 1. 在系統閒置時處理作業。Operations are processed when the system is idle.


下列範例是對BeginInvoke的呼叫, 它會傳遞接受引數的委派。The following example is a call to BeginInvoke that passes a delegate which accepts an argument. 優先順序設定為 [一般]。The priority is set to Normal.

// Schedule the update function in the UI thread.
    new OneArgDelegate(UpdateUserInterface), 
' Schedule the update function in the UI thread.
tomorrowsWeather.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, New OneArgDelegate(AddressOf UpdateUserInterface), weather)


在目前的WPFWPF版本中, 沒有對應至 ApplicationIdle 和 CoNtextIdle 的特定系統狀態或「空閒」。There is no specific system state or "idleness" corresponding to ApplicationIdle and ContextIdle in the current version of WPFWPF. 兩者仍然是有效的優先順序;因此, 優先順序為 CoNtextIdle 的作業, 其優先順序高於優先順序為 SystemIdle 的作業。Both are still valid priorities; therefore, an operation with a priority of ContextIdle has a higher priority than an operation with a priority of SystemIdle.

如果作業超過特定的 CPU 百分比, 就不會節流作業的執行。ApplicationIdleThe ApplicationIdle does not throttle the execution of an operation if it exceeds a certain percentage of the CPU. 節流處理常式以使用計時器的一種方式。One way to throttle a process it to use a timer.

如果作業是在傳送時Invoke以自己ContextIdle的優先順序使用來張貼, 作業會略過佇列並立即執行。If an operation is posted using Invoke on its own ContextIdle at a priority of Send, the operation bypasses the queue and is immediately executed.