Reputation: 13
In Xamarin forms we have delegate commands like this:
/// Gets or sets the logout command.
/// </summary>
/// <value>
/// The logout command.
/// </value>
public DelegateCommand LogoutCommand { get; set; }
Which is initialized in the constructor like this:
this.LogoutCommand = new DelegateCommand(this.ExecuteLogoutCommand);
Currently, the ExecuteLogoutCommand is return void type, but I wish to make it Task as it has an async task. But doing so breaks the initialization in the constructor. Any help here?
Update The following link helped me: https://johnthiriet.com/mvvm-going-async-with-async-command/
But now I get this error in my Unit Tests:
MobileApp.Core.UnitTests.Add.ConfirmationPageViewModelUnitTests.OnNavigatedToBackBehavior threw exception: System.MissingMethodException: Method not found: 'MobileApp.Core.IServices.IAsyncDelegateCommand MobileApp.Core.ViewModel.Add.ConfirmationPageViewModel.get_GoBackHomeCommand()'
Upvotes: 0
Views: 361