public static UEKVConfig InitiateInstance(UEKVConfig c) { if (UEKVConfig.instance == null) { UEKVConfig.instance = c; } return(UEKVConfig.GetInstance()); }
private void LoadConfigCourseSelection() { foreach (string s in UEKVConfig.GetInstance().Subjects) { string subjectText = $"{s} ({Library.COURSE_MAIN_ABBRV[Library.COURSE_MAIN_SUBJ[s]]})"; int loc = this.checkedListBox_Profile.Items.IndexOf(subjectText); this.checkedListBox_Profile.SetItemChecked(loc, true); } }
private void LoadConfigJSON() { if (!File.Exists(Library.CONFIG_PATH)) { this.SaveConfigJSON(); } string confRaw = File.ReadAllText(Library.CONFIG_PATH, Encoding.UTF8); UEKVConfig c = JsonConvert.DeserializeObject <UEKVConfig>(confRaw); UEKVConfig.InitiateInstance(c); }
public static UEKVConfig GetInstance() { if (UEKVConfig.instance == null) { UEKVConfig c = new UEKVConfig(); c.lastUpdated = new DateTime(0); c.subjects = new List <string>(); UEKVConfig.instance = c; } return(UEKVConfig.instance); }
private void checkedListBox_Profile_ItemCheck(object sender, ItemCheckEventArgs e) { string subj = (((string)this.checkedListBox_Profile.Items[e.Index]).Split(new char[] { '(' }))[0].Trim(); if (e.NewValue == CheckState.Checked) { if (!UEKVConfig.GetInstance().Subjects.Contains(subj)) { UEKVConfig.GetInstance().Subjects.Add(subj); } } else { if (UEKVConfig.GetInstance().Subjects.Contains(subj)) { UEKVConfig.GetInstance().Subjects.Remove(subj); } } }
private List <CourseEvent> GetCoursesForDay(DateTime dt) { List <CourseEvent> ret = new List <CourseEvent>(); DateTime comp = new DateTime(dt.Year, dt.Month, dt.Day); List <CourseMain> relevantCourses = new List <CourseMain>(); foreach (string s in UEKVConfig.GetInstance().Subjects) { relevantCourses.Add(Library.COURSE_MAIN_SUBJ[s]); } foreach (CourseEvent ce in Library.ALL_COURSE_EVENT) { if (ce.Date == comp && relevantCourses.Contains(ce.Course)) { ret.Add(ce); } } return(ret); }
private void RefreshAbbreviationInfo() { Library.ABBRV_INFORMATION = "Abbreviations:"; List <string> _tmp = UEKVConfig.GetInstance().Subjects; _tmp.Sort(); foreach (string s in _tmp) { Library.ABBRV_INFORMATION += $"\n{s} = {Library.COURSE_MAIN_ABBRV[Library.COURSE_MAIN_SUBJ[s]]}"; } /* * this.relevantSubjects = new List<string>(); * this.abbreviationInfo = "Abbreviations:"; * foreach(string s in this.checkedListBox_Profile.CheckedItems) * { * this.abbreviationInfo += $"\n{this.nameToAbbr[this.fullNameToShort[s]]} = {this.fullNameToShort[s]}"; * this.relevantSubjects.Add(this.fullNameToShort[s]); * } */ }
private UEKVConfig GetConfigJSON() { return(UEKVConfig.GetInstance()); }