/// <summary> /// An asynchronous task that deals with the scanned barcode. /// Example: call to an API to check the availability of a product with the scanned code argument. /// </summary> /// <param name="scannedCode">A string that represents the code scanned : Barcode or QRCode</param> async Task DealWithScanResult(string scannedCode) { // Simulate some async work // TODO : Remove await Task.Delay(2000); // TODO: Send a server request to fetch the product data of the scanned barcode/qrcode // TODO: Navigate to product detail page if the fetched result is a valid product await ServiceDialogs.SingleActionCustomMessageAlert("Coming Soon!", "\n* Navigation to article details page if it is available.\n\n * Alert when barcode is not recognized.", "OK"); }
/// <summary> /// Display a UI prompt to the user to enter a barcode number. /// Call to another task to handle the result retrieved from the prompt /// </summary> public async Task PromptForBarcodeTyping() { string result = await ServiceDialogs.BarcodeDialog(); if (!string.IsNullOrEmpty(result)) { using (UserDialogs.Instance.Loading("Processing barcode")) { await DealWithScanResult(result); } } }