Exemplo n.º 1
0
        /// <summary>
        /// Looks for and returns the matching item. Will load additional sections if not found.
        /// </summary>
        /// <param name="identifier"></param>
        /// <returns></returns>
        public BaseItemWP Find(Guid identifier, FindType type = FindType.All)
        {
            if (identifier == Guid.Empty)
            {
                return(null);
            }

            BaseItemWP found = FindFromLoaded(identifier);

            if (found != null)
            {
                return(found);
            }

            //make sure everything's loaded
            if (type.HasFlag(FindType.Semesters))
            {
                foreach (SemesterSection s in SemesterSections)
                {
                    s.Load();
                }
            }

            if (type.HasFlag(FindType.Grades))
            {
                foreach (GradesSection g in GradesSections)
                {
                    g.Load();
                }
            }

            //try again
            return(FindFromLoaded(identifier));
        }