Exemplo n.º 1
0
        private void AddNewDepartments(object sender, RoutedEventArgs e)
        {
            var newDepartment = new Department();
            AddDepartmentForm addDepartmentForm = new AddDepartmentForm(newDepartment);

            addDepartmentForm.Show();
            addDepartmentForm.Closed += (s, ea) => _departments.Add(newDepartment);
        }
Exemplo n.º 2
0
        private void ChangeDepartment(object sender, RoutedEventArgs e)
        {
            var selectDepartment = lbDepartmant.SelectedItem as Department;
            var selectedIndex    = lbDepartmant.SelectedIndex;

            if (selectDepartment is null)
            {
                MessageBox.Show("Выберите департамент");
                return;
            }
            AddDepartmentForm changeDepartment = new AddDepartmentForm(selectDepartment);

            changeDepartment.Show();
            changeDepartment.Closed += (s, ea) => _departments.RemoveAt(selectedIndex);
            changeDepartment.Closed += (s, ea) => _departments.Add(selectDepartment);
        }