Example #1
0
        private Boolean addToInterface(string response)
        {
            var obj = App.Current as App;

            obj.sharEObj = GoodJson.deserializeGood(response);
            if (obj.sharEObj.name.Equals("1") || obj.sharEObj.name.Equals("2") || obj.sharEObj.name.Equals("3"))
            {
                NavigationService.Navigate(new Uri("/SorryPage.xaml?SorryString=" + BadRequest.response(obj.sharEObj.name), UriKind.Relative));
                return(false);
            }

            NavigationService.Navigate(new Uri("/ElistProduct.xaml", UriKind.Relative));
            return(true);
        }
Example #2
0
        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));
            }
        }
Example #3
0
        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);
            }
        }