private void AddNewWord() { NewWordText = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(NewWordText.ToLower()); IWord word = _dao.CreateNewWord(); word.Text = NewWordText; word.Language = SelectedDictionary.Language; SelectedDictionary.Words.Add(word); SelectedDictionaryWords.Add(word); SavedMessage = ""; SelectedWord = word; }
private bool CanAddNewWord() { if (SelectedDictionary == null || SelectedDictionaryWords == null) { return(false); } if (String.IsNullOrEmpty(NewWordText)) { return(false); } if (SelectedDictionary.Words.Any(x => x.Text.Equals(NewWordText, StringComparison.OrdinalIgnoreCase))) { return(false); } if (NewWordText.Any(x => !Char.IsLetter(x))) { return(false); } return(true); }