Пример #1
0
        public StudentsWindow(MainWindow _mainWindow, GroupEnum _groups, StudentEnum _students)
        {
            InitializeComponent();


            newButtonImage.Source      = BitmapToImageSource(StudentsBaseResources.newIcon);
            openButtonImage.Source     = BitmapToImageSource(StudentsBaseResources.openIcon);
            saveButtonImage.Source     = BitmapToImageSource(StudentsBaseResources.saveIcon);
            menuButtonImage.Source     = BitmapToImageSource(StudentsBaseResources.menuIcon);
            runButtonImage.Source      = BitmapToImageSource(StudentsBaseResources.runIcon);
            settingsButtonImage.Source = BitmapToImageSource(StudentsBaseResources.settingsIcon);

            refreshMenu();

            groups     = _groups;
            students   = _students;
            mainWindow = _mainWindow;
            check      = false;

            List.ItemsSource = students.studentlist;
            List.Items.Refresh();
            List.SelectedIndex = -1;

            GroupCombo.ItemsSource          = groups.groupList;
            GroupCombo.DisplayMemberPath    = "Number";
            OldGroupCombo.ItemsSource       = groups.groupList;
            OldGroupCombo.DisplayMemberPath = "Number";

            Table.ItemsSource = mark.marks;
        }
Пример #2
0
        public GroupsWindow(MainWindow _mainWindow, GroupEnum _groups, StudentEnum _students)
        {
            InitializeComponent();

            groups     = _groups;
            students   = _students;
            mainWindow = _mainWindow;
            check      = false;

            List.ItemsSource = groups.groupList;
            List.Items.Refresh();
            SubjectGrid.ItemsSource = subject.teachers;

            HeadCombo.ItemsSource       = students.studentlist;
            HeadCombo.DisplayMemberPath = "Surname";

            newButtonImage.Source      = BitmapToImageSource(StudentsBaseResources.newIcon);
            openButtonImage.Source     = BitmapToImageSource(StudentsBaseResources.openIcon);
            saveButtonImage.Source     = BitmapToImageSource(StudentsBaseResources.saveIcon);
            menuButtonImage.Source     = BitmapToImageSource(StudentsBaseResources.menuIcon);
            runButtonImage.Source      = BitmapToImageSource(StudentsBaseResources.runIcon);
            settingsButtonImage.Source = BitmapToImageSource(StudentsBaseResources.settingsIcon);

            refreshMenu();
        }
Пример #3
0
        public StudentInfo(object _selectedItem, GroupEnum _groups, StudentEnum _students, int _selectedIndex)
        {
            InitializeComponent();
            myList        = new List <StudentInfoPage>(); // [0] - first, [1] - last, [2] - next, [3] - prev;
            selectedItem  = (Student)_selectedItem;
            groups        = _groups;
            students      = _students;
            selectedIndex = _selectedIndex;
            Task.Factory.StartNew(() =>
            {
                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                {
                    //foreach (Student student in students.studentlist)
                    //  myList.Add(new StudentInfoPage(selectedItem, groups, students));

                    myList.Add(new StudentInfoPage(students.studentlist[0], groups, students));
                    myList.Add(new StudentInfoPage(students.studentlist[students.Count() - 1], groups, students));

                    if (selectedIndex != students.studentlist.Count() - 1)
                    {
                        myList.Add(new StudentInfoPage(students.studentlist[selectedIndex + 1], groups, students));
                    }
                    else
                    {
                        myList.Add(new StudentInfoPage(students.studentlist[selectedIndex], groups, students));
                    }

                    if (selectedIndex != 0)
                    {
                        myList.Add(new StudentInfoPage(students.studentlist[selectedIndex - 1], groups, students));
                    }
                    else
                    {
                        myList.Add(new StudentInfoPage(students.studentlist[selectedIndex], groups, students));
                    }
                }));
            });

            if (students.studentlist.Count == 0)
            {
                Last.IsEnabled  = false;
                Next.IsEnabled  = false;
                Prev.IsEnabled  = false;
                First.IsEnabled = false;
            }
            if (selectedIndex == students.studentlist.Count() - 1)
            {
                Last.IsEnabled = false;
                Next.IsEnabled = false;
            }
            if (selectedIndex == 0)
            {
                First.IsEnabled = false;
                Prev.IsEnabled  = false;
            }

            newInfo.NavigationService.Navigate(new StudentInfoPage(selectedItem, groups, students));
        }
Пример #4
0
        public GroupInfo(object _selectedItem, GroupEnum _groups, StudentEnum _students, int _selectedIndex)
        {
            InitializeComponent();
            myList = new List <GroupInfoPage>();

            selectedIndex = _selectedIndex;
            selectedItem  = (Group)_selectedItem;
            groups        = _groups;
            students      = _students;

            Task.Factory.StartNew(() =>
            {
                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                {
                    myList.Add(new GroupInfoPage(groups.groupList[0], groups, students));
                    myList.Add(new GroupInfoPage(groups.groupList[groups.Count() - 1], groups, students));

                    if (selectedIndex != groups.groupList.Count() - 1)
                    {
                        myList.Add(new GroupInfoPage(groups.groupList[selectedIndex + 1], groups, students));
                    }
                    else
                    {
                        myList.Add(new GroupInfoPage(groups.groupList[selectedIndex], groups, students));
                    }

                    if (selectedIndex != 0)
                    {
                        myList.Add(new GroupInfoPage(groups.groupList[selectedIndex - 1], groups, students));
                    }
                    else
                    {
                        myList.Add(new GroupInfoPage(groups.groupList[selectedIndex], groups, students));
                    }
                }));
            });

            if (groups.groupList.Count == 0)
            {
                Last.IsEnabled  = false;
                Next.IsEnabled  = false;
                Prev.IsEnabled  = false;
                First.IsEnabled = false;
            }
            if (selectedIndex == groups.groupList.Count() - 1)
            {
                Last.IsEnabled = false;
                Next.IsEnabled = false;
            }
            if (selectedIndex == 0)
            {
                First.IsEnabled = false;
                Prev.IsEnabled  = false;
            }

            newInfo.NavigationService.Navigate(new GroupInfoPage(selectedItem, groups, students));
        }
Пример #5
0
        public GroupInfoPage(object _selectedItem, GroupEnum _groups, StudentEnum _students)
        {
            InitializeComponent();
            selectedItem             = (Group)_selectedItem;
            groups                   = _groups;
            students                 = _students;
            StudentsList.ItemsSource = students.studentlist;
            TeachersList.ItemsSource = selectedItem.teachers;
            ICollectionView view = CollectionViewSource.GetDefaultView(StudentsList.ItemsSource);

            view.Filter = null;
            view.Filter = filter;

            NumberGr.Text = "Students of the group: " + selectedItem.Number;
        }
Пример #6
0
        public MainWindow()
        {
            InitializeComponent();

            groups   = new GroupEnum();
            students = new StudentEnum();

            if (Directory.Exists(Directory.GetCurrentDirectory() + @"\Buffer"))
            {
                Directory.Delete(Directory.GetCurrentDirectory() + @"\Buffer", true);
            }


            newButtonImage.Source      = BitmapToImageSource(StudentsBaseResources.newIcon);
            openButtonImage.Source     = BitmapToImageSource(StudentsBaseResources.openIcon);
            saveButtonImage.Source     = BitmapToImageSource(StudentsBaseResources.saveIcon);
            menuButtonImage.Source     = BitmapToImageSource(StudentsBaseResources.menuIcon);
            runButtonImage.Source      = BitmapToImageSource(StudentsBaseResources.runIcon);
            settingsButtonImage.Source = BitmapToImageSource(StudentsBaseResources.settingsIcon);

            refreshMenu();
        }
Пример #7
0
        private void MenuItem_Click_1(object sender, RoutedEventArgs e)
        {
            GroupEnum   new_groups   = new GroupEnum();
            StudentEnum new_students = new StudentEnum();


            OpenFileDialog dialog = new OpenFileDialog();

            dialog.DefaultExt = ".zip";
            dialog.Filter     = "zip|*.zip";

            string selectedArchive = "";
            bool?  result          = dialog.ShowDialog();

            if (result == true)
            {
                selectedArchive = dialog.FileName;
            }
            else
            {
                return;
            }
            try
            {
                if (!Directory.Exists(Directory.GetCurrentDirectory() + @"\Buffer") && selectedArchive != "")
                {
                    ZipFile.ExtractToDirectory(selectedArchive, Directory.GetCurrentDirectory());
                }
                else
                {
                    return;
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Please, select another folder ", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            FileStream   connector = new FileStream(Directory.GetCurrentDirectory() + @"\Buffer\Temp.txt", FileMode.Open);;
            StreamReader reader    = new StreamReader(connector);

            int groupsNumber = Convert.ToInt32(reader.ReadLine());

            reader.ReadLine();
            for (int i = 0; i < groupsNumber; i++)
            {
                reader.ReadLine();
                Group new_group = new Group();

                new_group.Number   = Convert.ToInt32(reader.ReadLine());
                new_group.Actual   = reader.ReadLine();
                new_group.headName = reader.ReadLine();
                int teachersNumber = Convert.ToInt32(reader.ReadLine());

                Group subject = new Group();
                if (teachersNumber != 0)
                {
                    reader.ReadLine();
                    for (int j = 0; j < teachersNumber; j++)
                    {
                        Group.struct_teachers new_teacher = new Group.struct_teachers();
                        new_teacher.Name    = reader.ReadLine();
                        new_teacher.Subject = reader.ReadLine();
                        subject.teachers.Add(new_teacher);
                    }
                    reader.ReadLine();
                    new_group.teachers = new List <Group.struct_teachers>(subject.teachers);
                }
                else
                {
                    reader.ReadLine();
                }

                reader.ReadLine();
                new_groups.groupList.Add(new_group);
            }
            reader.ReadLine();

            int studentsNumber = Convert.ToInt32(reader.ReadLine());

            reader.ReadLine();
            for (int i = 0; i < studentsNumber; i++)
            {
                reader.ReadLine();
                Student new_student = new Student();

                new_student.Name             = reader.ReadLine();
                new_student.Surname          = reader.ReadLine();
                new_student.Middlename       = reader.ReadLine();
                new_student.Year             = Convert.ToInt32(reader.ReadLine());
                new_student.isHead           = reader.ReadLine();
                new_student.groupHeading     = reader.ReadLine();
                new_student.group_number     = reader.ReadLine();
                new_student.old_group_number = reader.ReadLine();

                new_student.photoPath = reader.ReadLine();
                if (new_student.photoPath != "")
                {
                    BitmapImage StudentPhoto = new BitmapImage();
                    StudentPhoto.BeginInit();
                    StudentPhoto.UriSource   = new Uri(new_student.photoPath, UriKind.Absolute);
                    StudentPhoto.CacheOption = BitmapCacheOption.OnLoad;
                    StudentPhoto.EndInit();
                    new_student.studentPhoto = StudentPhoto;
                }

                int     marksNumber = Convert.ToInt32(reader.ReadLine());
                Student mark        = new Student();
                if (marksNumber != 0)
                {
                    reader.ReadLine();
                    for (int j = 0; j < marksNumber; j++)
                    {
                        Student.struct_marks new_mark = new Student.struct_marks();
                        new_mark.Mark    = Convert.ToInt32(reader.ReadLine());
                        new_mark.Subject = reader.ReadLine();
                        mark.marks.Add(new_mark);
                    }
                    reader.ReadLine();
                    new_student.marks = new List <Student.struct_marks>(mark.marks);
                }
                else
                {
                    reader.ReadLine();
                }

                reader.ReadLine();
                new_students.studentlist.Add(new_student);
            }

            for (int i = 0; i < new_groups.groupList.Count(); i++)
            {
                for (int j = 0; j < new_students.studentlist.Count(); j++)
                {
                    if (new_students.studentlist[j].group_number == Convert.ToString(new_groups.groupList[i].Number))
                    {
                        new_students.studentlist[j].group = new_groups.groupList[i];
                        if (new_students.studentlist[j].groupHeading == Convert.ToString(new_groups.groupList[i].Number))
                        {
                            new_groups.groupList[i].head = new_students.studentlist[j];
                        }
                    }
                    if (new_students.studentlist[j].old_group_number == Convert.ToString(new_groups.groupList[i].Number))
                    {
                        new_students.studentlist[j].oldGroup = new_groups.groupList[i];
                    }
                }
            }
            reader.Close();
            connector.Close();

            groups.groupList     = new_groups.groupList;
            students.studentlist = new_students.studentlist;

            List.ItemsSource = groups.groupList;
            List.Items.Refresh();
            SubjectGrid.ItemsSource = subject.teachers;

            List.SelectedIndex = -1;
            NumberBox.Clear();
            HeadCombo.SelectedIndex = -1;
            subject.teachers.Clear();
            SubjectGrid.ItemsSource = subject.teachers;
            SubjectGrid.Items.Refresh();

            CheckExisting.IsChecked = false;
            ChangeButton.IsEnabled  = false;
            DeleteButton.IsEnabled  = false;

            if (Directory.Exists(Directory.GetCurrentDirectory() + @"\Buffer"))
            {
                Directory.Delete(Directory.GetCurrentDirectory() + @"\Buffer", true);
            }

            MessageBox.Show("File loaded", "", MessageBoxButton.OK, MessageBoxImage.Information);
        }
Пример #8
0
        public StudentInfoPage(object _selectedItem, GroupEnum _groups, StudentEnum _students)
        {
            InitializeComponent();

            selectedItem = (Student)_selectedItem;
            groups       = _groups;
            students     = _students;

            StMarks.ItemsSource = selectedItem.marks;

            StudentName.Text       = "Name: " + Convert.ToString(selectedItem.Name);
            StudentSurname.Text    = "Surname: " + Convert.ToString(selectedItem.Surname);
            StudentMiddlename.Text = "Middlename: " + Convert.ToString(selectedItem.Middlename);
            StudentYear.Text       = "Year of recept: " + Convert.ToString(selectedItem.Year);

            if (selectedItem.group_number == "-")
            {
                StudentGroup.Text = "Group : Not Selected";
            }
            else
            {
                StudentGroup.Text = "Group : " + selectedItem.group_number;
            }

            if (selectedItem.old_group_number == "-")
            {
                StudentOldGroup.Text = "Old Group : Not Selected";
            }
            else
            {
                StudentOldGroup.Text = "Old Group: " + selectedItem.old_group_number;
            }

            if (selectedItem.isHead == "+")
            {
                StudentisHead.Text = "Head: Yes";
            }
            else
            {
                StudentisHead.Text = "Head: No";
            }

            if (selectedItem.studentPhoto != null)
            {
                StudentImage.Source = selectedItem.studentPhoto;
            }
            else
            {
                var bitmap = StudentsBaseResources.noPhoto;
                using (MemoryStream memory = new MemoryStream())
                {
                    bitmap.Save(memory, System.Drawing.Imaging.ImageFormat.Bmp);
                    memory.Position = 0;
                    BitmapImage bitmapimage = new BitmapImage();
                    bitmapimage.BeginInit();
                    bitmapimage.StreamSource = memory;
                    bitmapimage.CacheOption  = BitmapCacheOption.OnLoad;
                    bitmapimage.EndInit();

                    StudentImage.Source = bitmapimage;
                }
                //StudentImage.Source = StudentsBaseResources.noPhoto;
            }
        }