private void CellEditEnded(DataGridCellEditEndedEventArgs obj) { var normal = (obj.Row as FrameworkElement).DataContext as NormalAnimal; SQLiteService.AddUserFish(new UserFish { Name = normal.Name, Owned = normal.Owned, MuseumHave = normal.MuseumHave }); if (_beforeEditOwned == false && normal.Owned == true) { BookCount += 1; } if (_beforeEditOwned == true && normal.Owned == false) { BookCount -= 1; } if (_beforeEditMuseum == false && normal.MuseumHave == true) { MuseumCount += 1; } if (_beforeEditMuseum == true && normal.MuseumHave == false) { MuseumCount -= 1; } }
private async void RemoveOwnedButton_Click(object sender, RoutedEventArgs e) { if (_animal == Animal.Fish) { await SQLiteService.AddUserFish(new UserFish { Name = NormalAnimals.Name, Owned = false, MuseumHave = NormalAnimals.MuseumHave }); } else { await SQLiteService.AddUserInsect(new UserInsect { Name = NormalAnimals.Name, Owned = false, MuseumHave = NormalAnimals.MuseumHave }); } Owned = false; NormalAnimals.Owned = false; }
private void RemoveMuseumButton_Click(object sender, RoutedEventArgs e) { if (_animal == Animal.Fish) { SQLiteService.AddUserFish(new UserFish { Name = NormalAnimals.Name, Owned = NormalAnimals.Owned, MuseumHave = false }); } else { SQLiteService.AddUserInsect(new UserInsect { Name = NormalAnimals.Name, Owned = NormalAnimals.Owned, MuseumHave = false }); } Museum = false; NormalAnimals.MuseumHave = false; }