diff --git a/src/Uno.UI.Runtime.Skia.Gtk/GtkHost.cs b/src/Uno.UI.Runtime.Skia.Gtk/GtkHost.cs index 95dde2a40b93..54f844a8fb09 100644 --- a/src/Uno.UI.Runtime.Skia.Gtk/GtkHost.cs +++ b/src/Uno.UI.Runtime.Skia.Gtk/GtkHost.cs @@ -91,15 +91,6 @@ public void Run() Gtk.Application.Quit(); }; - bool EnqueueNative(DispatcherQueuePriority priority, DispatcherQueueHandler callback) - { - Dispatch(() => callback()); - - return true; - } - - Windows.System.DispatcherQueue.EnqueueNativeOverride = EnqueueNative; - void Dispatch(System.Action d) { if (Gtk.Application.EventsPending()) diff --git a/src/Uno.UI.Runtime.Skia.Linux.FrameBuffer/FramebufferHost.cs b/src/Uno.UI.Runtime.Skia.Linux.FrameBuffer/FramebufferHost.cs index ff8f58da005f..d3706f55d2af 100644 --- a/src/Uno.UI.Runtime.Skia.Linux.FrameBuffer/FramebufferHost.cs +++ b/src/Uno.UI.Runtime.Skia.Linux.FrameBuffer/FramebufferHost.cs @@ -55,7 +55,6 @@ void Dispatch(System.Action d) _eventLoop.Schedule(() => d()); } - Windows.System.DispatcherQueue.EnqueueNativeOverride = EnqueueNative; Windows.UI.Core.CoreDispatcher.DispatchOverride = Dispatch; Windows.UI.Core.CoreDispatcher.HasThreadAccessOverride = () => _isDispatcherThread; diff --git a/src/Uno.UI.Runtime.Skia.Tizen/TizenHost.cs b/src/Uno.UI.Runtime.Skia.Tizen/TizenHost.cs index 887f811fe411..fdd8a538f403 100644 --- a/src/Uno.UI.Runtime.Skia.Tizen/TizenHost.cs +++ b/src/Uno.UI.Runtime.Skia.Tizen/TizenHost.cs @@ -76,8 +76,6 @@ bool EnqueueNative(DispatcherQueuePriority priority, DispatcherQueueHandler call return true; } - Windows.System.DispatcherQueue.EnqueueNativeOverride = EnqueueNative; - Windows.UI.Core.CoreDispatcher.DispatchOverride = (d) => EcoreMainloop.PostAndWakeUp(d); Windows.UI.Core.CoreDispatcher.HasThreadAccessOverride = () => EcoreMainloop.IsMainThread; diff --git a/src/Uno.UI.Runtime.Skia.Wpf/WpfHost.cs b/src/Uno.UI.Runtime.Skia.Wpf/WpfHost.cs index daa29daea7bf..2b2979b3592d 100644 --- a/src/Uno.UI.Runtime.Skia.Wpf/WpfHost.cs +++ b/src/Uno.UI.Runtime.Skia.Wpf/WpfHost.cs @@ -118,8 +118,6 @@ bool EnqueueNative(DispatcherQueuePriority priority, DispatcherQueueHandler call return true; } - Windows.System.DispatcherQueue.EnqueueNativeOverride = EnqueueNative; - Windows.UI.Core.CoreDispatcher.DispatchOverride = d => dispatcher.BeginInvoke(d); Windows.UI.Core.CoreDispatcher.HasThreadAccessOverride = dispatcher.CheckAccess; diff --git a/src/Uno.UWP/System/DispatcherQueue.Android.cs b/src/Uno.UWP/System/DispatcherQueue.Android.cs deleted file mode 100644 index 8acee4ba0e33..000000000000 --- a/src/Uno.UWP/System/DispatcherQueue.Android.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Windows.UI.Core; - -#if HAS_UNO_WINUI && IS_UNO_UI_PROJECT -namespace Microsoft.UI.Dispatching -#else -namespace Windows.System -#endif -{ - partial class DispatcherQueue - { - bool TryEnqueueNative(DispatcherQueuePriority priority, DispatcherQueueHandler callback) - { - var p = priority switch - { - DispatcherQueuePriority.Normal => CoreDispatcherPriority.Normal, - DispatcherQueuePriority.High => CoreDispatcherPriority.High, - DispatcherQueuePriority.Low => CoreDispatcherPriority.Low, - _ => CoreDispatcherPriority.Normal - }; - - CoreDispatcher.Main.RunAsync(p, () => callback()); - - return true; - } - } -} diff --git a/src/Uno.UWP/System/DispatcherQueue.cs b/src/Uno.UWP/System/DispatcherQueue.cs index a1c711cfea91..8cb8f758edbb 100644 --- a/src/Uno.UWP/System/DispatcherQueue.cs +++ b/src/Uno.UWP/System/DispatcherQueue.cs @@ -52,12 +52,21 @@ internal static void CheckThreadAccess() } public bool TryEnqueue(DispatcherQueueHandler callback) - { - return TryEnqueue(DispatcherQueuePriority.Normal, callback); - } + => TryEnqueue(DispatcherQueuePriority.Normal, callback); + public bool TryEnqueue(DispatcherQueuePriority priority, DispatcherQueueHandler callback) { - return TryEnqueueNative(priority, callback); + var p = priority switch + { + DispatcherQueuePriority.Normal => CoreDispatcherPriority.Normal, + DispatcherQueuePriority.High => CoreDispatcherPriority.High, + DispatcherQueuePriority.Low => CoreDispatcherPriority.Low, + _ => CoreDispatcherPriority.Normal + }; + + CoreDispatcher.Main.RunAsync(p, () => callback()); + + return true; } public bool HasThreadAccess diff --git a/src/Uno.UWP/System/DispatcherQueue.iOSmacOS.cs b/src/Uno.UWP/System/DispatcherQueue.iOSmacOS.cs deleted file mode 100644 index 8acee4ba0e33..000000000000 --- a/src/Uno.UWP/System/DispatcherQueue.iOSmacOS.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Windows.UI.Core; - -#if HAS_UNO_WINUI && IS_UNO_UI_PROJECT -namespace Microsoft.UI.Dispatching -#else -namespace Windows.System -#endif -{ - partial class DispatcherQueue - { - bool TryEnqueueNative(DispatcherQueuePriority priority, DispatcherQueueHandler callback) - { - var p = priority switch - { - DispatcherQueuePriority.Normal => CoreDispatcherPriority.Normal, - DispatcherQueuePriority.High => CoreDispatcherPriority.High, - DispatcherQueuePriority.Low => CoreDispatcherPriority.Low, - _ => CoreDispatcherPriority.Normal - }; - - CoreDispatcher.Main.RunAsync(p, () => callback()); - - return true; - } - } -} diff --git a/src/Uno.UWP/System/DispatcherQueue.net.cs b/src/Uno.UWP/System/DispatcherQueue.net.cs deleted file mode 100644 index 8acee4ba0e33..000000000000 --- a/src/Uno.UWP/System/DispatcherQueue.net.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Windows.UI.Core; - -#if HAS_UNO_WINUI && IS_UNO_UI_PROJECT -namespace Microsoft.UI.Dispatching -#else -namespace Windows.System -#endif -{ - partial class DispatcherQueue - { - bool TryEnqueueNative(DispatcherQueuePriority priority, DispatcherQueueHandler callback) - { - var p = priority switch - { - DispatcherQueuePriority.Normal => CoreDispatcherPriority.Normal, - DispatcherQueuePriority.High => CoreDispatcherPriority.High, - DispatcherQueuePriority.Low => CoreDispatcherPriority.Low, - _ => CoreDispatcherPriority.Normal - }; - - CoreDispatcher.Main.RunAsync(p, () => callback()); - - return true; - } - } -} diff --git a/src/Uno.UWP/System/DispatcherQueue.netstdref.cs b/src/Uno.UWP/System/DispatcherQueue.netstdref.cs deleted file mode 100644 index bd323138b96c..000000000000 --- a/src/Uno.UWP/System/DispatcherQueue.netstdref.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using Windows.UI.Core; - -#if HAS_UNO_WINUI && IS_UNO_UI_PROJECT -namespace Microsoft.UI.Dispatching -#else -namespace Windows.System -#endif -{ - partial class DispatcherQueue - { - [Uno.NotImplemented] - bool TryEnqueueNative(DispatcherQueuePriority priority, DispatcherQueueHandler callback) - { - throw new NotSupportedException(); - } - } -} diff --git a/src/Uno.UWP/System/DispatcherQueue.skia.cs b/src/Uno.UWP/System/DispatcherQueue.skia.cs deleted file mode 100644 index 59d48e17bc97..000000000000 --- a/src/Uno.UWP/System/DispatcherQueue.skia.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Runtime.CompilerServices; -using Windows.UI.Core; - -#if HAS_UNO_WINUI && IS_UNO_UI_PROJECT -namespace Microsoft.UI.Dispatching -#else -namespace Windows.System -#endif -{ - partial class DispatcherQueue - { - internal static Func EnqueueNativeOverride; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - bool TryEnqueueNative(DispatcherQueuePriority priority, DispatcherQueueHandler callback) - { - return EnqueueNativeOverride(priority, callback); - } - } -} diff --git a/src/Uno.UWP/System/DispatcherQueue.wasm.cs b/src/Uno.UWP/System/DispatcherQueue.wasm.cs deleted file mode 100644 index 8acee4ba0e33..000000000000 --- a/src/Uno.UWP/System/DispatcherQueue.wasm.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Windows.UI.Core; - -#if HAS_UNO_WINUI && IS_UNO_UI_PROJECT -namespace Microsoft.UI.Dispatching -#else -namespace Windows.System -#endif -{ - partial class DispatcherQueue - { - bool TryEnqueueNative(DispatcherQueuePriority priority, DispatcherQueueHandler callback) - { - var p = priority switch - { - DispatcherQueuePriority.Normal => CoreDispatcherPriority.Normal, - DispatcherQueuePriority.High => CoreDispatcherPriority.High, - DispatcherQueuePriority.Low => CoreDispatcherPriority.Low, - _ => CoreDispatcherPriority.Normal - }; - - CoreDispatcher.Main.RunAsync(p, () => callback()); - - return true; - } - } -}