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 DemoExam.windows
{
    /// <summary>
    /// Логика взаимодействия для WindowChangePriority.xaml
    /// </summary>
    public partial class WindowChangePriority : Window
    {
        ViewModel.ViewModel VM;
        public WindowChangePriority(ViewModel.ViewModel VM)
        {
            InitializeComponent();
            this.VM = VM;
            DataContext = VM;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            VM.SetPriority(VM.GetMaxPriority);
            VM.DataBase.SaveChanges();
            MessageBox.Show("Изменения успешно сохранены!");
            VM.GetMaxPriority = -1;
            this.Close();
        }


        private void Window_Closed(object sender, EventArgs e)
        {
            VM.GetMaxPriority = -1;
        }
    }
}
