public void GetCountryStateAndProivince()
        {
            App.INSTANCE.networknamager.GetCountry ((Tap5050WebResponse response) => {
                if(response.available){
                    listcountry=response.parsedobject as List<Country>;
                    countryspinneradapter = new CustomCountrySpinnerAdapter (nn_activity, response.parsedobject as List<Country>);
                    nn_activity.RunOnUiThread(()=>{
                        countryspinner.Adapter = countryspinneradapter;
                        countryspinneradapter.NotifyDataSetChanged ();
                    });

                    getcountryflag=true;

                    if(getcountryflag&&getprovincestate){
                        nn_activity.RunOnUiThread(()=>{
                            int provinceposition=-1;
                            int countryposition=-1;

                            for(int i=0;i<liststateandprovince.Count;i++){
                                if(liststateandprovince[i].state_province_name.Equals(GlobalVariable.currentlocation)){
                                    //provinceposition=i;

                                    if(stateandprovincespinneradapter!=null){
                                        stateandprovincespinneradapter.ChangeShowList(provincespinner,liststateandprovince[i].country_code);
                                        stateandprovincespinneradapter.NotifyDataSetChanged ();
                                    }
                                    for(int k=0;k<stateandprovincespinneradapter.showlist.Count;k++){
                                        if(stateandprovincespinneradapter.showlist[k].state_province_name.Equals(GlobalVariable.currentlocation)){
                                            provinceposition=k;
                                        }
                                    }
                                    for(int m=0;m<listcountry.Count;m++){
                                        if(listcountry[m].country_code.Equals(liststateandprovince[i].country_code)){
                                            countryposition=m;
                                        }
                                    }
                                }
                            }

                            if(provinceposition>=0&&countryposition>=0){
                                provincespinner.SetSelection(provinceposition);
                                countryspinner.SetSelection(countryposition);
                            }

                            rootlayout.RemoveView (loadingcontainer);
                        });
                    }

                }
                else{
                    nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.buyersignup.getcountry");
                }
            });
            App.INSTANCE.networknamager.GetStateAndProvince ((Tap5050WebResponse response) => {
                if(response.available){
                    liststateandprovince=response.parsedobject as List<StateAndProvince>;
                    stateandprovincespinneradapter = new CustomStateAndProvinceSpinnerAdapter (nn_activity, response.parsedobject as List<StateAndProvince>);
                    nn_activity.RunOnUiThread(()=>{
                        provincespinner.Adapter = stateandprovincespinneradapter;
                        stateandprovincespinneradapter.NotifyDataSetChanged ();
                    });

                    getprovincestate=true;

                    if(getcountryflag&&getprovincestate){
                        nn_activity.RunOnUiThread(()=>{
                            int provinceposition=-1;
                            int countryposition=-1;

                            for(int i=0;i<liststateandprovince.Count;i++){
                                if(liststateandprovince[i].state_province_name.Equals(GlobalVariable.currentlocation)){
                                    //provinceposition=i;

                                    if(stateandprovincespinneradapter!=null){
                                        stateandprovincespinneradapter.ChangeShowList(provincespinner,liststateandprovince[i].country_code);
                                        stateandprovincespinneradapter.NotifyDataSetChanged ();
                                    }
                                    for(int k=0;k<stateandprovincespinneradapter.showlist.Count;k++){
                                        if(stateandprovincespinneradapter.showlist[k].state_province_name.Equals(GlobalVariable.currentlocation)){
                                            provinceposition=k;
                                        }
                                    }
                                    for(int m=0;m<listcountry.Count;m++){
                                        if(listcountry[m].country_code.Equals(liststateandprovince[i].country_code)){
                                            countryposition=m;
                                        }
                                    }
                                }
                            }

                            if(provinceposition>=0&&countryposition>=0){
                                provincespinner.SetSelection(provinceposition);
                                countryspinner.SetSelection(countryposition);
                            }

                            rootlayout.RemoveView (loadingcontainer);
                        });
                    }
                }
                else{
                    nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.buyersignup.getstateandprovinceexception");
                }
            });
        }
Exemple #2
0
        public void GetCountryStateAndProivince()
        {
            App.INSTANCE.networknamager.GetCountry ((Tap5050WebResponse response) => {
                if(response.available){
                    listcountry=response.parsedobject as List<Country>;
                    countryspinneradapter = new CustomCountrySpinnerAdapter (this, response.parsedobject as List<Country>);
                    RunOnUiThread(()=>{
                    countryspinner.Adapter = countryspinneradapter;
                    countryspinneradapter.NotifyDataSetChanged ();
                    countryspinner.Tag=0;
                    });

                    getcountryflag=true;

                    if(getcountryflag&&getprovincestate){
                        RunOnUiThread(()=>{
                            RemoveSpinner();
                        });
                    }

                }
                else{
                    ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage, GlobalScreenData.WebExceptionPositive, GlobalScreenData.DefaultNegative, "getcountryexceptiondialog");
                }
            });
            App.INSTANCE.networknamager.GetStateAndProvince ((Tap5050WebResponse response) => {
                if(response.available){
                    liststateandprovince=response.parsedobject as List<StateAndProvince>;
                    stateandprovincespinneradapter = new CustomStateAndProvinceSpinnerAdapter (this, response.parsedobject as List<StateAndProvince>);
                    RunOnUiThread(()=>{
                    provincespinner.Adapter = stateandprovincespinneradapter;
                    stateandprovincespinneradapter.NotifyDataSetChanged ();
                    provincespinner.Tag=0;
                    });

                    getprovincestate=true;

                    if(getcountryflag&&getprovincestate){
                        RunOnUiThread(()=>{
                            RemoveSpinner();
                        });
                    }
                }
                else{
                    ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage, GlobalScreenData.WebExceptionPositive, GlobalScreenData.DefaultNegative, "getstateandprovinceexceptiondialog");
                }
            });
        }
        public void GetCountryStateAndProivince()
        {
            App.INSTANCE.networknamager.GetCountry ((Tap5050WebResponse response) => {
                if(response.available){
                    listcountry=response.parsedobject as List<Country>;
                    countryspinneradapter = new CustomCountrySpinnerAdapter (nn_activity, response.parsedobject as List<Country>);
                    nn_activity.RunOnUiThread(()=>{
                        countryspinner.Adapter = countryspinneradapter;
                        countryspinneradapter.NotifyDataSetChanged ();
                        if (!string.IsNullOrEmpty(nn_accountinfo.mail_country)) {
                            int spinnerPosition = countryspinneradapter.GetPosition(nn_accountinfo.mail_country);
                            countryspinner.SetSelection(spinnerPosition);
                        }
                    });

                    getcountryflag=true;

                    if(getcountryflag&&getprovincestate){
                        nn_activity.RunOnUiThread(()=>{
                            RemoveSpinner(rootview);
                        });
                    }

                }
                else{
                    nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.editaccount.getcountryexceptiondialog");
                }
            });
            App.INSTANCE.networknamager.GetStateAndProvince ((Tap5050WebResponse response) => {
                if(response.available){
                    liststateandprovince=response.parsedobject as List<StateAndProvince>;
                    stateandprovincespinneradapter = new CustomStateAndProvinceSpinnerAdapter (nn_activity, response.parsedobject as List<StateAndProvince>);
                    nn_activity.RunOnUiThread(()=>{
                        provincespinner.Adapter = stateandprovincespinneradapter;
                        stateandprovincespinneradapter.NotifyDataSetChanged ();
                        if (!string.IsNullOrEmpty(nn_accountinfo.mail_prov_state)) {
                            int spinnerPosition = stateandprovincespinneradapter.GetPosition(nn_accountinfo.mail_prov_state);
                            provincespinner.SetSelection(spinnerPosition);
                        }
                    });

                    getprovincestate=true;

                    if(getcountryflag&&getprovincestate){
                        nn_activity.RunOnUiThread(()=>{
                            RemoveSpinner(rootview);
                        });
                    }
                }
                else{
                    nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.editaccount.getstateandprovinceexceptiondialog");
                }
            });
        }