Books.xaml.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using Books_Shop_Kopey.VM;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. namespace Books_Shop_Kopey.Pages
  17. {
  18. /// <summary>
  19. /// Логика взаимодействия для Books.xaml
  20. /// </summary>
  21. public partial class Books : Page
  22. {
  23. ViewModel VM;
  24. public Books(ViewModel vm)
  25. {
  26. InitializeComponent();
  27. VM = vm;
  28. DataContext = VM;
  29. }
  30. private void Page_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
  31. {
  32. if (Visibility == Visibility.Visible)
  33. {
  34. ViewModel.Sushnosti.ChangeTracker.Entries().ToList().ForEach(p => p.Reload());
  35. list.ItemsSource = ViewModel.Sushnosti.Books.ToList();
  36. }
  37. }
  38. private void DobvKorz_Click(object sender, RoutedEventArgs e)
  39. {
  40. MessageBox.Show("Не реализованно");
  41. }
  42. //private void Dob_Click(object sender, RoutedEventArgs e)
  43. //{
  44. // NavigationService.Navigate(new Uri("/Pages/BooksAdd.xaml", UriKind.Relative));
  45. //}
  46. }
  47. }