【发布时间】:2020-02-23 20:14:11
【问题描述】:
我有这样的方法:
public async System.Threading.Tasks.Task OnScanResultAsync(Result result)
{
Console.WriteLine(result);
await DisplayAlert("Success", "Customer has been updated.", "OK");
}
我正在尝试从我的 ZXing 中调用它
<zxing:ZXingScannerView x:Name="BarcodeScanView" IsVisible="false" HeightRequest="200" OnScanResult="OnScanResultAsync" />
但是当我尝试运行我的应用时,我得到了这个错误:
错误:位置 8:96。 EventHandler“OnScanResultAsync”正确 在“Sales.ScannerPage”(销售)类型中找不到签名
在我的 .xaml 文件中
我做错了什么,我该如何纠正?在我添加 DisplayAlert 并且我的方法更改为异步方法之前它正在工作。
我将方法更改为 async void,但现在我收到一条警告说 async 方法不应返回 void....我该怎么办?
【问题讨论】:
标签: c# xamarin xamarin.forms