using DemoExam.windows;
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 DemoExam.pages.agents
{
    /// <summary>
    /// Логика взаимодействия для PageAgents.xaml
    /// </summary>
    public partial class PageAgents : Page
    {
        ViewModel.ViewModel agentsViewModel = new ViewModel.ViewModel();
        public PageAgents()
        {
            InitializeComponent();
            DataContext = agentsViewModel;

        }



        private void lstAgents_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            List<object> listAgents = new List<object>();
            foreach (var item in lstAgents.SelectedItems)
            {
                listAgents.Add(item);
            }
            agentsViewModel.SetSelectedAgents(listAgents);
        }

        private void Button_ChangePriority_Click(object sender, RoutedEventArgs e)
        {
            var WindowChangePri = new WindowChangePriority(agentsViewModel);
            WindowChangePri.ShowDialog();
        }

        private void lstAgents_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var windowEditAgent = new WindowEditAgent(agentsViewModel);
            windowEditAgent.ShowDialog();
        }

        private void Button_AddAgent_Click(object sender, RoutedEventArgs e)
        {
            agentsViewModel.SelectedAgent = new Model.Agent();
            //agentsViewModel.DataBase.Agent.Add(agentsViewModel.SelectedAgent);
            var windowEditAgent = new WindowEditAgent(agentsViewModel);
            windowEditAgent.Title = "Добавление пользователя";
            windowEditAgent.ShowDialog();
        }
    }
}
