Пример #1
0
        public List <AddressBinding> GetAddressFullList()
        {
            List <AddressBinding> addressListReturned = new List <AddressBinding>();
            int            nStartIndex = 0;
            AddressBinding anAddress   = null;
            AddressData    ad          = new AddressData();

            foreach (var addr in addressesGiven)
            {
                switch (nStartIndex)
                {
                case 0:
                    anAddress      = new AddressBinding();
                    anAddress.Name = addr;
                    break;

                case 1:
                    anAddress.Building = addr;
                    break;

                case 2:
                    anAddress.Street = addr;
                    break;

                case 3:
                    anAddress.City = addr;
                    break;

                case 4:
                    anAddress.Region  = addr;
                    anAddress.Country = "USA";
                    break;

                case 5:
                    anAddress.PostalCode     = addr;
                    anAddress.PostalCodePick = new List <string>();
                    anAddress.PostalCodePick.Add(anAddress.PostalCode);
                    anAddress.PostalCodePick.Add("39567");
                    anAddress.PostalCodePick.Add("54328");
                    anAddress.PostalCodePick.Add("65788");
                    anAddress.PostalCodePick.Add("23444");
                    anAddress.PostalCodePick.Add("90909");
                    break;

                case 6:
                    anAddress.Phone = addr;
                    break;
                }
                nStartIndex++;
                if (nStartIndex == 7)
                {
                    addressListReturned.Add(anAddress);
                    nStartIndex = 0;
                }
            }

            return(addressListReturned);
        }
Пример #2
0
        public void HandlePickerChanges(ref object sender)
        {
            var zipPicker = (Picker)sender;

            if (zipPicker != null)
            {
                AddressBinding addressItem = (AddressBinding)zipPicker.BindingContext;

                var currentSelectedZip = zipPicker.SelectedItem;
                if (currentSelectedZip != null)
                {
                    string pickerCurrentZip = currentSelectedZip as string;

                    /**
                     *   anAddress.PostalCodePick.Add("39567");
                     *   anAddress.PostalCodePick.Add("54328");
                     *   anAddress.PostalCodePick.Add("65788");
                     *   anAddress.PostalCodePick.Add("23444");
                     *   anAddress.PostalCodePick.Add("90909");
                     **/

                    if (pickerCurrentZip.Equals("39567"))
                    {
                        addressItem.Name     = "Changed Name 1";
                        addressItem.City     = "Changed City 1";
                        addressItem.Region   = "Changed Region 1";
                        addressItem.Phone    = "111-1111";
                        addressItem.Building = "Changed Building 1";
                        addressItem.Country  = "111";
                        addressItem.Street   = "Changed Street 1";
                    }
                    else if (pickerCurrentZip.Equals("54328"))
                    {
                        addressItem.Name     = "Changed Name 2";
                        addressItem.City     = "Changed City 2";
                        addressItem.Region   = "Changed Region 2";
                        addressItem.Phone    = "222-2222";
                        addressItem.Building = "Changed Building 2";
                        addressItem.Country  = "222";
                        addressItem.Street   = "Changed Street 2";
                    }
                    else if (pickerCurrentZip.Equals("54328"))
                    {
                        addressItem.Name     = "Changed Name 3";
                        addressItem.City     = "Changed City 3";
                        addressItem.Region   = "Changed Region 3";
                        addressItem.Phone    = "333-3333";
                        addressItem.Building = "Changed Building 3";
                        addressItem.Country  = "333";
                        addressItem.Street   = "Changed Street 3";
                    }
                    else if (pickerCurrentZip.Equals("65788"))
                    {
                        addressItem.Name     = "Changed Name 4";
                        addressItem.City     = "Changed City 4";
                        addressItem.Region   = "Changed Region 4";
                        addressItem.Phone    = "444-4444";
                        addressItem.Building = "Changed Building 4";
                        addressItem.Country  = "444";
                        addressItem.Street   = "Changed Street 4";
                    }
                    else if (pickerCurrentZip.Equals("23444"))
                    {
                        addressItem.Name     = "Changed Name 5";
                        addressItem.City     = "Changed City 5";
                        addressItem.Region   = "Changed Region 5";
                        addressItem.Phone    = "555-5555";
                        addressItem.Building = "Changed Building 5";
                        addressItem.Country  = "555";
                        addressItem.Street   = "Changed Street 5";
                    }
                    else if (pickerCurrentZip.Equals("90909"))
                    {
                        addressItem.Name     = "Changed Name 6";
                        addressItem.City     = "Changed City 6";
                        addressItem.Region   = "Changed Region 6";
                        addressItem.Phone    = "666-6666";
                        addressItem.Building = "Changed Building 6";
                        addressItem.Country  = "666";
                        addressItem.Street   = "Changed Street 6";
                    }

                    addressItem.PostalCode = pickerCurrentZip;
                }
            }
        }