Пример #1
0
 private void start_calc_Click(object sender, RoutedEventArgs e)
 {
     StatisticalCalculations calc = new StatisticalCalculations();
     calc.FiveMostUncommonNames(pipeline.citizensOfArmenia, PrintResult);
     calc.FiveMostCommonNames(pipeline.citizensOfArmenia, PrintResult);
     calc.TopThreeMonth(pipeline.citizensOfArmenia, PrintResult);
     calc.CalculateAverage(pipeline.citizensOfArmenia, PrintAverage);
 }
Пример #2
0
        private void test(string folder)
        {
            string[] files = Directory.GetFiles(folder, "*.xlsx", SearchOption.TopDirectoryOnly);
            var parseCitizenInfo = new TransformBlock<string, List<Citizen>>(
             (fileName) =>
             {
                 var referendumProcessor = new ReferendumProcessor();
                 var cit = referendumProcessor.ProcessFile(fileName);
                 return cit;
             }
             ,
             new ExecutionDataflowBlockOptions()
             {
                 MaxDegreeOfParallelism = Environment.ProcessorCount  
             }
             );
           
            foreach (string file in files)
            {
                parseCitizenInfo.Post(file);
            }

            parseCitizenInfo.Complete();

            StatisticalCalculations calc = new StatisticalCalculations();
            calc.FiveMostUncommonNames(parseCitizenInfo, PrintResult);
            calc.FiveMostCommonNames(parseCitizenInfo, PrintResult);
            calc.TopThreeMonth(parseCitizenInfo, PrintResult);
            calc.CalculateAverage(parseCitizenInfo, PrintAverage);
        }