I have a requirement for my xamarin cross platform application that as soon as app start up .QR Scanner set in to read the code. on completing scanning a beep will be ring up.and app again ready for next scanning how can i get this done. what i have done is on button click scanner start, its read code, then i have to press button again to start it again.
- 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
- {
- var endpoint = new EndpointAddress("http://192.168.15.33/SMS/WebServices/SMSService.svc");
- var binding = new BasicHttpBinding
- {
- Name = "basicHttpBinding",
- MaxBufferSize = 2147483647,
- MaxReceivedMessageSize = 2147483647
- };
-
- TimeSpan timeout = new TimeSpan(0, 0, 30);
- binding.SendTimeout = timeout;
- binding.OpenTimeout = timeout;
- binding.ReceiveTimeout = timeout;
-
- _client = new SMSServiceClient(binding, endpoint);
- _client.ValidateStudentAsync("123-admin");
- _client.ValidateStudentCompleted += _client_ValidateStudentCompleted; ;
-
- }
- };
-
- Content = new StackLayout
- {
- Children = {
- scanBtn
- }
- };
- }