Ejemplo n.º 1
0
        public static void HandleNewGrades()
        {
            try
            {
                // Wait until it is safe to enter.
                mut2.WaitOne();

                while (NotesList.Count() != 0)
                {
                    // Add new grades to the average as a string
                    AddNewGrades(NotesList.Last());

                    // Remove the grades add from waiting list
                    NotesList = NotesList.FindAll(notes => notes != NotesList.Last());
                }

                // Print the 'MoyennesElevesMatieres' list items
                foreach (var eleve in MoyennesElevesMatieres)
                {
                    Console.WriteLine("\nL'eleve {0}à :", eleve.nomEleve);

                    foreach (var matiere in eleve.listMoyenneMatiere)
                    {
                        Console.Write("{0:N2} de moyenne en{1} avec les notes: ", matiere.moyenne, matiere.matiere);
                        for (int i = 0; i < matiere.notes.Count; i++)
                        {
                            float note = matiere.notes[i];
                            Console.Write("{0} ", note);
                        }
                        Console.WriteLine();
                    }
                }

                // Console.WriteLine("\nAVERAGE CALCULATED");
                // Thread.Sleep(1000);

                // Release the Mutex.
                mut2.ReleaseMutex();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }