/// <summary>
        /// Actions au chargement de la fenetre
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void IhmServices_Load(object sender, EventArgs e)
        {
            ReloadListe();
            this.ModeEnCours = ModesEcran.Consultation;

            /* //Code redondant avec les lb_selected value(index)_change()
             * Service serviceSelectionne = (Service)this.lbService.SelectedItem;
             * this.tbCode.Text = serviceSelectionne.Code;
             * this.tbLibelle.Text = serviceSelectionne.Libelle;
             */
        }
        /// <summary>
        /// Action bouton "Supprimer"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btSupprimer_Click(object sender, EventArgs e)
        {
            switch (this.ModeEnCours)
            {
            case ModesEcran.Vide:
                break;

            case ModesEcran.Consultation:
                try
                {
                    MgrService.getInstance().SupprimerService((Service)this.lbService.SelectedItem);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                this.ClearTB();
                this.ReloadListe();
                this.modeEnCours = ModesEcran.Consultation;
                //TODO - factoriser dans le setter de modeEnCours
                if (MgrService.getInstance().Serviceslist.Count == 0)
                {
                    this.ModeEnCours = ModesEcran.Vide;
                }
                else
                {
                    this.ModeEnCours = ModesEcran.Consultation;
                }

                break;

            case ModesEcran.Ajout:
                break;

            case ModesEcran.Modification:
                break;

            default:
                break;
            }
        }
        /// <summary>
        /// Actions bouton "Annuler"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btAnnuler_Click(object sender, EventArgs e)
        {
            switch (this.ModeEnCours)
            {
            case ModesEcran.Vide:
                break;

            case ModesEcran.Consultation:
                break;

            case ModesEcran.Ajout:
                /* //Code deplacer dans la methode reloadListe()
                 * this.errorProvider.SetError(tbCode, string.Empty);
                 * this.errorProvider.SetError(tbLibelle, string.Empty);
                 */
                if (MgrService.getInstance().Serviceslist.Count == 0)
                {
                    this.ModeEnCours = ModesEcran.Vide;
                }
                else
                {
                    ReloadListe();
                    this.tbLibelle.Modified = false;
                    this.ModeEnCours        = ModesEcran.Consultation;
                }
                break;

            case ModesEcran.Modification:
                // code factorisé dans reloadListe => apparition icone erreur brièvement
                //this.errorProvider.SetError(tbCode, string.Empty);
                //this.errorProvider.SetError(tbLibelle, string.Empty);
                ReloadListe();
                this.tbLibelle.Modified = false;
                this.ModeEnCours        = ModesEcran.Consultation;
                break;

            default:
                break;
            }
        }
        private void tbLibelle_ModifiedChanged(object sender, EventArgs e)
        {
            switch (ModeEnCours)
            {
            case ModesEcran.Vide:
                break;

            case ModesEcran.Consultation:

                this.ModeEnCours = ModesEcran.Modification;
                break;

            case ModesEcran.Ajout:
                break;

            case ModesEcran.Modification:
                break;

            default:
                break;
            }
        }
        /// <summary>
        /// Actions bouton Valider
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btValider_Click(object sender, EventArgs e)
        {
            switch (ModeEnCours)
            {
            case ModesEcran.Vide:
                break;

            case ModesEcran.Consultation:
                break;

            case ModesEcran.Ajout:
                this.ValidateChildren();
                if (this.errorProvider.GetError(tbCode) != string.Empty)
                {
                    this.errorProvider.SetError(tbCode, this.errorProvider.GetError(tbCode));
                }
                else if (this.errorProvider.GetError(tbLibelle) != string.Empty)
                {
                    this.errorProvider.SetError(tbLibelle, this.errorProvider.GetError(tbLibelle));
                }
                else
                {
                    Service nouveauService = null;
                    try
                    {
                        MgrService.getInstance().AjouterService(tbCode.Text, tbLibelle.Text);
                        nouveauService = MgrService.getInstance().ObtenirService(tbCode.Text);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    ClearTB();
                    ReloadListe();
                    this.lbService.SelectedItem = nouveauService;
                    this.tbLibelle.Modified     = false;
                    this.ModeEnCours            = ModesEcran.Consultation;
                }
                break;

            case ModesEcran.Modification:
                this.ValidateChildren(ValidationConstraints.Enabled);
                if (this.errorProvider.GetError(tbLibelle) != string.Empty)
                {
                    //MessageBox.Show(this.errorProvider.GetError(tbLibelle), "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    try
                    {
                        MgrService.getInstance().ModifierService((Service)this.lbService.SelectedItem,
                                                                 this.tbLibelle.Text);
                    }
                    catch (ApplicationException ae)
                    {
                        //TODO handle error more cleanly
                        Console.WriteLine(ae.Message);;
                    }
                    ClearTB();
                    ReloadListe();
                    this.tbLibelle.Modified = false;
                    this.ModeEnCours        = ModesEcran.Consultation;
                }
                break;

            default:
                break;
            }
        }
 /// <summary>
 /// Actions bouton "Ajouter"
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btAjouter_Click(object sender, EventArgs e)
 {
     this.ModeEnCours = ModesEcran.Ajout;
 }