共用方式為


AwaitExtensions.WaitForChangeAsync 方法

定義

會傳回工作,此工作會在指定的登錄機碼變更時完成。

public static System.Threading.Tasks.Task WaitForChangeAsync (this Microsoft.Win32.RegistryKey registryKey, bool watchSubtree = true, Microsoft.VisualStudio.Threading.RegistryChangeNotificationFilters change = Microsoft.VisualStudio.Threading.RegistryChangeNotificationFilters.Subkey | Microsoft.VisualStudio.Threading.RegistryChangeNotificationFilters.Value, System.Threading.CancellationToken cancellationToken = default);
static member WaitForChangeAsync : Microsoft.Win32.RegistryKey * bool * Microsoft.VisualStudio.Threading.RegistryChangeNotificationFilters * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function WaitForChangeAsync (registryKey As RegistryKey, Optional watchSubtree As Boolean = true, Optional change As RegistryChangeNotificationFilters = Microsoft.VisualStudio.Threading.RegistryChangeNotificationFilters.Subkey | Microsoft.VisualStudio.Threading.RegistryChangeNotificationFilters.Value, Optional cancellationToken As CancellationToken = Nothing) As Task

參數

registryKey
RegistryKey

要 watch 變更的登錄機碼。

watchSubtree
Boolean

true表示 watch 索引鍵子系索引鍵;false若要只 watch 沒有子系的這個索引鍵。

change
RegistryChangeNotificationFilters

指出 watch的變更類型。

cancellationToken
CancellationToken

令牌,可能會取消以釋放資源,以監看變更並完成已傳回的工作,如已取消。

傳回

當登錄機碼變更、句柄關閉或取消時完成的工作。

適用於