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 WpfAppProduct
{
    /// <summary>
    /// Логика взаимодействия для PageList.xaml
    /// </summary>
    public partial class PageList : Page
    {
        public PageList()
        {
            InitializeComponent();
            LvProduct.ItemsSource = DataBase.Base.Product.ToList();
        }

        private void BtnBasket_Click(object sender, RoutedEventArgs e)
        {
            WindowsBasket basket = new WindowsBasket();
            basket.ShowDialog();
        }

        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mi = (MenuItem)sender;
            string index = mi.Uid;
            Product product = DataBase.Base.Product.FirstOrDefault(x => x.ProductName == index);
            DataBase.pr.Add(product);
            BtnBasket.Visibility = Visibility.Visible;
        }
    }
}
