In the previous article Adding Loader/Progress to your xamarin App using Postsharp we discussed how to use aspect oriented programming to make any async method showing progress without investing any effort.
In this article i will show you how to show a warning message before the execution of a method using Aspect oriented programming.
The aspect is obvious we use the Acr user dialogs library to show the confirmation message and depend on the user accept or not we execute the target method or end the computation.
[RequireUserConfirmation("Delete User","Are you sure , you want to delete" , "Delete","Cancel")
public async Task DeleteUser(User user)
In order to get this code to work you must install Postsharp in your visual studio and install these nuget packages