Esempio n. 1
0
        private void AddNewTermCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            AddNewOrUpdateTermDialog anoutd = new AddNewOrUpdateTermDialog(this, "Add new term", null, -1, -1);

            anoutd.inicijalizacijaDialoga(null);
            anoutd.ShowDialog();
        }
Esempio n. 2
0
        private void SubjectsOrTerms_Drop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent("myFormatSubject"))
            {
                if (SelectedElement != null)
                {
                    SelectedElement.SelectedItems.Clear();
                }

                Subject subject = e.Data.GetData("myFormatSubject") as Subject;
                //Subjects.Remove(subject);

                ListView listView = sender as ListView;
                //int indexOfClassroom = Grid.GetColumn(listView);
                //List<Classroom> classrooms = ComputerCentre.context.Classrooms.Include(s => s.Softwares).ToList();
                //int numOfClassrooms = classrooms.Count();
                //indexOfClassroom = indexOfClassroom % numOfClassrooms;

                //Classroom classroom = classrooms[indexOfClassroom];
                //if (!ClassroomMatchSubjectNeeds(classroom, subject))
                //{
                //    return;
                //}
                ListViewItem listViewItem = FindAncestor <ListViewItem>((DependencyObject)e.OriginalSource);
                int          indexOfTerm  = listView.ItemContainerGenerator.IndexFromContainer(listViewItem);
                //listView.SelectedItem = listViewItem;
                listView.SelectedIndex = indexOfTerm;
                SelectedElement        = listView;

                AddNewOrUpdateTermDialog anoutd = new AddNewOrUpdateTermDialog(this, "Add new term", null, -1, -1);
                anoutd.inicijalizacijaDialoga(subject);
                anoutd.ShowDialog();
            }
            else if (e.Data.GetDataPresent("myFormatTerm"))
            {
                Term term          = e.Data.GetData("myFormatTerm") as Term;
                int  oldTermRow    = SelectedElement.SelectedIndex;
                int  oldTermColumn = Grid.GetColumn(SelectedElement);

                if (SelectedElement != null)
                {
                    //SelectedElement.SelectedItems.Clear();
                    for (int i = 0; i < MainGrid.Children.Count; i++)
                    {
                        (MainGrid.Children[i] as ListView).SelectedItems.Clear();
                    }
                }

                ListView     listView     = sender as ListView;
                ListViewItem listViewItem = FindAncestor <ListViewItem>((DependencyObject)e.OriginalSource);
                int          indexOfTerm  = listView.ItemContainerGenerator.IndexFromContainer(listViewItem);
                listView.SelectedIndex = indexOfTerm;
                SelectedElement        = listView;

                AddNewOrUpdateTermDialog anoutd = new AddNewOrUpdateTermDialog(this, "Change term", term, oldTermRow, oldTermColumn);
                anoutd.inicijalizacijaDialoga(term.Subject);
                anoutd.ShowDialog();
            }
        }
Esempio n. 3
0
        private void UpdateTermCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            int indexOfClassroom = Grid.GetColumn(SelectedElement);
            int indexOfTerm      = SelectedElement.SelectedIndex;

            Term term = ObservableList[indexOfClassroom][indexOfTerm];
            AddNewOrUpdateTermDialog anoutd = new AddNewOrUpdateTermDialog(this, "Update term", term, indexOfTerm, indexOfClassroom);

            anoutd.inicijalizacijaDialoga(term.Subject);
            anoutd.ShowDialog();
        }