PageRenderTime 53ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/Kronos/TimeTableDesign/MainPage.xaml.cs

https://github.com/lle/soen341kronos
C# | 187 lines | 136 code | 41 blank | 10 comment | 3 complexity | ff3d02c3e46a3db91611564ae57b122c MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Documents;
  8. using System.Windows.Input;
  9. using System.Windows.Media;
  10. using System.Windows.Media.Animation;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Shapes;
  13. using System.Windows.Threading;
  14. using System.IO;
  15. using System.Windows.Controls.Primitives;
  16. namespace TimeTableDesign
  17. {
  18. public class ScheduleData
  19. {
  20. public string Time { get; set; }
  21. public string Monday { get; set; }
  22. public string Tuesday { get; set; }
  23. public string Wednsday { get; set; }
  24. public string Thursday { get; set; }
  25. public string Friday { get; set; }
  26. }
  27. public partial class MainPage : UserControl
  28. {
  29. public MainPage()
  30. {
  31. #region IntializeIt
  32. InitializeComponent();
  33. InitializeTheTable();
  34. IntializeTheComboBox();
  35. IntializeTheAutoCompleteCourses();
  36. #endregion
  37. #region SettingUpTimeIntervals
  38. TimeSpan start_time = TimeSpan.Parse("8:45");
  39. TimeSpan interval_time = TimeSpan.Parse("00:15");
  40. TimeSpan temp_timespan = TimeSpan.Parse("0:00");
  41. List<ScheduleData> students_schedule = new List<ScheduleData>();
  42. string time;
  43. string intial_time = Convert.ToString(start_time);
  44. students_schedule.Add(new ScheduleData() { Time = intial_time });
  45. //Lists all the time intervals
  46. for (int i = 0; i < 100; i++)
  47. {
  48. if (start_time == TimeSpan.Parse("20:15"))
  49. break;
  50. start_time = start_time.Add(interval_time);
  51. time = Convert.ToString(start_time);
  52. students_schedule.Add(new ScheduleData() { Time = time });
  53. }
  54. TimeTable.ItemsSource = students_schedule;
  55. #endregion
  56. }
  57. #region StartDataGridSettings
  58. public void InitializeTheTable()
  59. {
  60. TimeTable.CanUserSortColumns = false;
  61. TimeTable.IsReadOnly = true;
  62. TimeTable.CanUserResizeColumns = false;
  63. TimeTable.CanUserReorderColumns = false;
  64. /* Stylize the Table through the style page located at /Style/TimeTableStyle.xaml
  65. * */
  66. }
  67. #endregion
  68. #region ComboBoxLogic
  69. public void IntializeTheComboBox()
  70. {
  71. ParamterList.Items.Add("Most Days Off");
  72. ParamterList.Items.Add("Evening Classes");
  73. ParamterList.Items.Add("Morning Classes");
  74. }
  75. #endregion
  76. #region PageGeneratedControl
  77. public void IntializeThePageGenerator()
  78. {
  79. //intialize the page thing changer
  80. }
  81. #endregion
  82. #region AutoCompleteLogic
  83. public void IntializeTheAutoCompleteCourses()
  84. {
  85. Course_textbox.MaxDropDownHeight = 80;
  86. List<string> CourseList = new List<string>();
  87. CourseList.Add("COEN 231");
  88. CourseList.Add("COEN 243");
  89. CourseList.Add("COEN 244");
  90. CourseList.Add("COEN 317");
  91. CourseList.Add("COEN 352");
  92. CourseList.Add("COEN 346");
  93. /*
  94. when the database for the courses is setup it will only be a couple lines to do it
  95. foreach(string course in course.database)
  96. CourseList.add(course);
  97. */
  98. Course_textbox.ItemsSource = CourseList;
  99. }
  100. #endregion
  101. #region CheckBoxSemestersLogic
  102. private void Fall_checkbox_Checked_1(object sender, RoutedEventArgs e)
  103. {
  104. Winter_checkbox.IsEnabled = false;
  105. Summer_checkbox.IsEnabled = false;
  106. }
  107. private void Fall_checkbox_Unchecked(object sender, RoutedEventArgs e)
  108. {
  109. Winter_checkbox.IsEnabled = true;
  110. Summer_checkbox.IsEnabled = true;
  111. }
  112. private void Winter_checkbox_Checked(object sender, RoutedEventArgs e)
  113. {
  114. Fall_checkbox.IsEnabled = false;
  115. Summer_checkbox.IsEnabled = false;
  116. }
  117. private void Winter_checkbox_Unchecked(object sender, RoutedEventArgs e)
  118. {
  119. Fall_checkbox.IsEnabled = true;
  120. Summer_checkbox.IsEnabled = true;
  121. }
  122. private void Summer_checkbox_Checked(object sender, RoutedEventArgs e)
  123. {
  124. Fall_checkbox.IsEnabled = false;
  125. Winter_checkbox.IsEnabled = false;
  126. }
  127. private void Summer_checkbox_Unchecked(object sender, RoutedEventArgs e)
  128. {
  129. Fall_checkbox.IsEnabled = true;
  130. Winter_checkbox.IsEnabled = true;
  131. }
  132. #endregion
  133. #region SaveScreenShotSchedule
  134. private void save_button_Click(object sender, RoutedEventArgs e)
  135. {
  136. //the save logic goes here
  137. }
  138. #endregion
  139. #region CourseEnteredClick
  140. private void Course_entered_Click_1(object sender, RoutedEventArgs e)
  141. {
  142. Popup popup = new Popup();
  143. }
  144. #endregion
  145. }
  146. }