Changeset 2230
- Timestamp:
- 08/04/09 10:36:08 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.CEDMA.Core/3.3
- Files:
-
- 2 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Core/3.3/DataSetView.cs
r2131 r2230 73 73 } 74 74 75 private void PopulateViewComboBox() {76 DiscoveryService service = new DiscoveryService();77 IResultsViewFactory[] factories = service.GetInstances<IResultsViewFactory>();78 viewComboBox.DataSource = factories;79 viewComboBox.ValueMember = "Name";80 }81 75 82 76 private void activateButton_Click(object sender, EventArgs e) { … … 85 79 } 86 80 87 private void resultsButton_Click(object sender, EventArgs e) {88 if (results == null)89 ReloadResults();90 try {91 IResultsViewFactory factory = (IResultsViewFactory)viewComboBox.SelectedItem;92 BackgroundWorker worker = new BackgroundWorker();93 worker.WorkerReportsProgress = true;94 worker.WorkerSupportsCancellation = true;95 worker.ProgressChanged += delegate(object progressChangedSender, ProgressChangedEventArgs progressChangedArgs) {96 progressBar.Value = progressChangedArgs.ProgressPercentage;97 };98 worker.DoWork += delegate(object doWorkSender, DoWorkEventArgs doWorkArgs) {99 int n = results.GetEntries().Count();100 int i = 0;101 // preload list102 foreach (var entry in results.GetEntries()) {103 i++;104 if((((i*100) / n) % 10) == 0) worker.ReportProgress((i * 100) / n);105 }106 worker.ReportProgress(100);107 };108 resultsButton.Enabled = false;109 worker.RunWorkerAsync();110 worker.RunWorkerCompleted += delegate(object completedSender, RunWorkerCompletedEventArgs compledArgs) {111 resultsButton.Enabled = true;112 progressBar.Value = 0;113 IControl control = factory.CreateView(results);114 PluginManager.ControlManager.ShowControl(control);115 };116 }117 catch (Exception ex) {118 string text = "Couldn't load selected view: " + viewComboBox.SelectedItem + "\n" + ex.Message;119 MessageBox.Show(text, "Unable to create view", MessageBoxButtons.OK, MessageBoxIcon.Error);120 }121 }122 81 123 82 private void ReloadResults() {
Note: See TracChangeset
for help on using the changeset viewer.