Fixed issue with dialog opening but is not closing due to request running into a "ContentControlHandler" after the dialog's await state has been completed.

This commit is contained in:
Daniel Clark
2022-12-21 10:12:54 +00:00
parent e9dd86e0e0
commit b8e50e4dc0
8 changed files with 25 additions and 24 deletions
@@ -1,11 +1,12 @@
using FluentAvalonia.UI.Controls;
using System.Diagnostics;
using Toolkit.Framework.Foundation;
namespace Toolkit.Framework.Avalonia;
public class ContentDialogNavigationHandler : IRequestHandler<ContentDialogNavigation, bool>
public class ContentDialogNavigationHandler : IRequestHandler<ContentDialogNavigation>
{
public async ValueTask<bool> Handle(ContentDialogNavigation request, CancellationToken cancellationToken)
public ValueTask<Unit> Handle(ContentDialogNavigation request, CancellationToken cancellationToken)
{
if (request.Template is ContentDialog contentDialog)
{
@@ -35,9 +36,10 @@ public class ContentDialogNavigationHandler : IRequestHandler<ContentDialogNavig
contentDialog.CloseButtonClick += HandleButtonClick;
contentDialog.DataContext = request.Content;
await contentDialog.ShowAsync();
contentDialog.ShowAsync();
}
return await Task.FromResult(true);
return default;
}
}