public List <ServiceReport.CsConnexion> GetPrintObjects(string module) { try { int loaderHandler = LoadingManager.BeginLoading("Please Wait for pass payment ... "); ReportServiceClient service = new ReportServiceClient(Utility.Protocole(), Utility.EndPoint(module)); string mois = (Cmb_month.SelectedIndex < 0) ? null : (Cmb_month.SelectedIndex + 1).ToString("00"); List <ServiceReport.CsConnexion> reportPrint = new List <CsConnexion>(); service.ObtenirConnexionsElectricityAsync(Txt_year.Text, mois, null); service.ObtenirConnexionsElectricityCompleted += (er, res) => { try { if (res.Error != null || res.Cancelled) { LoadingManager.EndLoading(loaderHandler); throw new Exception("Cannot display report"); } if (res.Result != null) { reportPrint = res.Result; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { LoadingManager.EndLoading(loaderHandler); } }; return(reportPrint); } catch (Exception ex) { throw ex; } }