Amend IPrimaryConfirmation
This commit is contained in:
@@ -22,7 +22,7 @@ public class ContentDialogHandler(IDispatcher dispatcher) :
|
|||||||
if (content is IPrimaryConfirmation primaryConfirmation)
|
if (content is IPrimaryConfirmation primaryConfirmation)
|
||||||
{
|
{
|
||||||
Deferral deferral = args.GetDeferral();
|
Deferral deferral = args.GetDeferral();
|
||||||
if (!await primaryConfirmation.Confirm())
|
if (!await primaryConfirmation.ConfirmPrimary())
|
||||||
{
|
{
|
||||||
args.Cancel = true;
|
args.Cancel = true;
|
||||||
contentDialog.PrimaryButtonClick += HandlePrimaryButtonClick;
|
contentDialog.PrimaryButtonClick += HandlePrimaryButtonClick;
|
||||||
@@ -64,13 +64,6 @@ public class ContentDialogHandler(IDispatcher dispatcher) :
|
|||||||
{
|
{
|
||||||
if (content is IConfirmation confirmation)
|
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();
|
Deferral deferral = args.GetDeferral();
|
||||||
if (!await confirmation.Confirm())
|
if (!await confirmation.Confirm())
|
||||||
{
|
{
|
||||||
@@ -79,10 +72,6 @@ public class ContentDialogHandler(IDispatcher dispatcher) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
deferral.Complete();
|
deferral.Complete();
|
||||||
foreach (Action action in postActions)
|
|
||||||
{
|
|
||||||
action.Invoke();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Toolkit.Foundation;
|
||||||
|
|
||||||
|
public interface IConfirmation
|
||||||
|
{
|
||||||
|
Task<bool> Confirm();
|
||||||
|
}
|
||||||
@@ -2,10 +2,5 @@
|
|||||||
|
|
||||||
public interface IPrimaryConfirmation
|
public interface IPrimaryConfirmation
|
||||||
{
|
{
|
||||||
Task<bool> Confirm();
|
Task<bool> ConfirmPrimary();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IConfirmation
|
|
||||||
{
|
|
||||||
Task<bool> Confirm();
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user