using System;
using System.Collections.Generic;
using System.ComponentModel;
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 OliviaAddInPro
{
    /// <summary>
    /// Lógica de interacción para MarchandoUnaDe.xaml
    /// </summary>
    public partial class MarchandoUnaDe : Window
    {
        public MarchandoUnaDe()
        {
            InitializeComponent();
            DataContext = new MarchandoUnaDeViewModel();
            //WindowStyle = WindowStyle.None;
        }

        public MarchandoUnaDeViewModel  GetViewModel()
        {
            if (DataContext is MarchandoUnaDeViewModel m)
                return m;
            return null;
        }

        protected override void OnClosing(CancelEventArgs e) 
        {
            GetViewModel().Cancelado = true;
            base.OnClosing(e); 
            e.Cancel = true;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            GetViewModel().CancelaOperacion();
        }
    }
}
