コード例 #1
0
ファイル: AccountEditFragment.cs プロジェクト: MADMUC/TAP5050
        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");
                }
            });
        }