コード例 #1
0
        /// <summary>
        /// Constructs a new dynamic course object and links it to an existing dynamic course.
        /// </summary>
        /// <param name="name">The name of the course container.</param>
        /// <param name="linkedCourse">An existing dynamic course object to link to.</param>
        public DynamicCourse(string name, DynamicCourse linkedCourse)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (linkedCourse == null)
            {
                throw new ArgumentNullException("linkedCourse");
            }
            _name    = name;
            _courses = linkedCourse._courses;
            DynamicCourse head = linkedCourse;

            if (head._linkedHead != null)
            {
                // Course is already linked to another course
                // Get the actual root of the link chain
                head = head._linkedHead;
                if (head._linkedChildren.Count >= _courses.Length)
                {
                    throw new InvalidOperationException("More linked courses than course options");
                }
            }
            else
            {
                // Course is standalone
                // Let head know it's the root of a chain now
                head._linkedHead     = head;
                head._linkedChildren = new List <DynamicCourse>();
            }
            head._linkedChildren.Add(this);
            _linkedHead     = head;
            _selectedCourse = GetNextCourseChoice();
        }
コード例 #2
0
 /// <summary>
 /// Constructs a new dynamic course object.
 /// </summary>
 /// <param name="name">The name of the course container.</param>
 /// <param name="courses">An array containing the underlying course objects.</param>
 public DynamicCourse(string name, StaticCourse[] courses)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if (courses == null)
     {
         throw new ArgumentNullException("courses");
     }
     if (courses.Length == 0)
     {
         throw new ArgumentException("Must provide at least one course object");
     }
     _name           = name;
     _courses        = courses;
     _selectedCourse = courses[0];
 }
コード例 #3
0
 public StaticCourseNameControl(StaticCourse course)
 {
     _course = course;
 }
コード例 #4
0
ファイル: DynamicCourse.cs プロジェクト: apsun/EzGPA
 /// <summary>
 /// Constructs a new dynamic course object and links it to an existing dynamic course.
 /// </summary>
 /// <param name="name">The name of the course container.</param>
 /// <param name="linkedCourse">An existing dynamic course object to link to.</param>
 public DynamicCourse(string name, DynamicCourse linkedCourse)
 {
     if (name == null)
         throw new ArgumentNullException("name");
     if (linkedCourse == null)
         throw new ArgumentNullException("linkedCourse");
     _name = name;
     _courses = linkedCourse._courses;
     DynamicCourse head = linkedCourse;
     if (head._linkedHead != null)
     {
         // Course is already linked to another course
         // Get the actual root of the link chain
         head = head._linkedHead;
         if (head._linkedChildren.Count >= _courses.Length)
             throw new InvalidOperationException("More linked courses than course options");
     }
     else
     {
         // Course is standalone
         // Let head know it's the root of a chain now
         head._linkedHead = head;
         head._linkedChildren = new List<DynamicCourse>();
     }
     head._linkedChildren.Add(this);
     _linkedHead = head;
     _selectedCourse = GetNextCourseChoice();
 }
コード例 #5
0
ファイル: DynamicCourse.cs プロジェクト: apsun/EzGPA
 /// <summary>
 /// Constructs a new dynamic course object.
 /// </summary>
 /// <param name="name">The name of the course container.</param>
 /// <param name="courses">An array containing the underlying course objects.</param>
 public DynamicCourse(string name, StaticCourse[] courses)
 {
     if (name == null)
         throw new ArgumentNullException("name");
     if (courses == null)
         throw new ArgumentNullException("courses");
     if (courses.Length == 0)
         throw new ArgumentException("Must provide at least one course object");
     _name = name;
     _courses = courses;
     _selectedCourse = courses[0];
 }