public ClassSection(MainWindow Window, bool IsTutorial, Panel OriginalParent, ClassData Data, Brush Color, SearchItem SearchParent) { InitializeComponent(); window = Window; searchParent = SearchParent; originalParent = OriginalParent; originalMargin = new Thickness(5, 0, 5, 0); originalHeight = Height; data = Data; isTutorial = IsTutorial; name = data.name; type = (IsTutorial) ? "Tutorial" : "Lecture"; SectionType.Content = type; radius = new Point(BG.RadiusX, BG.RadiusY); color = Color; BG.Fill = Color; placedOnce = false; onGrid = false; other = null; TimeSlot[] slots = (IsTutorial) ? Data.tutorialSlots : Data.timeSlots; sections = new GridSection[slots.Length][]; for (int j = 0; j < slots.Length; j++) { TimeSlot t = slots[j]; time = getTime(t.startTime, t.duration); GridSection[] gs = new GridSection[t.days.Length]; for (int i = 0; i < t.days.Length; i++) { GridSection g = new GridSection(this, name, type, color, t.location, time, t); Grid.SetRow(g, (int)Math.Floor(t.startTime)); Grid.SetColumn(g, t.days[i]); Grid.SetRowSpan(g, (int)Math.Ceiling(t.duration)); g.VerticalAlignment = VerticalAlignment.Top; double defaultHeight = 116.5; double height = t.duration * defaultHeight; g.Height = height; Thickness thickness = new Thickness(0); thickness.Top = (t.startTime - Math.Floor(t.startTime)) * defaultHeight; g.Margin = thickness; gs[i] = g; window.ScheduleGrid.Children.Add(g); } foreach (GridSection g in gs) { g.SetConnected(gs); } if (gs.Length > 0) { gs[0].HideConnected(); } sections[j] = gs; } }
// generate list of available courses private List <ClassData> GetClasses() { ClassData cpsc231 = new ClassData("CPSC 231", "Introduction to Computer Science for Computer Science Majors I", "Introduction to problem solving, the analysis and design of small-scale computational systems, and implementation using a procedural programming language. For computer science majors.", "Nathaly Verwaal", "10:00AM-10:50AM MWF, 11:00AM-12:15PM TR", new TimeSlot[] { new TimeSlot(new int[] { 1, 3, 5 }, 3, 60, "ST 140"), new TimeSlot(new int[] { 2, 4 }, 4, 75, "Admin 142") }, true, new TimeSlot[] { new TimeSlot(new int[] { 2, 4 }, 4, 60, "MS 176"), new TimeSlot(new int[] { 5 }, 1, 120, "MS 365") }); ClassData cpsc413 = new ClassData("CPSC 413", "Design and Analysis of Algorithms I", "Techniques for the analysis of algorithms, including counting, summation, recurrences, and asymptotic relations; techniques for the design of efficient algorithms, including greedy methods, divide and conquer, and dynamic programming; examples of their application; an introduction to tractable and intractable problems.", "Peter Hoyer", "9:30AM-10:45AM TR", new TimeSlot[] { new TimeSlot(new int[] { 2, 4 }, 2.5f, 90, "ST 141") }, true, new TimeSlot[] { new TimeSlot(new int[] { 2, 4 }, 4, 60, "ST 070"), new TimeSlot(new int[] { 1, 3 }, 4, 60, "ST 068") }); ClassData cpsc481 = new ClassData("CPSC 481", "Human-Computer Interaction I", "Fundamental theory and practice of the design, implementation, and evaluation of human-computer interfaces. Topics include: principles of design; methods for evaluating interfaces with or without user involvement; techniques for prototyping and implementing graphical user interfaces.", "Ehud Sharlin", "10:00AM-10:50AM MWF", new TimeSlot[] { new TimeSlot(new int[] { 1, 3, 5 }, 3, 60, "ICT 121") }, true, new TimeSlot[] { new TimeSlot(new int[] { 1 }, 5, 120, "MS 156"), new TimeSlot(new int[] { 5 }, 5, 120, "MS 121") }); ClassData math211 = new ClassData("MATH 211", "Linear Methods I", "Systems of equations and matrices, vectors, matrix representations and determinants. Complex numbers, polar form, eigenvalues, eigenvectors. Applications.", "Thi Dinh", "1:00PM-1:50PM MWF, 2:00PM-3:15PM TR", new TimeSlot[] { new TimeSlot(new int[] { 1, 3, 5 }, 6, 60, "Science A 123"), new TimeSlot(new int[] { 2, 4 }, 7, 75, "Education 172") }, true, new TimeSlot[] { new TimeSlot(new int[] { 2, 4 }, 1, 60, "SB 020"), new TimeSlot(new int[] { 2, 4 }, 2, 60, "Kines 070") }); ClassData ling201 = new ClassData("LING 201", "Introduction to Linguistics I", "Introduction to the scientific study of language, including the analysis of word, sentence, and sound structure, and the exploration of language as a human, biological, social, and historical phenomenon.", "Stephen Winters", "2:00PM-2:50PM MWF", new TimeSlot[] { new TimeSlot(new int[] { 1, 3, 5 }, 7, 60, "Murray Fraiser Hall 160") }, false, null); ClassData phil314 = new ClassData("PHIL 314", "Information Technology Ethics", "A critical and analytical examination of ethical and legal problems arising in and about information technology. May include hacking, online privacy, intellectual property rights, artificial intelligence, globalization and regulation issues, cheating in online games, and others.", "Reid Buchanan", "2:00PM-3:15PM TR", new TimeSlot[] { new TimeSlot(new int[] { 2, 4 }, 7, 75, "ST 148") }, false, null); List <ClassData> data = new List <ClassData>(new ClassData[] { cpsc231, cpsc413, cpsc481, math211, ling201, phil314 }); data = Shuffle(data); for (int i = 0; i < data.Count; i++) { data[i].brush = classColors[i]; } data.Sort(ClassData.CompareClassData); return(data); }
private void CreateSearchItems() { items = new SearchItem[classes.Count]; for (int i = 0; i < items.Length; i++) { ClassData data = classes[i]; SearchItem item = new SearchItem(data.name, data.ToString(), this); item.Course_title.Text = data.title; ClassSection lecture = new ClassSection(this, false, item.Sections, data, data.brush, item); item.Sections.Children.Add(lecture); if (data.hasTutorial) { ClassSection tutorial = new ClassSection(this, true, item.Sections, data, data.brush, item); item.Sections.Children.Add(tutorial); tutorial.other = lecture; lecture.other = tutorial; item.numSections = 2; } items[i] = item; } }
public static int CompareClassData(ClassData cd1, ClassData cd2) { return(cd1.name.CompareTo(cd2.name)); }