using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TP07Ex2_SalarieLangues
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            cbosalarie.Items.Add("GRILLET Kevin");
            cbosalarie.Items.Add("KERJEAN Marie");
            cbosalarie.Items.Add("MARTINS Loic");
            cbosalarie.Items.Add("VEGHAR Sofia");
            lstlangue.SelectionMode = SelectionMode.MultiSimple;
            lstlangue.Items.Add("Allemand");
            lstlangue.Items.Add("Anglais");
            lstlangue.Items.Add("Arabe");
            lstlangue.Items.Add("Chinois");
            lstlangue.Items.Add("Espagnol");
            lstlangue.Items.Add("Italien");
            lstlangue.Items.Add("Japonais");
            lstlangue.Items.Add("Portugais");
            lstlangue.Items.Add("Turc");
            lstselect.SelectionMode = SelectionMode.MultiSimple;
        }

        private void btnvalider_Click(object sender, EventArgs e)
        {
            int i;
            if (cbosalarie.SelectedIndex > -1)
            {
                lblafficher.Text = Convert.ToString(cbosalarie.SelectedItem);
                for (i = 0; i < lstlangue.Items.Count; i = i + 1)
                {
                    if (lstlangue.GetSelected(i) == true)
                    {
                        lblafficher.Text = lblafficher.Text + Convert.ToString(i) + Convert.ToString(lstlangue.Items[i]);
                    }
                }

            }
            else
            {
                lblafficher.Text = "Aucun salarié sélectionné";

            }

        }

        private void btnselect_Click(object sender, EventArgs e)
        {
            int i;
            
            for (i = 0; i < lstlangue.Items.Count; i = i + 1)
            {
                if (lstlangue.GetSelected(i) == true)
                {



                  lstselect.Items.Add(i);

                }
            }

        }

    }
}
