private async Task <int> LookNDBAsync(string upc) { Task <int> t = Task.Run(() => { long val = long.Parse(upc); int result; result = SearchController.BinarySearch(List, val, List.Count - 1, 0, TargetPos); return(result); }); return(await t); }
public void ClickStart() { inDB = false; if (BarcodeScanner == null) { Log.Warning("No valid camera - Click Start"); return; } // Start Scanning BarcodeScanner.Scan((barCodeType, barCodeValue) => { BarcodeScanner.Stop(); if (this.GetComponent <TestController>().test) { GameObject.Find("UPCNumber").GetComponent <Text>().text = barCodeValue; } if (excludedCodeType.Any(barCodeType.Contains)) //need test { Invoke("ClickStart", 1f); } else { var i = SearchController.BinarySearch(dbProductList, long.Parse(barCodeValue), dbProductList.Count - 1, 0); bool test = GameObject.Find("Main Camera").GetComponent <TestController>().test; //test if (i != -1) { inDB = true; if (test == true && barCodeValue == "044000030414") { superBarCode = true; } GameObject.Find("Canvas").GetComponent <FindAddedSugar>().AllTypeOfSugars(dbProductList[i].ToLower(), barCodeValue); } if (!inDB && GameObject.Find("Not Found") == null) { GameObject.Find("Canvas").GetComponent <FindAddedSugar>().AllTypeOfSugars("Not Found", barCodeValue); } } }); }