using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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 InterfaceSample
{
    /// <summary>
    /// AllEmpForm.xaml 的交互逻辑
    /// </summary>
    public partial class AllEmpForm : Window
    {
        //TODO: 4.声明IEmployees类型数据域
        private IEmployees _employees;

        //TODO: 5.建立接收IEmployees对象的GetEmployees方法
        public void GetEmployees(IEmployees employees)
        {
            _employees = employees;
        }

        public AllEmpForm()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (_employees != null)
            {
                //TODO: 6.使用foreach循环将IEmployees对象中成员加入ListBox
                listBox1.Items.Clear();
                foreach (Employee emp in _employees)
                {
                    listBox1.Items.Add(emp);
                }
            }
        }
    }
}

