private void CalculerFacture(List <CsLotri> ListLotSelect, bool IsSumulation, bool IsFacturationTotal) { prgBar.Visibility = System.Windows.Visibility.Visible; try { List <CsFactureBrut> _laStat = new List <CsFactureBrut>(); FacturationServiceClient service = new FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation")); service.CalculeDuLotGeneralCompleted += (s, args) => { this.DialogResult = false; if (args != null && args.Cancelled) { Message.Show(Langue.msgErrorFact, Langue.LibelleModule); prgBar.Visibility = System.Windows.Visibility.Collapsed; return; } if (args == null && args.Cancelled) { Message.Show(Langue.msgErrorFact, Langue.LibelleModule); prgBar.Visibility = System.Windows.Visibility.Collapsed; return; } _laStat = args.Result; UcResultatFacturation ctrl = new UcResultatFacturation(_laStat, IsSimulation); ctrl.Show(); prgBar.Visibility = System.Windows.Visibility.Collapsed; }; service.CalculeDuLotGeneralAsync(ListLotSelect, IsSumulation); service.CloseAsync(); } catch (Exception ex) { prgBar.Visibility = System.Windows.Visibility.Collapsed; throw ex; } }