示例#1
0
        private async void LoadData()
        {
            try
            {
                isLoaded = false;
                isBusy   = true;
                AddressList.Clear();
                responseObject = await trackingService.GetAddressParties(requestObject.JobType, requestObject.JobId);

                if (responseObject.ReturnCode == "ERR_SUCCESS")
                {
                    foreach (AddressParty a in responseObject.AddressParties)
                    {
                        AddressList.Add(a);
                    }
                }
                else
                {
                    //Error
                }
            }
            catch (Exception e)
            {
                //Exception
            }
            finally
            {
                isBusy   = false;
                isLoaded = true;
            }
        }
        private async Task CustomerSearch()
        {
            Address addr = new Address();

            if (Search != null)
            {
                var searchResults = AllAddresses.Where(address => addr.Compare(address, Search));
                AddressList.Clear();
                AddressList.AddRange(searchResults);
            }
        }
        private async Task GetSortedAddressesFromWebservice()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                if (AllAddresses == null)
                {
                    AllAddresses = await DependencyService.Get <IDataService>().GetAddressesAsync();
                }

                IEnumerable <Address> sortedCustomers = null;
                var unsortedCustomers = new List <Address>();

                foreach (var customer in AllAddresses)
                {
                    CalcSearchPercentage(customer, HeaderAddress);
                    unsortedCustomers.Add(customer);
                }

                sortedCustomers = unsortedCustomers.OrderByDescending(address => address.SearchPercentage).ThenBy(address => address.FirstName);
                AddressList.Clear();
                AddressList.AddRange(sortedCustomers);
            }

            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            finally
            {
                IsBusy = false;
            }
        }
 public void ClearLogic()
 {
     AddressList.Clear();
     SetAsEmptySelection();
 }