public SoftwareForSubjectForm(SubjectForm parent)
        {
            this.parent = parent;
            InitializeComponent();

            foreach (ClassroomSoftware soft in parent.parent.application.classroomSoft)
            {
                dg_all.Items.Add(soft);
            }
            foreach (ClassroomSoftware soft in parent.Subject.SoftwareRequired)
            {
                dg_subject.Items.Add(soft);
            }
            dg_subject.Items.Refresh();
            dg_all.Items.Refresh();
        }
Exemple #2
0
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            if (dataGrid == null)
            {
                return;
            }
            initOptions();
            if (selectCollection.SelectedItem == null)
            {
                MessageBoxResult result = MessageBox.Show("Niste odabrali podatke za prikaz.", "Obaveštenje", MessageBoxButton.OK, MessageBoxImage.Information);

                return;
            }
            string arg = ((ComboBoxItem)selectCollection.SelectedItem).Content.ToString();

            switch (arg)
            {
            case "Ucionice":
            {
                Classroom classroom = (Classroom)dataGrid.SelectedItem;
                if (classroom != null)
                {
                    ClassroomForm classroomForm = new ClassroomForm(parent, classroom, this);
                    parent.Title = "Izmena učionice";
                    parent.ChangeElement(classroomForm);
                }
                else
                {
                    MessageBoxResult result = MessageBox.Show("Niste odabrali učionicu iz tabele.", "Obaveštenje", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            break;

            case "Smerovi":
                Department department = (Department)dataGrid.SelectedItem;
                if (department != null)
                {
                    DepartmentForm departmentForm = new DepartmentForm(parent, department, this);
                    parent.Title = "Izmena departmana";
                    parent.ChangeElement(departmentForm);
                }
                else
                {
                    MessageBoxResult result = MessageBox.Show("Niste odabrali departman iz tabele.", "Obaveštenje", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                break;

            case "Softver":
                ClassroomSoftware classroomSoftware = (ClassroomSoftware)dataGrid.SelectedItem;
                if (classroomSoftware != null)
                {
                    SoftwareForm softwareForm = new SoftwareForm(parent, classroomSoftware, this);
                    parent.Title = "Izmena softvera";
                    parent.ChangeElement(softwareForm);
                }
                else
                {
                    MessageBoxResult result = MessageBox.Show("Niste odabrali softver iz tabele.", "Obaveštenje", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                break;

            case "Predmeti":
                Subject subject = (Subject)dataGrid.SelectedItem;
                if (subject != null)
                {
                    SubjectForm subjectForm = new SubjectForm(parent, subject, this);
                    parent.Title = "Izmena predmeta";
                    parent.ChangeElement(subjectForm);
                }
                else
                {
                    MessageBoxResult result = MessageBox.Show("Niste odabrali predmet iz tabele.", "Obaveštenje", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                break;
            }
        }