Exemple #1
0
        private void BtnDelete(object sender, RoutedEventArgs e)
        {
            using (var db = new DBEntity())
            {
                db.Dictionary.Remove(wordTranslate);
                db.SaveChanges();
            }

            WindowUpdate();
        }
Exemple #2
0
        private void BtnUpdate(object sender, RoutedEventArgs e)
        {
            wordTranslate.Word      = tbxWord.Text;
            wordTranslate.Translate = tbxTranslate.Text;

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

            WindowUpdate();
        }
Exemple #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();
        }
Exemple #4
0
        private void WindowUpdate()
        {
            btnUpdate.IsEnabled = false;
            btnDelete.IsEnabled = false;

            tbxWord.Text      = "";
            tbxTranslate.Text = "";

            using (var db = new DBEntity())
            {
                db.Dictionary.Load();
                dataGrid.ItemsSource = db.Dictionary.Local.ToObservableCollection();
            }

            CollectionViewSource.GetDefaultView(dataGrid.ItemsSource).Filter = ToFilter;
        }