public async void OnLike(object sender, EventArgs e) { ImageDetailsViewModel vm = this.BindingContext as ImageDetailsViewModel; try { await vm.LikeImageAsync(); await DisplayAlert("Like sent!", "Like was sent to the image author", "OK"); } catch (Exception) { await DisplayAlert("Error", "'Like' functionality is not available at the moment. Please try again later", "OK"); } }
public async void OnLike(object sender, EventArgs e) { ImageDetailsViewModel vm = this.BindingContext as ImageDetailsViewModel; if (await vm.LikeImageAsync()) { await DisplayAlert("Success", "Your like sent to image author.", "OK"); } else { await DisplayAlert("Error", "'Like' functionality is not available at the moment. Please try again later", "OK"); } }