Пример #1
0
        private void _selectPhraseByPosition(string position)
        {
            bool isNumber = int.TryParse(position, out int i);

            if (isNumber)
            {
                if (i >= 0 && i <= 9)
                {
                    if (ShowPhrasesList)
                    {
                        ViewModelPhrase selected = (from c in Phrases
                                                    from p in c
                                                    where p.Position == i
                                                    select p).FirstOrDefault();
                        if (selected != null)
                        {
                            PhraseSelected(selected);
                        }
                    }
                    else if (ShowSortedPhrasesList)
                    {
                        ViewModelPhrase selected = SortedPhrases.FirstOrDefault(p => p.Position == i);
                        if (selected != null)
                        {
                            PhraseSelected(selected);
                        }
                    }
                }
            }
        }
Пример #2
0
        private void _phraseSelected(ViewModelPhrase phrase)
        {
            if (_settings.FilterPhrases && Filtered)
            {
                if (!string.IsNullOrWhiteSpace(_lastSentence) &&
                    phrase.Name.Contains(_lastSentence))
                {
                    _replaceLastSentence(phrase.Name);
                }
                else
                {
                    if (phrase.Name.Contains(_lastWord))
                    {
                        _replaceLastWord(phrase.Name);
                    }
                }
            }
            else
            {
                _insert(phrase.Name);
            }

            if (_settings.SpeakPhrases)
            {
                //TODO: speak the phrase
            }
        }
Пример #3
0
 public void PhraseSelected(ViewModelPhrase selectedPhrase)
 {
     if (!SelectionMode)
     {
         if (selectedPhrase != null)
         {
             _viewModelMessage.PhraseSelected(selectedPhrase);
             _categories.PhraseSelected(selectedPhrase);
             _phraseSelected = true;
         }
     }
 }
Пример #4
0
 private ViewModelCategory _findCategoryForPhrase(ViewModelPhrase phrase)
 {
     return(_viewModelCategoryList.First(c => c.Phrases.Any(p => p == phrase)));
 }
Пример #5
0
 public void PhraseSelected(ViewModelPhrase selected)
 {
     selected.Frequency = selected.Frequency + 1;
     selected.Recent    = DateTime.Now;
     _categories.Save(_success);
 }
Пример #6
0
 public void PhraseSelected(ViewModelPhrase phrase)
 {
     _phraseSelected(phrase);
 }