コード例 #1
0
        private void ShowLessonList(object sender, EventArgs e)
        {
            BUS_UserControls.DisposeControls <LessonList>(this); //Xoá các LessonList không còn dùng

            int courseId = (int)((Control)sender).Tag;           //Lấy courseId từ tag của button gọi hàm

            List <Label> labels = BUS_UserControls.SearchLessonsList(courseId);

            LessonList lessonList = new LessonList(courseId, labels);

            lessonList.Dock = DockStyle.Fill;
            //lessonList.btnChangeCourseClick += new EventHandler(BUS_UserControls.ShowCourse);
            this.Controls.Add(lessonList); //Add LessonList nới tạo vào form

            lessonList.BringToFront();
        }
コード例 #2
0
        public LessonSections(LessonTag tag, List <Label> labels, List <Label> buttons)
        {
            InitializeComponent();

            switch (tag.courseId)
            {
            case 1:
                this.lbCourse.Text = "Touch Typing Course";
                break;

            case 2:
                this.lbCourse.Text = "Most Common Words Course";
                break;

            case 3:
                this.lbCourse.Text = "Speed Building Course";
                break;

            case 4:
                this.lbCourse.Text = "Number, Special Marks and 10-Key Pad Courses";
                break;

            default:
                this.lbCourse.Text = "";
                break;
            }

            foreach (Label lb in buttons)
            {
                lb.Click += new EventHandler(ShowLessonSections);
            }
            this.pnLessonList.Controls.AddRange(buttons.ToArray());

            this.lbLessonName.Text += tag.lessonNumber + " : " + BUS_UserControls.ReadNameFromTag(tag);

            foreach (Label lb in labels)
            {
                if (lb.Tag != null)
                {
                    lb.Click += new EventHandler(ShowTypingForm);
                }

                this.pnSections.Controls.Add(lb);
            }

            this.Dock = DockStyle.Fill;
        }
コード例 #3
0
        public static void ShowTypingForm(object sender, EventArgs e)
        {
            DTO_Exercise exerciseText = BUS_UserControls.SearchTypingInfo(sender);

            Form form = (Form)(((Control)sender).TopLevelControl); //Tìm form ngoài cùng của sender

            if (exerciseText.ExerciseType == "Key")
            {
                Frm_FingerExercise exercise = new Frm_FingerExercise(exerciseText);
                exercise.ShowDialog(form);
            }
            else
            {
                Frm_Typing exercise = new Frm_Typing(exerciseText);
                exercise.ShowDialog(form);
            }
        }
コード例 #4
0
        public static void ShowLessonSections(object sender, EventArgs e)
        {
            Form form = (Form)(((Control)sender).TopLevelControl);   //Tìm form ngoài cùng của sender

            BUS_UserControls.DisposeControls <LessonSections>(form); //Xoá các LessonSections không còn dùng

            LessonTag lessonTag = (LessonTag)(((Label)sender).Tag);  //Ép kiểu thuộc tính Tag sang LessonTag


            List <Label> buttons = new List <Label>();
            List <Label> labels  = BUS_UserControls.SearchLessonSections(lessonTag, sender, ref buttons);

            LessonSections lessonSections = new LessonSections(lessonTag, labels, buttons); //Tạo LessonSection mới

            form.Controls.Add(lessonSections);
            lessonSections.BringToFront();
        }