private void btnView_Click(object sender, RoutedEventArgs e) { if (selectedClient != null) { btnView.IsEnabled = false; CaisseServiceClient Service = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse")); Service.RetourneListeFactureNonSoldeCompleted += (s, results) => { if (results.Cancelled || results.Error != null) { MessageBox.Show("error d'invocation du service"); btnView.IsEnabled = true; return; } if (results.Result == null) { MessageBox.Show("no data match for those criteria"); btnView.IsEnabled = true; return; } else { if (results.Result.Count > 0) { List <CsLclient> _lstFact = results.Result; //if (_rang == 2) //{ // if (this.comboBox1.SelectedItem.ToString() == "=") // _lstFact = _lstFact.Where(p => p.MONTANT == Convert.ToDecimal(this.txtreference.Text)).ToList(); // else if (this.comboBox1.SelectedItem.ToString() == ">=") // _lstFact = _lstFact.Where(p => p.MONTANT >= Convert.ToDecimal(this.txtreference.Text)).ToList(); // else if (this.comboBox1.SelectedItem.ToString() == "<=") // _lstFact = _lstFact.Where(p => p.MONTANT <= Convert.ToDecimal(this.txtreference.Text)).ToList(); //} _lstFact.ForEach(p => p.REFEMNDOC = p.REFEM + "-" + p.NDOC); _lstFact.ForEach(p => p.NOM = selectedClient.NOMABON); List <CsClient> clients = new List <CsClient>(); UcConsulClientAccount consult = new UcConsulClientAccount(_lstFact); consult.Closed += new EventHandler(UcConsulClientAccountClosed); consult.Show(); } else { Message.ShowInformation("Ce Client n'a pas de facture", "information"); } btnView.IsEnabled = true; } }; Service.RetourneListeFactureNonSoldeAsync(selectedClient); } else { MessageBox.Show("No Item selected in the Grid"); } //passage++; }