コード例 #1
0
        private void NewClassbtn_Click(object sender, EventArgs e)
        {
            ClassEditForm classForm = new ClassEditForm();

            classForm.ShowDialog();
            if (classForm.DialogResult == DialogResult.OK)
            {
                Model.createClass(classForm.className, classForm.studentNames);
                addClassButton(classForm.className);
                Model.setCurrentClass(classForm.className);
            }
        }
コード例 #2
0
        private void editToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string        originalClassName = Model.currentClass.Name;
            ClassEditForm classForm         = new ClassEditForm(Model.currentClass.Name);

            classForm.ShowDialog();
            if (classForm.DialogResult == DialogResult.OK)
            {
                foreach (ToolStripItem button in classesToolStripMenuItem.DropDownItems)
                {
                    if (button.Text == originalClassName)
                    {
                        button.Text = classForm.className;
                        break;
                    }
                }
                Model.updateCurrentClass(classForm.className, classForm.studentNames);
            }
        }