Exemplo n.º 1
0
        public void AddNewWordsList(List <WordInformation> words)
        {
            Words.Clear();
            CurrentSelectedIndex = NO_INDEX;
            var romajiWords = ConvertPronunicationToRomaji(words);

            for (int i = 0; i < words.Count; i++)
            {
                WordInformationModel word = GetWordInformationModel(words[i], romajiWords[i], i);
                Words.Add(word);
            }
        }
Exemplo n.º 2
0
        private WordInformationModel GetWordInformationModel(WordInformation wordInfor, string romajiWords, int index)
        {
            string baseForm;
            string reading;
            string pronunciation;
            string conjugation;
            bool   isChecked     = false;
            bool   isInDicionary = false;

            if (wordInfor.IsSymbol() || String.IsNullOrWhiteSpace(wordInfor.Surface))
            {
                reading       = null;
                pronunciation = null;
                baseForm      = null;
                conjugation   = null;
                isChecked     = false;
                isInDicionary = false;
            }
            else
            {
                reading       = wordInfor.Reading;
                pronunciation = romajiWords;
                isInDicionary = wordInfor.IsInDictionary;
                baseForm      = wordInfor.BaseForm;

                var wrodConjugation = wordInfor.Conjugation;
                if (WordInformation.IsHave(wrodConjugation))
                {
                    conjugation = wrodConjugation;
                }
                else
                {
                    conjugation = null;
                }

                if (CurrentSelectedIndex == NO_INDEX && isInDicionary)
                {
                    CurrentSelectedIndex = index;
                    isChecked            = true;
                }
            }

            SolidColorBrush borderColor = GetBorderColor(wordInfor);
            var             word        = new WordInformationModel(wordInfor.Surface, conjugation, baseForm, reading, pronunciation, isInDicionary, isChecked, borderColor);

            word.Index = index;
            return(word);
        }