From 853529b5de40a3e71429f62171e5f21a61b8daa8 Mon Sep 17 00:00:00 2001 From: Jon Lipsky Date: Mon, 1 Jul 2019 13:30:34 -0500 Subject: [PATCH] Fixed UWP compilation issue. --- src/HotUI.UWP/Handlers/ViewHandler.cs | 2 +- src/HotUI.UWP/UI.cs | 28 ++++----------------------- src/HotUI.WPF/HotUI.WPF.csproj | 1 + 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/src/HotUI.UWP/Handlers/ViewHandler.cs b/src/HotUI.UWP/Handlers/ViewHandler.cs index 81af075c..9622ad17 100644 --- a/src/HotUI.UWP/Handlers/ViewHandler.cs +++ b/src/HotUI.UWP/Handlers/ViewHandler.cs @@ -11,7 +11,7 @@ namespace HotUI.UWP.Handlers { private static readonly PropertyMapper Mapper = new PropertyMapper() { - [nameof(HotUI.View.Body)] = MapBodyProperty + [nameof(global::HotUI.View.Body)] = MapBodyProperty }; private View _view; diff --git a/src/HotUI.UWP/UI.cs b/src/HotUI.UWP/UI.cs index f58a3293..835216c6 100644 --- a/src/HotUI.UWP/UI.cs +++ b/src/HotUI.UWP/UI.cs @@ -1,4 +1,6 @@ -using Windows.ApplicationModel.Core; +using System; +using System.Threading.Tasks; +using Windows.ApplicationModel.Core; using Windows.UI.Core; using HotUI.UWP.Handlers; @@ -23,7 +25,7 @@ namespace HotUI.UWP Registrar.Handlers.Register(); Registrar.Handlers.Register(); Registrar.Handlers.Register(); - HotUI.PerformInvokeOnMainThread = (a) => Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, a); + HotUI.PerformInvokeOnMainThread = async a => await GetDispatcher().RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => a()); } @@ -37,27 +39,5 @@ namespace HotUI.UWP return dispatcher ?? (dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher); } - - private static void InvokeWithDispatcher(CoreDispatcher dispatcher, Action action) - { - var tcs = new TaskCompletionSource(); - -#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed - dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate - { - try - { - action(); - tcs.TrySetResult(true); - } - catch (Exception exc) - { - tcs.SetException(exc); - } - }); -#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed - - AsyncPump.Run(async delegate { await tcs.Task; }); - } } } \ No newline at end of file diff --git a/src/HotUI.WPF/HotUI.WPF.csproj b/src/HotUI.WPF/HotUI.WPF.csproj index 764a485b..ae2aff4e 100644 --- a/src/HotUI.WPF/HotUI.WPF.csproj +++ b/src/HotUI.WPF/HotUI.WPF.csproj @@ -50,6 +50,7 @@ +