/// <summary> /// Populates the Time of day dbo /// with AM and PM respectively /// </summary> public void PopulateAM_PM_Cbo() { _amPM.Add("AM"); _amPM.Add("PM"); AMPM = _amPM; SelectedTimeOfDay_StartTime = AMPM.ElementAt(0); SelectedTimeOfDay_EndTime = AMPM.ElementAt(0); }
private IEnumerator HeartNow() { while (true) { AMPM.Heart(); yield return(new WaitForSeconds((1 / 60))); } }
public static routine addSpecificCourse(string cid) { database db = new database(); routine r = new routine(); r.courses = new List <course>(); string query = "select * from timing where cid = " + cid; course c; c.slots = new List <coursetime>(); coursetime t = new coursetime(); DataTable dt = db.Table(query); bool isMatch; for (int i = 0; i < dt.Rows.Count; i++) { isMatch = false; c = new course(); t.day = dt.Rows[i]["day"].ToString(); t.start = DateTime.Parse(dt.Rows[i]["start"].ToString()); t.end = DateTime.Parse(dt.Rows[i]["endt"].ToString()); string AMPM; if (t.start.Hour >= 1 && t.start.Hour <= 3) { AMPM = t.start.ToString(); AMPM = AMPM.Remove(AMPM.Length - 2, 2); AMPM += "PM"; t.start = DateTime.Parse(AMPM); } if (t.end.Hour >= 1 && t.end.Hour <= 5) { AMPM = t.end.ToString(); AMPM = AMPM.Remove(AMPM.Length - 2, 2); AMPM += "PM"; t.end = DateTime.Parse(AMPM); } for (int j = 0; j < r.courses.Count; j++) { if (dt.Rows[i]["sec"].ToString() == r.courses[j].section) { isMatch = true; r.courses[j].slots.Add(t); break; } } if (isMatch == false) { c.slots = new List <coursetime>(); c.name = dt.Rows[i]["cname"].ToString(); c.section = dt.Rows[i]["sec"].ToString(); c.slots.Add(t); r.courses.Add(c); } } return(r); }
private IEnumerator HeartNow() { while (true) { AMPM.Heart(); guiColor = Random.ColorHSV(); yield return(new WaitForSeconds(heartbeatInterval)); } }
// Use this for initialization void OnEnable() { AMPM.OnConfigLoaded += ParseConfig; #if UNITY_STANDALONE && !UNITY_EDITOR AMPM.GetConfigFromUrl(); #else Debug.Log("AMPM is running in editor mode"); string pathString = Path.Combine(Application.streamingAssetsPath, configFileName); AMPM.GetConfigFromFile(pathString); #endif }
/// <summary> /// Sets all fields to their default values /// following the save event /// </summary> public void ClearFields() { SelectedDepartment = DepartmentCollection.ElementAt(0); EventTitle = string.Empty; EventDescription = string.Empty; StartDate = DateTime.Now; EndDate = null; SelectedStartTime = TimeCollection.ElementAt(0); SelectedEndTime = TimeCollection.ElementAt(0); IsSchoolWideEvent = true ? false : true; SelectedTimeOfDay_StartTime = AMPM.ElementAt(0); SelectedTimeOfDay_EndTime = AMPM.ElementAt(0); }
/// <summary> /// Verifies that the selected time are valid e.g. /// that the end time is not before the start time /// </summary> public bool ValidateEventTimes() { // if both times are AM or if both times are PM if (SelectedTimeOfDay_StartTime == AMPM.ElementAt(1) && SelectedTimeOfDay_EndTime == AMPM.ElementAt(0)) { MessageBox.Show("End time cannot be before the start time", "Invalid Time", MessageBoxButton.OK, MessageBoxImage.Exclamation); return(false); } else if ((SelectedTimeOfDay_StartTime == AMPM.ElementAt(0) && SelectedTimeOfDay_EndTime == AMPM.ElementAt(0)) || SelectedTimeOfDay_StartTime == AMPM.ElementAt(1) && SelectedTimeOfDay_EndTime == AMPM.ElementAt(1)) { if (int.Parse(SelectedStartTime) > int.Parse(SelectedEndTime)) { MessageBox.Show("End time cannot be before the start time", "Invalid Time", MessageBoxButton.OK, MessageBoxImage.Exclamation); return(false); } } return(true); }
private void OnApplicationQuit() { Debug.Log("closing AMPM"); AMPM.Close(); }
// Use this for initialization void OnEnable() { AMPM.OnConfigLoaded += ParseConfig; AMPM.GetConfig(); }