我想在另一页显示条形码扫描结果..任何人都可以告诉我..我是xamarin的新手 这是我的cs。代码
public class HomePage : ContentPage
{
public HomePage()
{
Button scanBtn = new Button
{
Text = "Scan Barcode",
HorizontalOptions = LayoutOptions.FillAndExpand,
};
scanBtn.Clicked += async (sender, args) =>
{
var scanResult = await Acr.BarCodes.BarCodes.Instance.Read();
if (!scanResult.Success)
{
await this.DisplayAlert("Alert ! ", "Sorry ! \n Failed to read the Barcode !", "OK");
}
else
{
await this.DisplayAlert("Scan Successful !", String.Format("Barcode Format : {0} \n Barcode Value : {1}", scanResult.Format, scanResult.Code), "OK");
string id = scanResult.Code;
}
};
Content = new StackLayout
{
Children = {
scanBtn
}
};
}
}