Exemplo n.º 1
0
        private bool ToFilter(object row)
        {
            wordTranslate = (WordTranslate)row;

            return(wordTranslate.Word.StartsWith(tbxSearch.Text, StringComparison.OrdinalIgnoreCase) ||
                   wordTranslate.Translate.StartsWith(tbxSearch.Text, StringComparison.OrdinalIgnoreCase));
        }
Exemplo n.º 2
0
        private void DataGridSelectionChanged(object sender, RoutedEventArgs e)
        {
            wordTranslate = (WordTranslate)dataGrid.SelectedItem;

            if (wordTranslate == null)
            {
                return;
            }

            btnUpdate.IsEnabled = true;
            btnDelete.IsEnabled = true;

            tbxWord.Text      = wordTranslate.Word;
            tbxTranslate.Text = wordTranslate.Translate;
        }
Exemplo n.º 3
0
        private void BtnAdd(object sender, RoutedEventArgs e)
        {
            var wordTranslate = new WordTranslate()
            {
                Word      = tbxWord.Text,
                Translate = tbxTranslate.Text
            };

            using (var db = new DBEntity())
            {
                db.Dictionary.Add(wordTranslate);
                db.SaveChanges();
            }

            WindowUpdate();
        }