예제 #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Student       newStudent    = new Student();
            StudentWindow studentWindow = new StudentWindow(newStudent);

            //StudentWindow studentWindow = new StudentWindow();
            //Student newStudent = studentWindow.Student;
            studentWindow.ShowDialog();
            if (studentWindow.DialogResult == true)
            {
                lbStudents.Items.Add(newStudent);
            }
        }
        private void btnAddStudent_Click(object sender, RoutedEventArgs e)
        {
            Student       newStudent    = new Student();
            StudentWindow studentWindow = new StudentWindow(newStudent);

            studentWindow.ShowDialog();

            if (studentWindow.DialogResult == true)
            {
                MessageBox.Show("Student " + newStudent.StudentNumber + " Added!");
                school.Students.Add(newStudent);
                lbStudents.Items.Refresh();
            }
            else
            {
                MessageBox.Show("Dialog Cancelled!");
            }
        }