Esempio n. 1
0
        private void BtnSplitByDifficulty_Click(object sender, EventArgs e)
        {
            if (CurrentBook != null && CurrentBook.WordCardList.Count > 0)
            {
                _fileManager.SaveJsonToFile(Constants.Book.BookPath + CurrentBook.BookName, CurrentBook.WordCardJsonString);
            }
            _fileManager.MergeWordToAll();
            _difficultyBookSplit.SplitWordToBooks();

            lblSplit.Text    = Constants.BuildArrangeText(Constants.FormText.TaskCompleteText);
            lblSplit.Visible = true;

            if (File.Exists(Constants.Book.BookPath + CurrentBook.BookName))
            {
                CurrentBook.WordCardList = _fileManager.GetWordList(Constants.Book.BookPath + CurrentBook.BookName);
            }
            else
            {
                var files = _fileManager.GetFiles();
                CurrentBook.BookName     = files.Length > 0 ? files[0] : string.Empty;
                CurrentBook.WordCardList = string.IsNullOrEmpty(CurrentBook.BookName)
                    ? new List <NewWords.Core.Model.WordCard>()
                    : _fileManager.GetWordList(Constants.Book.BookPath + files[0]);
            }
            LoadNewBookToCardEvent?.Invoke(new TabTransferDataModel(CurrentBook, 0, "SplitBooks"), null);
        }
Esempio n. 2
0
        private void BtnSplitByDifficulty_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(_currentBook) && _words.Count > 0)
            {
                _fileManager.SaveJsonToFile(Constants.Book.BookPath + _currentBook, _words.ToJsonString());
            }
            _fileManager.MergeWordToAll();
            _difficultyBookSplit.SplitWordToBooks();

            lblSplityByDifficulty.Text    = Constants.BuildArrangeText(Constants.FormText.TaskCompleteText);
            lblSplityByDifficulty.Visible = true;

            if (File.Exists(Constants.Book.BookPath + _currentBook))
            {
                _words = _fileManager.GetWordList(Constants.Book.BookPath + _currentBook);
            }
            else
            {
                var files = _fileManager.GetFiles();
                _currentBook = files.Length > 0 ? files[0] : string.Empty;
                _words       = string.IsNullOrEmpty(_currentBook)
                    ? new List <NewWords.Core.Model.WordCard>()
                    : _fileManager.GetWordList(Constants.Book.BookPath + files[0]);
            }
            CardBeginning();
        }