public async Task LoadInformation(string inputPdf) { _inputPdf = inputPdf; _pdfReader = new PdfReader(inputPdf); this.Cursor = Cursors.WaitCursor; Task <string> theTask = Session.GetTikectAsync(); try { _ticket = await theTask; var certificates = await DokuFlexService.ListCertificatesAsync(_ticket); certificateList.DataSource = new BindingList <Certificate>(certificates); } catch (Exception ex) { DokuFlex.Windows.Common.Log.LogFactory.CreateLog().LogError(ex); MessageBox.Show(string.Format("{0}\n\n{1}", ErrorMessages.ApplicationError, ex.Message), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Default; } }
//protected override void OnLoad(EventArgs e) //{ // base.OnLoad(e); // DisplayScanners(); // DisplayFileTypes(); // this.Cursor = Cursors.WaitCursor; // try // { // var documentaryList = new List<Documentary>() // { // new Documentary(){id = Guid.NewGuid().ToString("N"), name = "Prueba 1", homologation = 1}, // new Documentary(){id = Guid.NewGuid().ToString("N"), name = "Prueba 2", homologation = 0} // }; // var certificateList = new List<Certificate>() // { // new Certificate(){id = Guid.NewGuid().ToString("N"), text = "Certificado 1"}, // new Certificate(){id = Guid.NewGuid().ToString("N"), text = "Certificado 2"}, // }; // cbxDocumentaryTypes.DataSource = new BindingList<Documentary>(documentaryList); // cbxCertificates.DataSource = new BindingList<Certificate>(certificateList); // } // catch (Exception ex) // { // MessageBox.Show(string.Format("{0}\n\n{1}", ErrorMessages.AsyncTaskError, ex.Message), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); // } // finally // { // this.Cursor = Cursors.Default; // } // bindingSource.ResetBindings(true); //} protected override async void OnLoad(EventArgs e) { base.OnLoad(e); DisplayScanners(); DisplayFileTypes(); this.Cursor = Cursors.WaitCursor; Task <string> theTask = Session.GetTikectAsync(); try { _ticket = await theTask; if (String.IsNullOrWhiteSpace(_ticket)) { this.Close(); return; } var documentaryList = await DokuFlexService.GetDocumentaryTypesAsync(_ticket); var certificateList = await DokuFlexService.ListCertificatesAsync(_ticket); cbxDocumentaryTypes.DataSource = new BindingList <Documentary>(documentaryList); cbxCertificates.DataSource = new BindingList <Certificate>(certificateList); } catch (Exception ex) { MessageBox.Show(string.Format("{0}\n\n{1}", ErrorMessages.AsyncTaskError, ex.Message), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.Cursor = Cursors.Default; } bindingSource.ResetBindings(true); }