Exemple #1
0
 private void Button_Select_File(object sender, RoutedEventArgs e)
 {
     Clear();
     binaryTree = BinaryFileUtil.Read();
     if (binaryTree == null || binaryTree.Count == 0)
     {
         outputConsole.Foreground = Brushes.Red;
         outputConsole.Text       = "Error reading file. Check that this file have extension .bin and that this file is not empty";
     }
     else
     {
         nameOfFile.Visibility      = Visibility.Visible;
         listBoxCommands.Visibility = Visibility.Visible;
         nameOfFile.Content         = BinaryFileUtil.FILE_NAME;
         ShowPreSettings();
     }
 }
Exemple #2
0
        private void ButtonGetData_Click(object sender, RoutedEventArgs e)
        {
            outputConsole.Foreground = Brushes.Black;
            outputConsole.Text       = "";
            switch (get_data_commands)
            {
            case 0:
                students = BinaryFileUtil.OrderStudents(BinaryFileUtil.GetByNumberLines(binaryTree, numberLines), (uint)orderBy, (uint)orderType);
                CheckData(students);
                foreach (Student student in students)
                {
                    outputConsole.Text += student.ToString() + "\n";
                }
                break;

            case 1:
                students = BinaryFileUtil.OrderStudents(BinaryFileUtil.GetByNumberLines(BinaryFileUtil.GetByFirstName(binaryTree, Info), numberLines), (uint)orderBy, (uint)orderType);
                CheckData(students);
                foreach (Student student in students)
                {
                    outputConsole.Text += student.ToString() + "\n";
                }
                break;

            case 2:
                students = BinaryFileUtil.OrderStudents(BinaryFileUtil.GetByNumberLines(BinaryFileUtil.GetBySecondName(binaryTree, Info), numberLines), (uint)orderBy, (uint)orderType);
                CheckData(students);
                foreach (Student student in students)
                {
                    outputConsole.Text += student.ToString() + "\n";
                }
                break;

            case 3:
                students = BinaryFileUtil.OrderStudents(BinaryFileUtil.GetByNumberLines(BinaryFileUtil.GetByNameTest(binaryTree, Info), numberLines), (uint)orderBy, (uint)orderType);
                CheckData(students);
                foreach (Student student in students)
                {
                    outputConsole.Text += student.ToString() + "\n";
                }
                break;

            case 4:
                students = BinaryFileUtil.OrderStudents(BinaryFileUtil.GetByNumberLines(BinaryFileUtil.GetByDate(binaryTree, datePassTest), numberLines), (uint)orderBy, (uint)orderType);
                CheckData(students);
                foreach (Student student in students)
                {
                    outputConsole.Text += student.ToString() + "\n";
                }
                break;

            case 5:
                students = BinaryFileUtil.OrderStudents(BinaryFileUtil.GetByNumberLines(BinaryFileUtil.GetByRating(binaryTree, UInt16.Parse(Info)), numberLines), (uint)orderBy, (uint)orderType);
                CheckData(students);
                foreach (Student student in students)
                {
                    outputConsole.Text += student.ToString() + "\n";
                }
                break;
            }
        }