Ejemplo n.º 1
0
        private async Task FindData()
        {
            if (topicMet.FindOrCreateTopic())
            {
                var key = userInteractor.QuestionAnswerKey("If you want to watch your cards, press 'Enter', if not - press else");
                if (key == UserAction.Enter)
                {
                    var flashcards = await fileMaster.ReadData(topicMet.PathTopic);

                    if (flashcards == null)
                    {
                        userInteractor.WriteLine("Don't have cards");
                    }
                    else
                    {
                        foreach (var flashcard in flashcards)
                        {
                            userInteractor.WriteLine($"{flashcard.Topic} - " +
                                                     $"{flashcard.FrontOrForeignTranslation} - " +
                                                     $"{flashcard.Transcription} - " +
                                                     $"{flashcard.BackOrOriginalWord}");
                        }
                    }
                }
            }
            await EnterData();
        }
Ejemplo n.º 2
0
        public async Task Run()
        {
            topicMet = new TopicMet(fileMaster, userInteractor);
            topicMet.FindTopics();
            while (true)
            {
                var key = userInteractor.QuestionAnswerKey("What do you want to do?\n\r" +
                                                           "If you want to add cards, press 'a'\n\r" +
                                                           "If you want to learn cards, press 'l'\n\r" +
                                                           "If you want to exit the application, press 'Esc'");
                switch (key)
                {
                case UserAction.A:
                    Input input = new Input(fileMaster, userInteractor, topicMet);
                    await input.Run();

                    break;

                case UserAction.L:
                    Study study = new Study(fileMaster, userInteractor, topicMet);
                    await study.Run();

                    break;

                case UserAction.Escape:
                    userInteractor.WriteLine("bye");
                    return;

                default:
                    userInteractor.WriteLine("Write else");
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        private void WriteCards()
        {
            var key = userInteractor.QuestionAnswerKey("If you want to watch your cards, press 'Enter', if not - press else");

            if (key == UserAction.Enter)
            {
                foreach (var flashcard in flashcards)
                {
                    userInteractor.WriteLine($"{flashcard.Topic} - " +
                                             $"{flashcard.FrontOrForeignTranslation} - " +
                                             $"{flashcard.Transcription} - " +
                                             $"{flashcard.BackOrOriginalWord}");
                }
            }
        }
Ejemplo n.º 4
0
 public void FindTopics()
 {
     userInteractor.WriteLine("All topics you have:");
     topics = fileMaster.GetDirectoriesName(PathAllTopics);
 }