Changeset 7805 for branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Views/3.4/ProblemInstanceConsumerView.cs
- Timestamp:
- 05/14/12 15:21:28 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Views/3.4/ProblemInstanceConsumerView.cs
r7770 r7805 40 40 } 41 41 42 private IProblemInstanceProvider SelectedProvider { 43 get { return (problemInstanceProviderComboBox.SelectedIndex >= 0 ? (IProblemInstanceProvider)problemInstanceProviderComboBox.SelectedItem : null); } 42 public IProblemInstanceProvider SelectedProvider { 43 get; 44 private set; 45 } 46 47 public IEnumerable<IProblemInstanceProvider> ProblemInstanceProviders { 48 get; 49 private set; 44 50 } 45 51 … … 53 59 base.OnContentChanged(); 54 60 if (Content == null) { 61 ProblemInstanceProviders = null; 55 62 problemInstanceProviderComboBox.DataSource = null; 56 63 } else { 57 64 problemInstanceProviderComboBox.DisplayMember = "Name"; 58 problemInstanceProviderComboBox.DataSource = GetProblemInstanceProviders().OrderBy(x => x.Name).ToList(); 65 ProblemInstanceProviders = GetProblemInstanceProviders(); 66 problemInstanceProviderComboBox.DataSource = ProblemInstanceProviders.OrderBy(x => x.Name).ToList(); 59 67 } 60 68 SetEnabledStateOfControls(); … … 90 98 private void problemInstanceProviderComboBox_SelectedIndexChanged(object sender, System.EventArgs e) { 91 99 if (problemInstanceProviderComboBox.SelectedIndex >= 0) { 100 SelectedProvider = (IProblemInstanceProvider)problemInstanceProviderComboBox.SelectedItem; 92 101 problemInstanceProviderViewHost.Content = SelectedProvider; 93 102 ProblemInstanceProviderView view = (ProblemInstanceProviderView)problemInstanceProviderViewHost.ActiveView; … … 97 106 } 98 107 SetTooltip(); 108 } else { 109 SelectedProvider = null; 99 110 } 111 100 112 SetEnabledStateOfControls(); 101 113 } … … 104 116 return Content.GetType().GetInterfaces() 105 117 .Any(x => x.Equals(typeof(IProblemInstanceExporter))); 106 }107 108 private void comboBox_DataSourceChanged(object sender, EventArgs e) {109 var comboBox = (ComboBox)sender;110 if (comboBox.DataSource == null)111 comboBox.Items.Clear();112 118 } 113 119
Note: See TracChangeset
for help on using the changeset viewer.