Amend IPrimaryConfirmation

This commit is contained in:
TheXamlGuy
2024-06-15 20:27:46 +01:00
parent d949a1d48e
commit c52db5ca10
3 changed files with 8 additions and 18 deletions
+1 -12
View File
@@ -22,7 +22,7 @@ public class ContentDialogHandler(IDispatcher dispatcher) :
if (content is IPrimaryConfirmation primaryConfirmation)
{
Deferral deferral = args.GetDeferral();
if (!await primaryConfirmation.Confirm())
if (!await primaryConfirmation.ConfirmPrimary())
{
args.Cancel = true;
contentDialog.PrimaryButtonClick += HandlePrimaryButtonClick;
@@ -64,13 +64,6 @@ public class ContentDialogHandler(IDispatcher dispatcher) :
{
if (content is IConfirmation confirmation)
{
List<Action> postActions = [];
if (content is IActivityIndicator activityIndicator)
{
activityIndicator.Active = true;
postActions.Add(() => activityIndicator.Active = false);
}
Deferral deferral = args.GetDeferral();
if (!await confirmation.Confirm())
{
@@ -79,10 +72,6 @@ public class ContentDialogHandler(IDispatcher dispatcher) :
}
deferral.Complete();
foreach (Action action in postActions)
{
action.Invoke();
}
}
}
}
+6
View File
@@ -0,0 +1,6 @@
namespace Toolkit.Foundation;
public interface IConfirmation
{
Task<bool> Confirm();
}
+1 -6
View File
@@ -2,10 +2,5 @@
public interface IPrimaryConfirmation
{
Task<bool> Confirm();
Task<bool> ConfirmPrimary();
}
public interface IConfirmation
{
Task<bool> Confirm();
}