예제 #1
0
 private void New_Click(object sender, RoutedEventArgs e)
 {
     NewLessonWindowInstance            = NewLessonWindowInstance ?? new NewLessonWindow();
     NewLessonWindowInstance.Owner      = this;
     NewLessonWindowInstance.Add.Click -= NewLessonWindowInstance.Done_Click;
     NewLessonWindowInstance.Add.Click += NewLessonWindowInstance.Add_Click;
     NewLessonWindowInstance.Show();
 }
예제 #2
0
        private void ContextMenuEditButton_Click(object sender, RoutedEventArgs e)
        {
            if (LessonsList.SelectedItem != null & LessonsList.SelectedItems.Count == 1)
            {
                NewLessonWindowInstance.Add.Click  -= NewLessonWindowInstance.Add_Click;
                NewLessonWindowInstance.Add.Click  += NewLessonWindowInstance.Done_Click;
                NewLessonWindowInstance.Add.Content = "DONE";

                var currentElement = LessonsList.SelectedItem as SchoolLesson;
                NewLessonWindowInstance.NameTextBox.Text              = currentElement.Name;
                NewLessonWindowInstance.SubjectComboBox.SelectedItem  = currentElement.Subject;
                NewLessonWindowInstance.AudienceComboBox.SelectedItem = currentElement.Audience;
                NewLessonWindowInstance.TeacherComboBox.SelectedItem  = currentElement.Teacher;
                NewLessonWindowInstance.GroupComboBox.SelectedItem    = currentElement.Group;

                NewLessonWindowInstance.Show();
            }
            else
            {
                MessageBox.Show("Choose a lesson");
            }
        }