protected override async void OnLoad(EventArgs e) { base.OnLoad(e); this.Cursor = Cursors.WaitCursor; try { _docTypes = await DokuFlexService.GetDocumentaryTypesAsync(_ticket); cbxDocumentaryTypes.DataSource = new BindingList <Documentary>(_docTypes); if (!String.IsNullOrWhiteSpace(_fileId)) { var docMetadata = await DokuFlexService.GetDocumentMetadadaAsync(_ticket, _fileId); var targetDocType = _docTypes.FirstOrDefault(d => d.id.Equals(docMetadata.docType)); if (targetDocType == null) { return; } targetDocType.elements.Clear(); targetDocType.elements.AddRange(docMetadata.elements); cbxDocumentaryTypes.SelectedValue = docMetadata.docType; } } finally { this.Cursor = Cursors.Default; } }
private async void listView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { if (e.IsSelected) { _currentListViewItem = e.Item; var history = e.Item.Tag as ScanHistory; if (String.IsNullOrWhiteSpace(history.path)) { history.path = String.Format("{0}\\{1}", _downloadDir, history.name); ShowProcessingPane(); this.Cursor = Cursors.WaitCursor; try { var docMetadata = await DokuFlexService.GetDocumentMetadadaAsync(_ticket, history.id); metadataControl.BindMetadata(docMetadata.elements); await DokuFlexService.DownloadAsync(_ticket, history.id, history.path); } finally { HideProcessingPane(); this.Cursor = Cursors.Default; } } webBrowser.Navigate(history.path); //ShowPreviewNoSupportedPane(history.path); } else { _currentListViewItem = null; } }