using Books_Shop_Kopey.VM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Books_Shop_Kopey.Pages
{
    /// <summary>
    /// Логика взаимодействия для Shop.xaml
    /// </summary>
    public partial class Shop : Page
    {
        ViewModel VM;

        public Shop(ViewModel vm)
        {
            InitializeComponent();
            VM = vm;
            DataContext = VM;

        }

        private void Page_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (Visibility == Visibility.Visible)
            {
                ViewModel.Sushnosti.ChangeTracker.Entries().ToList().ForEach(p => p.Reload());
                list.ItemsSource = ViewModel.Sushnosti.Shop.ToList();
            }
        }

        private void Dob_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("Не реализованно");

        }
    }
}
