void _bcReader_ResultFound(Result obj) { try { barCode = obj.Text; if (!obj.Text.Equals(tbBarcodeData.Text)) { tbBarcodeType.Text = obj.BarcodeFormat.ToString(); tbBarcodeData.Text = obj.Text; VibrateController.Default.Start(TimeSpan.FromMilliseconds(100)); line.Visibility = System.Windows.Visibility.Collapsed; Ok.Visibility = System.Windows.Visibility.Visible; string response = Cache.getFromCache(obj.Text); if (response.Equals("")) { if (!BadRequest.checkNetworkConnection()) { NavigationService.Navigate(new Uri("/SorryPage.xaml?SorryString=" + BadRequest.response("0"), UriKind.Relative)); } else { NetworkHelper.getRequest(obj.Text, new UploadStringCompletedEventHandler(handler)); } } else { addToInterface(response); Cache.saveCache(barCode, response); } } } catch (Exception e) { MessageBox.Show("Can't recognize BarCode"); NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); } }
private void HandleNumbers_Click(object sender, RoutedEventArgs e) { barCode = BarCodeNumbers.Text; string response = Cache.getFromCache(barCode); if (response.Equals("")) { if (!BadRequest.checkNetworkConnection()) { NavigationService.Navigate(new Uri("/SorryPage.xaml?SorryString=" + BadRequest.response("0"), UriKind.Relative)); } else { NetworkHelper.getRequest(barCode, new UploadStringCompletedEventHandler(handler)); } } else { addToInterface(response); Cache.saveCache(barCode, response); } }