Example #1
0
 private void LessonUnitAdd(ref ClassLessonUnit clu, ref ListBox lbx)
 {
     lbx.Items.Add(clu);
     clu.Focusable = false;
     //clu.IsHitTestVisible = false;
     clu.IsTabStop           = false;
     clu.HorizontalAlignment = HorizontalAlignment.Stretch;
     clu.Margin = new Thickness(0, 2, 2, 2);
 }
Example #2
0
        private void DisplayList(string DayOfWeek)
        {
            ClassLessonUnit L1 = new ClassLessonUnit();
            ClassLessonUnit L2 = new ClassLessonUnit();
            ClassLessonUnit L3 = new ClassLessonUnit();
            ClassLessonUnit L4 = new ClassLessonUnit();
            ClassLessonUnit L5 = new ClassLessonUnit();
            ClassLessonUnit L6 = new ClassLessonUnit();


            switch (DayOfWeek)
            {
            case "Monday":
                L1.setClassLessonUnit("数学", "地点", "教师", 1, 2);
                L1.setClassLessonUnit("数学", "地点", "教师", 3, 4);
                L3.setClassLessonUnit("密码", "地点", "教师", 5, 7, "蹭课");
                LessonUnitAdd(ref L1, ref listBoxLesson);
                LessonUnitAdd(ref L2, ref listBoxLesson);
                LessonUnitAdd(ref L3, ref listBoxLesson);
                break;

            case "Tuesday":
                L1.setClassLessonUnit("抽代", "地点", "教师", 3, 4);    //, listBoxLesson.Width - 8
                L2.setClassLessonUnit("其他", "地点", "教师", 7, 8);
                LessonUnitAdd(ref L1, ref listBoxLesson);
                LessonUnitAdd(ref L2, ref listBoxLesson);

                break;

            case "Wednesday":
                L1.setClassLessonUnit("体育", "地点", "教师", 3, 4);
                L2.setClassLessonUnit("数学", "地点", "教师", 5, 7);
                L3.setClassLessonUnit("数学", "地点", "教师", 11, 12, "上机");
                LessonUnitAdd(ref L1, ref listBoxLesson);
                LessonUnitAdd(ref L2, ref listBoxLesson);
                LessonUnitAdd(ref L3, ref listBoxLesson);
                break;

            case "Thursday":
                L1.setClassLessonUnit("其他", "地点", "教师", 1, 2, "听力");
                L2.setClassLessonUnit("抽代", "地点", "教师", 1, 2, "习题、主讲");
                L3.setClassLessonUnit("其他", "地点", "教师", 5, 6);
                L4.setClassLessonUnit("超导", "地点", "教师", 7, 8);
                L5.setClassLessonUnit("其他", "地点", "教师", 9, 10);
                LessonUnitAdd(ref L1, ref listBoxLesson);
                LessonUnitAdd(ref L2, ref listBoxLesson);
                LessonUnitAdd(ref L3, ref listBoxLesson);
                LessonUnitAdd(ref L4, ref listBoxLesson);
                LessonUnitAdd(ref L5, ref listBoxLesson);
                break;

            case "Friday":
                L1.setClassLessonUnit("其他", "地点", "教师", 3, 4);
                L2.setClassLessonUnit("数学", "地点", "教师", 5, 6, "习题");
                LessonUnitAdd(ref L1, ref listBoxLesson);
                LessonUnitAdd(ref L2, ref listBoxLesson);
                break;

            //case "Saturday":  break;
            //case "Sunday": break;
            default:
                ListBoxItem def = new ListBoxItem();
                def.Content             = "No lesson";
                def.HorizontalAlignment = HorizontalAlignment.Center;
                def.IsHitTestVisible    = false;
                listBoxLesson.Items.Add(def);
                break;
            }
            listBoxLesson.HorizontalContentAlignment = HorizontalAlignment.Stretch;

            //for (int i = 1; i < listBoxLesson.Items.Count; i++)
            //{
            //    listBoxLesson.Items[2];
            //}
        }