using SlnMesnac.Repository.service;
using SlnMesnac.Repository;
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;
using static Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties.System;
using Microsoft.Extensions.DependencyInjection;
using Task = System.Threading.Tasks.Task;

namespace SlnMesnac.WPF.Page.IndexPage
{
    /// <summary>
    /// DetailTaskContent.xaml 的交互逻辑
    /// </summary>
    public partial class DetailTaskContent : Window
    {
        public Action<AirportTask> _Taskaction;
        private IAirportTaskService _taskservice;
        public AirportTask AirportTask;
        public DetailTaskContent()
        {
            InitializeComponent();
        }

        private async void LoadAreaTaskInfo()
        {
            try
            {
               List<AirportTask> Task =  _taskservice.GetTaskInfoListAsync(AirportTask.conveyorno).Result;

               this.AreaTaskDataGrid.ItemsSource = Task;
            }
            catch (Exception ex)
            {

            }
        }
        //在载入行的时候在行表头添加编号	
        private void dgvMH_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            e.Row.Header = (e.Row.GetIndex() + 1).ToString();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (AirportTask != null)
            {
                AreaTask.Text = AirportTask.conveyorno + "号站台任务列表";
            }
            _taskservice = App.ServiceProvider.GetService<IAirportTaskService>();
            LoadAreaTaskInfo();
        }
    }
}
