Exemplo n.º 1
0
        /// <summary>Generates and returns a new list with all of this list's items added to it.</summary>
        public ListOfIDObjects <TYPE> GetDeepCopy()
        {
            ListOfIDObjects <TYPE> result = new ListOfIDObjects <TYPE>();

            foreach (TYPE item in this)
            {
                result.Add(item);
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>Searches the current list for an item whose type is based in ObjectWithName and which name is the same as the one given, and returns it if it is found, or null otherwise.</summary>
        public ListOfIDObjects <TYPE> GetItemsByName(string name)
        {
            ListOfIDObjects <TYPE> result = new ListOfIDObjects <TYPE>();

            foreach (TYPE item in this)
            {
                if (item is ObjectWithName && (item as ObjectWithName).Name.Equals(name))
                {
                    result.Add(item);
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        private void FilterAndSetStops(TextBox filterTB, StopViewManager manager, InfoView infoView)
        {
            ListOfIDObjects <Stop> stops = new ListOfIDObjects <Stop>();
            string query = filterTB.Text.Trim().ToUpperInvariant();

            foreach (Stop stop in this.Database.Stops)
            {
                if ((query.Equals(string.Empty) || stop.Name.ToUpperInvariant().Contains(query)) && stops.GetItemByName(stop.Name) == null)
                {
                    stops.Add(stop);
                }
            }
            manager.SetStops(stops);
            infoView.TextDescription = string.Format("Ai filtrat {0} / {1} stații", stops.Count, this.Database.Stops.Count);
        }