Beispiel #1
0
 public SoftwareForm(MainWindow parent, ClassroomSoftware Software, TableView scheduleView)
 {
     this.parent = parent;
     this.scheduleView = scheduleView;
     this.Software = Software;
     InitializeComponent();
     OsCb.ItemsSource = Enum.GetValues(typeof(ClassroomOS)).Cast<ClassroomOS>();
     OsCb.SelectedIndex = 0;
     for (int i = 0; i < OsCb.Items.Count; i++)
     {
         if (((ClassroomOS)OsCb.Items[i]) == Software.OS)
         {
             OsCb.SelectedIndex = i;
             break;
         }
     }
     in_label.Text = Software.Label;
     in_description.Text = Software.Description;
     in_name.Text = Software.Name;
     in_price.Text = Software.Price.ToString();
     in_site.Text = Software.Site;
     in_vendor.Text = Software.Vendor;
     in_date.Text = Software.YearOfPublication.ToString();
     action = "edited";
     grid.DataContext = Software;
 }
Beispiel #2
0
        private void Remove_Click(object sender, RoutedEventArgs e)
        {
            ClassroomSoftware software = (ClassroomSoftware)dg_classroom.SelectedItem;

            if (software != null)
            {
                parent.Classroom.InstalledSoftware.Remove(software);
                dg_classroom.Items.Remove(software);
                dg_classroom.Items.Refresh();
            }
        }
Beispiel #3
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            ClassroomSoftware software = (ClassroomSoftware)dg_all.SelectedItem;

            if (!parent.Classroom.InstalledSoftware.Contains(software) && software != null)
            {
                parent.Classroom.InstalledSoftware.Add(software);
                dg_classroom.Items.Add(software);
                dg_classroom.Items.Refresh();
            }
        }
        private void Remove_Click(object sender, RoutedEventArgs e)
        {
            ClassroomSoftware software = (ClassroomSoftware)dg_subject.SelectedItem;

            if (software != null)
            {
                parent.Subject.SoftwareRequired.Remove(software);
                dg_subject.Items.Remove(software);
                dg_subject.Items.Refresh();
            }
        }
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            ClassroomSoftware software = (ClassroomSoftware)dg_all.SelectedItem;

            if (!parent.Subject.SoftwareRequired.Contains(software) && software != null)
            {
                parent.Subject.SoftwareRequired.Add(software);
                dg_subject.Items.Add(software);
                dg_subject.Items.Refresh();
            }
        }
Beispiel #6
0
 public SoftwareForm(MainWindow parent)
 {
     this.parent = parent;
     Software = new ClassroomSoftware();
     InitializeComponent();
     OsCb.ItemsSource = Enum.GetValues(typeof(ClassroomOS)).Cast<ClassroomOS>();
     OsCb.SelectedIndex = 0;
     action = "added";
     grid.DataContext = Software;
     HelpProvider.SetHelpKey(this, "dodavanje_sadrzaja");
 }
Beispiel #7
0
        private void Clear()
        {
            Software = new ClassroomSoftware();
            OsCb.ItemsSource = Enum.GetValues(typeof(ClassroomOS)).Cast<ClassroomOS>();
            OsCb.SelectedIndex = 0;
            grid.DataContext = Software;

            in_label.Text = "";
            in_description.Text = "";
            in_name.Text = "";
            in_price.Text = "0";
            in_site.Text = "";
            in_vendor.Text = "";
            in_date.Text = "";
        }
Beispiel #8
0
        private void RemoveClassroomSoftwareCompletely(ClassroomSoftware selectedItem)
        {
            classroomSoft.Remove(selectedItem);

            foreach (Classroom cls in classrooms)
            {
                if (cls.InstalledSoftware.Contains(selectedItem))
                {
                    cls.InstalledSoftware.Remove(selectedItem);
                }
            }



            foreach (Subject subj in subjects)
            {
                if (subj.SoftwareRequired.Contains(selectedItem))
                {
                    subj.SoftwareRequired.Remove(selectedItem);
                }
            }
        }
Beispiel #9
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;
            }
        }