Changeset 8196 for trunk/sources/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceProviderViewGeneric.cs
- Timestamp:
- 07/03/12 14:21:02 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceProviderViewGeneric.cs
r8031 r8196 24 24 using System.Linq; 25 25 using System.Windows.Forms; 26 using HeuristicLab.Common.Resources;27 26 using HeuristicLab.MainForm; 28 27 using HeuristicLab.MainForm.WindowsForms; … … 51 50 public ProblemInstanceProviderViewGeneric() { 52 51 InitializeComponent(); 53 loadButton.Text = String.Empty;54 loadButton.Image = VSImageLibrary.RefreshDocument;55 toolTip.SetToolTip(loadButton, "Load the selected problem.");56 52 } 57 53 … … 73 69 instanceLabel.Show(); 74 70 instancesComboBox.Show(); 75 loadButton.Show();76 71 } else { 77 72 instanceLabel.Hide(); 78 73 instancesComboBox.Hide(); 79 loadButton.Hide();80 74 } 81 75 } … … 84 78 base.SetEnabledStateOfControls(); 85 79 instancesComboBox.Enabled = !ReadOnly && !Locked && Content != null && GenericConsumer != null; 86 loadButton.Enabled = !ReadOnly && !Locked && Content != null && GenericConsumer != null && instancesComboBox.SelectedIndex >= 0;87 }88 89 protected virtual void loadButton_Click(object sender, EventArgs e) {90 var descriptor = (IDataDescriptor)instancesComboBox.SelectedItem;91 T instance = Content.LoadData(descriptor);92 try {93 GenericConsumer.Load(instance);94 }95 catch (Exception ex) {96 MessageBox.Show(String.Format("This problem does not support loading the instance {0}: {1}", descriptor.Name, Environment.NewLine + ex.Message), "Cannot load instance");97 }98 80 } 99 81 … … 104 86 } 105 87 106 private void instancesComboBox_SelectedIndexChanged(object sender, System.EventArgs e) { 107 SetEnabledStateOfControls(); 88 private void instancesComboBox_SelectionChangeCommitted(object sender, System.EventArgs e) { 89 if (instancesComboBox.SelectedIndex >= 0) { 90 var descriptor = (IDataDescriptor)instancesComboBox.SelectedItem; 91 T instance = Content.LoadData(descriptor); 92 try { 93 GenericConsumer.Load(instance); 94 } 95 catch (Exception ex) { 96 MessageBox.Show(String.Format("This problem does not support loading the instance {0}: {1}", descriptor.Name, Environment.NewLine + ex.Message), "Cannot load instance"); 97 } 98 } 108 99 } 109 100 }
Note: See TracChangeset
for help on using the changeset viewer.