Esempio n. 1
0
 static void SingleThread()
 {
     using (StreamWriter sw = new StreamWriter(file1)) {
         PersonProvider provider = new PersonProvider();
         Person[]       persons  = provider.GetPersons(1, portionSize);
         while (persons.Length > 0)
         {
             for (int i = 0; i < persons.Length; i++)
             {
                 sw.WriteLine(persons[i]);
             }
             Person lastP = persons[persons.Length - 1];
             persons = provider.GetPersons(lastP.Id + 1, portionSize);
         }
     }
 }
Esempio n. 2
0
        static void GetPersons()
        {
            PersonProvider provider = new PersonProvider();

            Person[] persons = provider.GetPersons(1, portionSize);
            while (persons.Length > 0)
            {
                lock (_lockObject) {
                    if (_pQueue.Count < _maxQueueSize)
                    {
                        _pQueue.Enqueue(persons);
                        Person lastP = persons[persons.Length - 1];
                        persons = provider.GetPersons(lastP.Id + 1, portionSize);
                    }
                }
            }
            lock (_lockObject) {
                _personsReadEnded = true;
            }
        }
Esempio n. 3
0
        private static void RunPersonsDemo(AppView view)
        {
            var persons = PersonProvider.GetPersons();

            view.Show(persons);
        }