private async void ScanCode_Send() { ZXingScannerPage scanPage = new ZXingScannerPage(); scanPage.OnScanResult += (result) => { scanPage.IsScanning = false; Device.BeginInvokeOnMainThread(async() => { await Navigation.PopAsync(); using (UserDialogs.Instance.Loading("Updating")) { Package package = await client.GetPackageInformation(result.Text); string handler = package.handler.Substring(35); if (handler != client.thisTrader.traderId) { await DisplayAlert("Not Owner", "You are trying to send a package that does not belong to you", "Ok"); } else { var locator = CrossGeolocator.Current; var position = await locator.GetPositionAsync(TimeSpan.FromSeconds(10)); NewTransfer transfer = new NewTransfer { package = result.Text, handler = client.thisTrader.traderId, ingress = false, latitude = position.Latitude, longitude = position.Longitude }; await client.AddNewTransfer(transfer); await DisplayAlert("Success", "The package has been relinquished", "Confirm"); } } }); }; await Navigation.PushAsync(scanPage); }