From 8cb933a9d1f90bbf414ad38c80278c13c7c719d2 Mon Sep 17 00:00:00 2001 From: enitama <129673786+enitama@users.noreply.github.com> Date: Sun, 2 Apr 2023 23:35:10 +0900 Subject: [PATCH 1/2] Fix DispatcherQueueTimerExtensions example DispatcherQueueTimer does not have a public constructor. Update example to show how to create a DispatcherQueueTimer instance similar to https://github.com/MicrosoftDocs/winapps-winrt-api/blob/4a912fdbae00a0594556d2a3fbb9f721469b4bfe/microsoft.ui.dispatching/dispatcherqueuetimer.md#-examples. --- .../DispatcherQueueTimerExtensions.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dotnet/xml/CommunityToolkit.WinUI.UI/DispatcherQueueTimerExtensions.xml b/dotnet/xml/CommunityToolkit.WinUI.UI/DispatcherQueueTimerExtensions.xml index e6ea3d29d..af006fefb 100644 --- a/dotnet/xml/CommunityToolkit.WinUI.UI/DispatcherQueueTimerExtensions.xml +++ b/dotnet/xml/CommunityToolkit.WinUI.UI/DispatcherQueueTimerExtensions.xml @@ -53,7 +53,9 @@ To be added. - private DispatcherQueueTimer _typeTimer = new DispatcherQueueTimer(); + private DispatcherQueueController _queueController = DispatcherQueueController.CreateOnDedicatedThread(); + private DispatcherQueue _queue = _queueController.DispatcherQueue; + private DispatcherQueueTimer _typeTimer = _queue.CreateTimer(); _typeTimer.Debounce(async () => { From ba72adbb531ebfcadde1f87ec633aabf51e944d0 Mon Sep 17 00:00:00 2001 From: enitama <129673786+enitama@users.noreply.github.com> Date: Sun, 2 Apr 2023 23:45:03 +0900 Subject: [PATCH 2/2] Match Microsoft.Toolkit.Uwp.UI.DispatcherQueueTimerExtensions documentation instead More concise --- .../DispatcherQueueTimerExtensions.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dotnet/xml/CommunityToolkit.WinUI.UI/DispatcherQueueTimerExtensions.xml b/dotnet/xml/CommunityToolkit.WinUI.UI/DispatcherQueueTimerExtensions.xml index af006fefb..c34446d3d 100644 --- a/dotnet/xml/CommunityToolkit.WinUI.UI/DispatcherQueueTimerExtensions.xml +++ b/dotnet/xml/CommunityToolkit.WinUI.UI/DispatcherQueueTimerExtensions.xml @@ -53,9 +53,7 @@ To be added. - private DispatcherQueueController _queueController = DispatcherQueueController.CreateOnDedicatedThread(); - private DispatcherQueue _queue = _queueController.DispatcherQueue; - private DispatcherQueueTimer _typeTimer = _queue.CreateTimer(); + private DispatcherQueueTimer _typeTimer = DispatcherQueue.GetForCurrentThread().CreateTimer(); _typeTimer.Debounce(async () => {