public void ExportXML(List <int> taxonIds, XMLIOExportOptions options, IProgressObserver progress, Func <bool> isCancelledCallback) { try { if (progress != null) { progress.ProgressStart("Counting total taxa to export..."); } var exporter = new XMLIOExporter(User, taxonIds, options, progress, isCancelledCallback); exporter.Export(); } finally { if (progress != null) { progress.ProgressEnd("Export complete."); } } }
private void StartExport() { _isCancelled = false; // save the file off in prefs for later... Config.SetUser(User, "XMLIOExport.LastExportFile", txtFilename.Text); if (string.IsNullOrEmpty(txtFilename.Text)) { ErrorMessage.Show("You must select a destination file before you can continue"); return; } btnStart.IsEnabled = false; btnCancel.IsEnabled = true; var options = new XMLIOExportOptions { Filename = this.Filename, ExportChildTaxa = this.ExportChildTaxa, ExportMaterial = this.ExportMaterial, ExportTraits = this.ExportNotes, ExportMultimedia = this.ExportMultimedia, ExportNotes = this.ExportNotes, IncludeFullClassification = this.IncludeFullClassification, KeepLogFile = this.KeepLogFile }; var service = new XMLIOService(User); JobExecutor.QueueJob(() => { service.ExportXML(TaxonIDs, options, this, IsCancelled); this.InvokeIfRequired(() => { btnStart.IsEnabled = true; btnCancel.IsEnabled = false; }); }); }