private void RemplirDepartHTA() { try { if (_listeDesDepartHTAInitiale != null && _listeDesDepartHTAInitiale.Count != 0) { Cbo_Depart.ItemsSource = _listeDesDepartHTAInitiale.OrderBy(t => t.LIBELLE).ToList(); Cbo_Depart.IsEnabled = true; Cbo_Depart.SelectedValuePath = "PK_ID"; Cbo_Depart.DisplayMemberPath = "LIBELLE"; return; } Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient service = new Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Accueil")); service.ChargerDepartHTAAsync(); service.ChargerDepartHTACompleted += (s, args) => { if (args.Error != null && args.Cancelled) { return; } _listeDesDepartHTAInitiale.Clear(); List <CsCodeDepart> _listeDesPostesExistant = new List <CsCodeDepart>(); CsCodeDepart st = null; foreach (var item in args.Result) { st = new CsCodeDepart(); st.PK_ID = item.PK_ID; st.CODE = item.CODE; st.LIBELLE = item.LIBELLE; _listeDesPostesExistant = _listeDesDepartHTAInitiale.Where(t => t.LIBELLE == st.LIBELLE).ToList(); if (_listeDesPostesExistant == null || _listeDesPostesExistant.Count == 0) { _listeDesDepartHTAInitiale.Add(st); } } Cbo_Depart.ItemsSource = _listeDesDepartHTAInitiale.OrderBy(t => t.LIBELLE).ToList(); Cbo_Depart.IsEnabled = true; Cbo_Depart.SelectedValuePath = "PK_ID"; Cbo_Depart.DisplayMemberPath = "LIBELLE"; if (ObjetSelectionnee != null && ObjetSelectionnee.FK_IDDEPARTHTA > 0) { Cbo_Depart.SelectedItem = _listeDesDepartHTAInitiale.FirstOrDefault(t => t.PK_ID == ObjetSelectionnee.FK_IDDEPARTHTA); } }; service.CloseAsync(); } catch (Exception ex) { throw ex; } }