private async void BarcodeScan_Clicked(object sender, EventArgs e) { ScanBarcodeView scanBarcode = new ScanBarcodeView(false, true, AllScanBarcode, ScanCompletedBarcode, SaveCompletedBarcode); scanBarcode.OnScanCompleted += (List <string> result) => { if (result.Count > 0) { //LOBL020_ScanCompleted(result); //이렇게 하지 않으면 에러 발생함. //아이폰에서만 에러 Device.BeginInvokeOnMainThread(() => { foreach (var item in result) { Debug.WriteLine(item.ToString()); } }); } }; if (Device.RuntimePlatform == Device.iOS) { await Application.Current.MainPage.Navigation.PushAsync(scanBarcode); } else if (Device.RuntimePlatform == Device.Android) { await Application.Current.MainPage.Navigation.PushModalAsync(scanBarcode); } }
private async Task BarcodeScan() { if (IsTranToggle) { return; } if (!IsEnabled) { return; } //화면에 리스트가 없으면 카메라 진입하지 못함. if (this.SearchResult.Count == 0) { return; } IsBusy = true; IsEnabled = false; this.Pltid = string.Empty; this.Grid.SelectedRowHandle = -1; ScanBarcodeView scanBarcode = new ScanBarcodeView(false, false, AllScanBarcode, ScanCompletedBarcode, SaveCompletedBarcode); scanBarcode.OnScanCompleted += (List <string> result) => { if (result.Count > 0) { //LOBL020_ScanCompleted(result); //이렇게 하지 않으면 에러 발생함. //아이폰에서만 에러 Device.BeginInvokeOnMainThread(async() => { // await LOBSM020_ScanCompleted(result); }); } }; if (Device.RuntimePlatform == Device.iOS) { await Application.Current.MainPage.Navigation.PushAsync(scanBarcode); } else if (Device.RuntimePlatform == Device.Android) { await Application.Current.MainPage.Navigation.PushModalAsync(scanBarcode); } IsBusy = false; IsEnabled = true; }