Changeset 8872 for trunk/sources
- Timestamp:
- 11/06/12 17:40:06 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/OptimizerListView.cs
r7259 r8872 51 51 try { 52 52 return (IOptimizer)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 53 } 54 catch (Exception ex) { 53 } catch (Exception ex) { 55 54 ErrorHandling.ShowErrorDialog(this, ex); 56 55 } … … 58 57 return null; 59 58 } 59 60 protected override void DeregisterItemEvents(IOptimizer item) { 61 var batchRun = item as BatchRun; 62 if (batchRun != null) { 63 batchRun.RepetitionsChanged -= BatchRun_UpdateText; 64 batchRun.RepetetionsCounterChanged -= BatchRun_UpdateText; 65 } 66 base.DeregisterItemEvents(item); 67 } 68 69 protected override void RegisterItemEvents(IOptimizer item) { 70 base.RegisterItemEvents(item); 71 var batchRun = item as BatchRun; 72 if (batchRun != null) { 73 batchRun.RepetitionsChanged += BatchRun_UpdateText; 74 batchRun.RepetetionsCounterChanged += BatchRun_UpdateText; 75 } 76 } 77 78 protected override ListViewItem CreateListViewItem(IOptimizer item) { 79 var listViewItem = base.CreateListViewItem(item); 80 var batchRun = item as BatchRun; 81 if (batchRun != null) { 82 listViewItem.Text += string.Format(" {0}/{1}", batchRun.RepetitionsCounter, batchRun.Repetitions); 83 } 84 return listViewItem; 85 } 86 87 protected override void UpdateListViewItemText(ListViewItem listViewItem) { 88 base.UpdateListViewItemText(listViewItem); 89 var batchRun = listViewItem.Tag as BatchRun; 90 if (batchRun != null) { 91 listViewItem.Text = batchRun.ToString() + string.Format(" {0}/{1}", batchRun.RepetitionsCounter, batchRun.Repetitions); 92 } 93 } 94 95 protected virtual void BatchRun_UpdateText(object sender, EventArgs eventArgs) { 96 if (sender is BatchRun) { 97 foreach (var item in GetListViewItemsForItem(sender as BatchRun)) 98 UpdateListViewItemText(item); 99 } 100 } 60 101 } 61 102 }
Note: See TracChangeset
for help on using the changeset viewer.