Exemplo n.º 1
0
        public void Refresh()
        {
            _cars = connection.GetCars();

            // before  FilteredCars.Clear() the SelectedCar needs to point to a valid location
            // (with  FilteredCars.Clear(), the referenced object will disappear, and will give error at Display Fields)
            SelectedCar = null;
            FilteredCars.Clear();

            _cars.ForEach(x => FilteredCars.Add(x));
            ClearFields();
        }
Exemplo n.º 2
0
        public void Filter()
        {
            if (string.IsNullOrEmpty(FilterBrand) && string.IsNullOrEmpty(FilterModel) && string.IsNullOrEmpty(FilterLicensePlate) && string.IsNullOrEmpty(FilterOwnerFirstName))
            {
                Refresh();
                return;
            }

            _cars = connection.GetCars();
            // before  FilteredCars.Clear() the SelectedCar needs to point to a valid location
            // (with  FilteredCars.Clear(), the referenced object will disappear, and will give error at Display Fields)
            SelectedCar = null;
            FilteredCars.Clear();

            List <Car> temp = new List <Car>();

            temp = FilterByBrand(_cars);
            temp = FilterByModel(temp);
            temp = FilterByLicensePlate(temp);
            temp = FilterByOwner(temp);
            temp.ForEach(x => FilteredCars.Add(x));
        }