using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Microsoft.EntityFrameworkCore;
using System.Linq;

namespace demo0411;

public partial class ProductList : Window
{
    private int log;
    public ProductList()
    {
        InitializeComponent();
        ListPartnerProduct.ItemsSource = Helper.DbContext.Products.Include(a => a.Type).Include(a => a.PartnerProducts).ThenInclude(a => a.Partner).ToList();
    }
    private void Button_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
    {
        new DobavRedactProduct().Show();
        Close();
    }

    private void Border_DoubleTapped(object? sender, Avalonia.Input.TappedEventArgs e)
    {
        new DobavRedactProduct(int.Parse((sender as Border).Tag.ToString())).Show();
        Close();
    }

    private void Button_Click_1(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
    {
        log = 2;
        new History(log).Show();
        Close();
    }

    private void Button_Click_2(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
    {
        new MainWindow().Show();
        Close();
    }
}