示例#1
0
        private void showContextMenuBesideMousePoint(StudentCell studentCell)
        {
            var student           = studentCell.student;
            var contextMenuHeader = new ContextMenuStrip();

            contextMenuHeader.Font = new Font("微軟正黑體", 15, FontStyle.Bold);
            contextMenuHeader.Items.Add("設置為出席");
            contextMenuHeader.Items.Add("設置為缺席");
            contextMenuHeader.Items.Add("設置請假理由");
            contextMenuHeader.Items.Add("唱名");
            contextMenuHeader.Items.Add("刪除學生");
            contextMenuHeader.Items.Add("封鎖學生");
            contextMenuHeader.Items[0].Click += (s, e) => this.signStudent(student, true);
            contextMenuHeader.Items[1].Click += (s, e) => this.signStudent(student, false);
            contextMenuHeader.Items[2].Click += (s, e) => this.createAndShowDialogForAddingStudentBeingAbsentReason(studentCell);
            contextMenuHeader.Items[3].Click += (s, e) => speakStudentName(student);
            contextMenuHeader.Items[4].Click += (s, e) => rollcallUserDefinedSessionPresenter.removeStudent(student);
            //contextMenuHeader.Items[5].Click += (s, e) => rollcallUserDefinedSessionPresenter.blockStudent(student);

            if (studentCell.state == RollcallStudent.State.SIGNED)
            {
                contextMenuHeader.Items[2].Enabled = false;
            }
            contextMenuHeader.Show(Cursor.Position);
        }
示例#2
0
 private void createAndShowDialogForAddingStudentBeingAbsentReason(StudentCell studentCell)
 {
     using (var setReasonDialog = new SetStudentBeingAbsentReasonDialog())
     {
         if (setReasonDialog.ShowDialog() == DialogResult.OK)
         {
             var reason = setReasonDialog.reason;
             if (studentCell.state == RollcallStudent.State.SIGNED)
             {
                 MessageBox.Show("該學生已經簽到!(出席者還會有請假理由?)");
             }
             else if (!string.IsNullOrEmpty(reason))
             {
                 studentCell.absentReasonText = reason;
             }
         }
     }
 }
        public void addStudent(Student student, RollcallStudent.State state,
                               bool autoRowAndColl = true)
        {
            StudentCell studentCell = new StudentCell(student, state);

            if (cellTable.ContainsKey(student))
            {
                var cell = cellTable[student];
                cell.state = state;
            }
            else
            {   // cells can be observable if the listener set
                studentCell.onStudentCellRightClicked += this.onStudentCellClicked;
                studentCell.onStudentCellMouseMove    += this.onStudentCellMouseMove;
                studentCell.onStudentCellMouseLeave   += this.onStudentCellMouseLeave;
                Controls.Add(studentCell);
                cellTable[student] = studentCell;
            }

            if (autoRowAndColl)
            {
                alterRowAndColumnCount();
            }
        }
示例#4
0
 public void StudentCell_Clicked(StudentCell studentCell, MouseEventArgs e)
 {
     showContextMenuBesideMousePoint(studentCell);
 }