示例#1
0
        private static void _RunApp()
        {
            var ui = new Window1();

            var router = new ProcessRouter();
            var fileReadingServiceReader = new FileReadingService();
            var lineByLineFileReadingAgent = new LineByLineFileReadingAgentChannel(fileReadingServiceReader, router);
            var emailExtractionAgent = new ObviousEmailExtractionAgent(router, router);
            var vm = new EmailScraperVM();
            var user = new ThreadableVM(vm, ui.Dispatcher);

            router.SendLinesOfTextWithNoObviousEmailAddressTo(new DeadBadEmailChannel());
            router.SendGoodEmailAddressesTo(user);
            router.SendNonBlankLineOfTextTo(emailExtractionAgent);
            router.SendFilesToReadFromTo(lineByLineFileReadingAgent);

            ui.DataContext = vm;
            ui.Show();

            router.StartProcess(@"C:\Code\ConcurrencySamples\EmailScraper\Files\Sample1.txt");
        }
        public void Setup()
        {
            ProvidedFilePath = "filePath";
            MessageChannel = new ChannelForNonBlankTextLines();
            _fileReadingServiceReader = new FileReadingServiceReaderWithOneNonBlankLineAndMultipleWhitespaceLines();
            It = new LineByLineFileReadingAgentChannel(_fileReadingServiceReader, MessageChannel);

            It.OnNext(ProvidedFilePath);
        }