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);
     }
 }
示例#2
0
        public static UEKVConfig InitiateInstance(UEKVConfig c)
        {
            if (UEKVConfig.instance == null)
            {
                UEKVConfig.instance = c;
            }

            return(UEKVConfig.GetInstance());
        }
        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());
 }