Пример #1
0
 //add group
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     Window1 win1 = new Window1();
     win1.Title = "Добавление новой группы";
     win1.ShowDialog();
     if (win1.flag)
     {
         MyList<Group> clear = new MyList<Group>();
         Group g = new Group();
         g.number = Convert.ToInt32(win1.textbox.Text);
         faclist.getElement(listbox.SelectedIndex).groups.addObject(g);
         foreach (Group gg in faclist.getElement(listbox.SelectedIndex).groups)
             clear.addObject(gg);
         grouplist.ItemsSource = clear;
     }
 }
Пример #2
0
 //delete group
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     if (grouplist.SelectedIndex != -1)
     {
         Window3 win3 = new Window3();
         win3.Karl.Text += " " + faclist.getElement(listbox.SelectedIndex).groups.getElement(grouplist.SelectedIndex).number.ToString() + "?";
         win3.ShowDialog();
         if (win3.flag)
         {
             MyList<Group> clear = new MyList<Group>();
             Group g = new Group();
             g = faclist.getElement(listbox.SelectedIndex).groups.getElement(grouplist.SelectedIndex);
             faclist.getElement(listbox.SelectedIndex).groups.Remove(grouplist.SelectedIndex);
             foreach (Group gg in faclist.getElement(listbox.SelectedIndex).groups)
                 clear.addObject(gg);
             grouplist.ItemsSource = clear;
         }
     }
 }
Пример #3
0
 //delete faculty
 private void Button_Click_3(object sender, RoutedEventArgs e)
 {
     if (listbox.SelectedIndex != -1)
     {
         Window3 win3 = new Window3();
         win3.Karl.Text += " " + faclist.getElement(listbox.SelectedIndex).name + "?";
         win3.ShowDialog();
         if (win3.flag)
         {
             MyList<Faculty> clear = new MyList<Faculty>();
             Faculty f = new Faculty();
             faclist.Remove(listbox.SelectedIndex);
             foreach (Faculty ff in faclist)
                 clear.addObject(ff);
             listbox.ItemsSource = clear;
         }
     }
 }
Пример #4
0
 //add faculti
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     Window1 win1 = new Window1();
     win1.Title = "add new faculty";
     win1.ShowDialog();
     Faculty faculty = new Faculty();
     faculty.name = win1.textbox.Text;
     faclist.addObject(faculty);
     MyList<Faculty> clear = new MyList<Faculty>();
     foreach (Faculty ff in faclist)
         clear.addObject(ff);
     listbox.ItemsSource = clear;
 }
Пример #5
0
 private void listbox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if ((listbox.SelectedIndex != -1) && (flag))
     {
         MyList<Group> clear = new MyList<Group>();
         foreach (Group gg in faclist.getElement(listbox.SelectedIndex).groups)
             clear.addObject(gg);
         grouplist.ItemsSource = clear;
         DoubleAnimation x = new DoubleAnimation();
         x.From = 0;
         x.To = 351;
         x.Duration = TimeSpan.FromSeconds(0.5);
         groupborder.BeginAnimation(Border.WidthProperty, x);
         x.From = 355;
         x.To = 710;
         mainwindow.BeginAnimation(MainWindow.WidthProperty, x);
         flag = false;
     }
 }
Пример #6
0
        private void grouplist_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if ((grouplist.SelectedIndex != -1) && (flag2))
            {
                MyList<Student> clear = new MyList<Student>();
                foreach (Student ss in faclist.getElement(listbox.SelectedIndex).groups.getElement(grouplist.SelectedIndex).students)
                    clear.addObject(ss);
                studentlist.ItemsSource = clear;

                DoubleAnimation x = new DoubleAnimation();
                x.From = 0;
                x.To = 261;
                x.Duration = TimeSpan.FromSeconds(0.5);
                studborder.BeginAnimation(Border.HeightProperty, x);
                x.From = 250;
                x.To = 650;
                mainwindow.BeginAnimation(MainWindow.HeightProperty, x);
                flag2 = false;
            }
        }
Пример #7
0
 //delete student
 private void Button_Click_5(object sender, RoutedEventArgs e)
 {
     if (studentlist.SelectedIndex != -1)
     {
         Window3 win3 = new Window3();
         String name = faclist.getElement(listbox.SelectedIndex).groups.getElement(grouplist.SelectedIndex).students.getElement(studentlist.SelectedIndex).name;
         String surname = faclist.getElement(listbox.SelectedIndex).groups.getElement(grouplist.SelectedIndex).students.getElement(studentlist.SelectedIndex).surname;
         win3.Karl.Text += " " + surname+" "+name  + "?";
         win3.ShowDialog();
         if (win3.flag)
         {
             MyList<Student> clear = new MyList<Student>();
             Student s = new Student();
             s = faclist.getElement(listbox.SelectedIndex).groups.getElement(grouplist.SelectedIndex).students.getElement(studentlist.SelectedIndex);
             faclist.getElement(listbox.SelectedIndex).groups.getElement(grouplist.SelectedIndex).students.Remove(studentlist.SelectedIndex);
             foreach (Student ss in faclist.getElement(listbox.SelectedIndex).groups.getElement(grouplist.SelectedIndex).students)
                 clear.addObject(ss);
             studentlist.ItemsSource = clear;
         }
     }
 }
Пример #8
0
 //add student
 private void Button_Click_4(object sender, RoutedEventArgs e)
 {
     Window2 win2 = new Window2();
     win2.label_of_students.Text = "Факультет:" + listbox.SelectedItem + "  Группа №" + grouplist.SelectedItem;
     win2.ShowDialog();
     if (win2.flag)
     {
         MyList<Student> clear = new MyList<Student>();
         Student s = new Student();
         s.name = win2.name.Text;
         s.surname = win2.surname.Text;
         faclist.getElement(listbox.SelectedIndex).groups.getElement(grouplist.SelectedIndex).students.addObject(s);
         foreach (Student ss in faclist.getElement(listbox.SelectedIndex).groups.getElement(grouplist.SelectedIndex).students)
             clear.addObject(ss);
         studentlist.ItemsSource = clear;
     }
 }