Beispiel #1
0
        /// <summary>
        /// Handles the Task grid's click event.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DataGridViewCellEventArgs"/> instance containing the event data.</param>
        private void TasksGrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row  = tasksGrid.Rows[e.RowIndex];
            GradeableTask   task = (GradeableTask)row.Tag;

            switch (e.ColumnIndex)
            {
            case (int)GradeableTasksGridColumn.Edit:
                new GradeableTaskForm(task).Show();
                break;

            case (int)GradeableTasksGridColumn.Delete:
                switch (MessageBox.Show(this, String.Format("Are you sure you want to delete {0}", task.Name),
                                        "Delete Task", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation))
                {
                case DialogResult.OK:
                    task.Delete();
                    break;

                default:
                    break;
                }
                Refresh();
                break;
            }
        }
        public GradeableTaskForm(GradeableTask task) : this()
        {
            Text = "Edit Task";

            this.task = task;

            nameTextBox.Text           = task.Name;
            dueDatePicker.Value        = task.DueDate;
            potentialMarksTextBox.Text = task.PotentialMarks.ToString();
            weightTextBox.Text         = task.Weight.ToString();
        }