private void GetExternalSources() { try { Task task = new TaskFactory().StartNew(async() => { List <ExternalSource> response = await WcmHelpers.GetDocumentImporterExternalSourcesAsync(WcmSettings); _externalSourcesDictionary = response.ToDictionary(x => x.Id, x => x); }).ContinueWith((x) => { if (_externalSourcesDictionary != null) { foreach (var externalSource in _externalSourcesDictionary) { externalSource.Value.AlreadyViewedDocumentColor = ColorTranslator.FromHtml($"#{externalSource.Value.AlreadyViewedDocHexColor}"); externalSource.Value.NewDocumentColor = ColorTranslator.FromHtml($"#{externalSource.Value.NewDocumentHexColor}"); } } }); } catch (Exception e) { Macro.Alert($"Error: {e.ToString()}"); } }
public override void Login(object sender, EventArgs e) { _getDocumentMapsTask = new TaskFactory().StartNew(() => { _dataExtractionDocumentMaps = WcmHelpers.GetMapperDocuments(WcmConfig.DocumentMapperAiExternalSourceId, WcmConfig); }); }
private void ExternalSourcesComboBox_SelectedIndexChanged(object sender, EventArgs e) { var waitDialog = new PleaseWaitDialog(this); ExternalDocumentSource selectedSource = GetExternalSourceSelected(); waitDialog.Progress.Report($"Retrieving docs for '{selectedSource.SourceName}'..."); List <Document> docs = WcmHelpers.GetMapperDocuments(selectedSource.Id, WcmSettings); _mapperDocuments = docs; UpdateDocsGridview(docs); EnableControls(); waitDialog.PleaseWaitForm.Close(); }