Esempio n. 1
0
        void HandleScanResult(ZXing.Result result)
        {
            Dictionary<string,string> datadic = new Dictionary<string,string> ();
            if (result != null && !string.IsNullOrEmpty (result.Text)) {
                ScanParser scanparser = new ScanParser (result.Text);
                CardInfo cardinfo = scanparser.Parse ();
                if (cardinfo.available) {
                    RunOnUiThread(()=>{
                        firstname_edittext.Text=cardinfo.firstname;
                        lastname_edittext.Text=cardinfo.lastname;
                        if(cardinfo.birthdate.Length>=8){
                        picktimebutton.Text = cardinfo.birthdate.Substring(0,4)+ "/" +  cardinfo.birthdate.Substring(4,2) + "/" + cardinfo.birthdate.Substring(6,2);
                        }
                        address1_edittext.Text= cardinfo.address1;
                        address2_edittext.Text=cardinfo.address2;
                        city_edittext.Text=cardinfo.city;
                        postcode_edittext.Text=cardinfo.zipcode;

                        int spinnerPosition = countryspinneradapter.GetPosition(cardinfo.countrycode);
                        countryspinner.SetSelection(spinnerPosition);
                        countryspinner.Tag = spinnerPosition;

                        if(stateandprovincespinneradapter!=null){
                            stateandprovincespinneradapter.ChangeShowList(provincespinner,listcountry[spinnerPosition].country_code);
                            stateandprovincespinneradapter.NotifyDataSetChanged ();
                        }

                        int provincespinnerPosition = stateandprovincespinneradapter.GetPosition(cardinfo.provincecode);
                        provincespinner.SetSelection(provincespinnerPosition);
                        countryspinner.Tag = provincespinnerPosition;

                    });
            //					string text = "countrycode:" + cardinfo.countrycode + "\n" +
            //						"firstname:" + cardinfo.firstname + "\n" +
            //						"lastname:" + cardinfo.lastname + "\n" +
            //						"birthdate:" + cardinfo.birthdate + "\n" +
            //						"provincecode:" + cardinfo.provincecode + "\n" +
            //						"city:" + cardinfo.city + "\n" +
            //						"zipcode:" + cardinfo.zipcode + "\n" +
            //						"address1:" + cardinfo.address1 + "\n" +
            //						"address2:" + cardinfo.address2 + "\n";

                }
                else {

                }
                //if success, the error message
                Toast.MakeText(this,cardinfo.resultmessage,ToastLength.Long).Show();
            }
        }
        void HandleScanResult(ZXing.Result result)
        {
            Dictionary<string,string> datadic = new Dictionary<string,string> ();
            if (result != null && !string.IsNullOrEmpty (result.Text)) {
                ScanParser scanparser = new ScanParser (result.Text);
                CardInfo cardinfo = scanparser.Parse ();
                if (cardinfo.available) {
                    nn_activity.RunOnUiThread(()=>{
                        firstname_edittext.Text=cardinfo.firstname;
                        lastname_edittext.Text=cardinfo.lastname;
                        if(cardinfo.birthdate.Length>=8){
                            picktimebutton.Text = cardinfo.birthdate.Substring(0,4)+ "/" +  cardinfo.birthdate.Substring(4,2) + "/" + cardinfo.birthdate.Substring(6,2);
                        }
                        address1_edittext.Text= cardinfo.address1;
                        address2_edittext.Text=cardinfo.address2;
                        city_edittext.Text=cardinfo.city;
                        postcode_edittext.Text=cardinfo.zipcode;

                        int spinnerPosition = countryspinneradapter.GetPosition(cardinfo.countrycode);
                        countryspinner.SetSelection(spinnerPosition);

                        int provincespinnerPosition = stateandprovincespinneradapter.GetPosition(cardinfo.provincecode);
                        provincespinner.SetSelection(provincespinnerPosition);

                    });
                }
                else {

                }
                //if success, the error message
                Toast.MakeText(nn_activity,cardinfo.resultmessage,ToastLength.Long).Show();
            }
        }