- Timestamp:
- 03/18/16 16:15:10 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Common/3.3/ExpertSystem.cs
r13713 r13718 251 251 // It has to be decided somehow which problem instances to include in order to obtain the set of features that is expressive and available 252 252 var allCharacteristics = ProblemInstances.Select(x => new HashSet<string>(x.Results.Where(y => y.Key.StartsWith("Characteristic.", StringComparison.Ordinal)).Select(y => y.Key))).ToList(); 253 if (allCharacteristics.Count == 0) return; 254 253 255 var commonCharacteristics = filter.Count > 0 ? filter : allCharacteristics[0]; 254 256 for (var i = 0; i < allCharacteristics.Count; i++) … … 446 448 } 447 449 448 public async void UpdateKnowledgeBaseAsync(IProgress progress) { 450 public Task UpdateKnowledgeBaseAsync(IProgress progress = null) { 451 if (progress == null) progress = new Progress(string.Empty); 449 452 progress.Start("Updating Knowledge Base from OKB"); 450 await Task.Factory.StartNew(() => { DoUpdateKnowledgeBase(progress); }, TaskCreationOptions.LongRunning); 451 } 452 453 public void UpdateKnowledgeBase() { 454 DoUpdateKnowledgeBase(new Progress(string.Empty, ProgressState.Started)); 453 OnDownloadStarted(progress); 454 return Task.Factory.StartNew(() => { DoUpdateKnowledgeBase(progress); }, TaskCreationOptions.LongRunning); 455 } 456 457 public void UpdateKnowledgeBase(IProgress progress = null) { 458 UpdateKnowledgeBaseAsync(progress).Wait(); 455 459 } 456 460 … … 632 636 if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); 633 637 } 638 639 public event EventHandler<EventArgs<IProgress>> DownloadStarted; 640 private void OnDownloadStarted(IProgress progress) { 641 var handler = DownloadStarted; 642 if (handler != null) handler(this, new EventArgs<IProgress>(progress)); 643 } 634 644 } 635 645 }
Note: See TracChangeset
for help on using the changeset viewer.