This commit is contained in:
Jon Lipsky 2019-07-01 13:30:34 -05:00
Родитель 9d9f8fa97f
Коммит 853529b5de
3 изменённых файлов: 6 добавлений и 25 удалений

Просмотреть файл

@ -11,7 +11,7 @@ namespace HotUI.UWP.Handlers
{
private static readonly PropertyMapper<View, ViewHandler> Mapper = new PropertyMapper<View, ViewHandler>()
{
[nameof(HotUI.View.Body)] = MapBodyProperty
[nameof(global::HotUI.View.Body)] = MapBodyProperty
};
private View _view;

Просмотреть файл

@ -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<Image, ImageHandler>();
Registrar.Handlers.Register<ListView, ListViewHandler>();
Registrar.Handlers.Register<View, ViewHandler>();
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<bool>();
#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; });
}
}
}

Просмотреть файл

@ -50,6 +50,7 @@
<Compile Include="Handlers\AbstractStackLayoutHandler.cs" />
<Compile Include="Handlers\AbstractLayoutHandler.cs" />
<Compile Include="Handlers\ButtonHandler.cs" />
<Compile Include="Handlers\ContentViewHandler.cs" />
<Compile Include="Handlers\HStackHandler.cs" />
<Compile Include="Handlers\ImageHandler.cs" />
<Compile Include="Handlers\ListViewHandler.cs" />