private void courseLabelForCoursesView_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { Label label = (Label)sender; DRAG_DROP_START_PANEL = this; int subIndex = this.getSubLabelIndex(label); Course dragedCourse = (Course)label.Tag; ListViewItem lvi = new ListViewItem(); lvi.Tag = dragedCourse; ArrayList notAllowedTimeSlots = HardConstraintChecks.findAllFreeTimeSlots(dragedCourse); //if drag-drop was successfull, delete label from old location if (DragDropEffects.Move == label.DoDragDrop(lvi, DragDropEffects.Move)) { TSPCoursesViewDragDropSuccessfullCmd sddsCmd = new TSPCoursesViewDragDropSuccessfullCmd(dragedCourse, this, subIndex); DRAG_DROP_MACRO_CMD.addInList(sddsCmd); CommandProcessor.getCommandProcessor().doCmd(DRAG_DROP_MACRO_CMD); } DRAG_DROP_START_PANEL = null; AppForm.getAppForm().doBackTimeSlotPanelGUI(notAllowedTimeSlots); }
private void courseLabelForTeacherView_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { Label label = (Label)sender; DRAG_DROP_START_PANEL = this; Course courseForMove = (Course)label.Tag; EduProgram epInMove = (EduProgram)courseForMove.Parent; ArrayList [,] mytt = epInMove.getTimetable(); ArrayList lessonsInOneTimeSlot = mytt[_indexRow, _indexCol]; Object [] courseAndRoomPair = null; foreach (Object [] courseAndRoomPairInList in lessonsInOneTimeSlot) { Course thisCourse = (Course)courseAndRoomPairInList[0]; if (thisCourse == courseForMove) { courseAndRoomPair = courseAndRoomPairInList; break; } } Course dragedCourse = (Course)courseAndRoomPair[0]; ListViewItem lvi = new ListViewItem(); lvi.Tag = dragedCourse; ArrayList notAllowedTimeSlots = HardConstraintChecks.findAllFreeTimeSlots(dragedCourse); //if drag-drop was successfull, delete label from old location if (DragDropEffects.Move == label.DoDragDrop(lvi, DragDropEffects.Move)) { TSPTeachersViewDragDropSuccessfullCmd nddsCmd = new TSPTeachersViewDragDropSuccessfullCmd(dragedCourse, this, lessonsInOneTimeSlot, courseAndRoomPair); DRAG_DROP_MACRO_CMD.addInList(nddsCmd); CommandProcessor.getCommandProcessor().doCmd(DRAG_DROP_MACRO_CMD); } DRAG_DROP_START_PANEL = null; AppForm.getAppForm().doBackTimeSlotPanelGUI(notAllowedTimeSlots); }