Beispiel #1
0
 public TrainerService(DictionaryRepository dictionaryRepository,
                       LearnedWordsRepository learnedWordsRepository,
                       WordsOnLearningRepository wordsOnLearningRepository,
                       WordsHandler wordsHandler)
 {
     _dictionaryRepository      = dictionaryRepository;
     _learnedWordsRepository    = learnedWordsRepository;
     _wordsOnLearningRepository = wordsOnLearningRepository;
     _wordsHandler = wordsHandler;
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            int           count = 0, formatting = 0;
            List <string> inputData = new List <string>();
            WordsHandler  handler   = new WordsHandler(FindWord);

            handler += SelectioWord;
            while (count != 2)
            {
                var    str        = Console.ReadLine();
                string freeFormat = str;
                //проверка положения "==="
                if (freeFormat.Replace(" ", "") == "===" || freeFormat.Replace("\t", "") == "===")
                {
                    count++;
                    if (count == 2)
                    {
                        break;
                    }
                }
                inputData.Add(str);
            }
            SplitRows(inputData);
            Format(inputData);
            if (Content.Count() != 0 && Content != null)
            {
                if (Dict.Count() > 200)
                {
                    foreach (var wordContent in Content)
                    {
                        Thread wordSearchThread = new Thread(new ParameterizedThreadStart(handler));
                        threads.Add(wordSearchThread);
                        wordSearchThread.Start(wordContent);
                    }
                    Thread checkThread = new Thread(CheckThreads);
                    checkThread.Start();
                }
                else
                {
                    done = true;
                    foreach (var wordContent in Content)
                    {
                        FindWord(wordContent);
                    }
                    foreach (var wordContent in Content)
                    {
                        SelectioWord(wordContent);
                    }
                }
                while (true)
                {
                    if (done)
                    {
                        foreach (var wordContent in Content)
                        {
                            Console.Write(wordContent.value + " ");
                            formatting++;
                            if (format.Contains(formatting))
                            {
                                Console.WriteLine();
                            }
                        }
                        break;
                    }
                }
                Console.ReadKey();
            }
        }
        public void Setup()
        {
            m_HtmlAgilityPackWrapperMock = new Mock <IHtmlAgilityPackWrapper>();

            m_WordsHandler = new WordsHandler(m_HtmlAgilityPackWrapperMock.Object);
        }