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.Shapes;

namespace WPF_LibrosFamosos
{
    /// <summary>
    /// Lógica de interacción para vtnAgregarLibro.xaml
    /// </summary>
    public partial class vtnAgregarLibro : Window
    {
        public vtnAgregarLibro(CatalogoLibros c)
        {
            InitializeComponent();
            cmbAutores.ItemsSource = c.Autores;
            cmbAutores.DisplayMemberPath = "Nombre";
        }

        private void btnAgregarLibro_Click(object sender, RoutedEventArgs e)
        {
            libros l = this.DataContext as libros;
            l.Autor = (cmbAutores.SelectedItem as autores).IdAutor;
            this.DialogResult = true;
            this.Close();
        }

        private void btnCancelar_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
            this.Close();
        }
    }
}
