Changeset 8206 for branches/GP-MoveOperators/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceProviderViewGeneric.cs
- Timestamp:
- 07/03/12 16:46:35 (12 years ago)
- Location:
- branches/GP-MoveOperators
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-MoveOperators
- Property svn:mergeinfo changed
/trunk/sources merged: 8084,8088-8090,8092-8100,8102-8113,8115,8117-8132,8134-8146,8148-8156,8158-8160,8163-8170,8173-8176,8178-8190,8192-8205
- Property svn:mergeinfo changed
-
branches/GP-MoveOperators/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceProviderViewGeneric.cs
r8031 r8206 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; 28 using HeuristicLab.PluginInfrastructure; 29 29 30 30 namespace HeuristicLab.Problems.Instances.Views { … … 51 51 public ProblemInstanceProviderViewGeneric() { 52 52 InitializeComponent(); 53 loadButton.Text = String.Empty;54 loadButton.Image = VSImageLibrary.RefreshDocument;55 toolTip.SetToolTip(loadButton, "Load the selected problem.");56 53 } 57 54 … … 73 70 instanceLabel.Show(); 74 71 instancesComboBox.Show(); 75 loadButton.Show();76 72 } else { 77 73 instanceLabel.Hide(); 78 74 instancesComboBox.Hide(); 79 loadButton.Hide();80 75 } 81 76 } … … 84 79 base.SetEnabledStateOfControls(); 85 80 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 81 } 99 82 … … 104 87 } 105 88 106 private void instancesComboBox_SelectedIndexChanged(object sender, System.EventArgs e) { 107 SetEnabledStateOfControls(); 89 private void instancesComboBox_SelectionChangeCommitted(object sender, System.EventArgs e) { 90 if (instancesComboBox.SelectedIndex >= 0) { 91 var descriptor = (IDataDescriptor)instancesComboBox.SelectedItem; 92 T instance = Content.LoadData(descriptor); 93 try { 94 GenericConsumer.Load(instance); 95 } 96 catch (Exception ex) { 97 ErrorHandling.ShowErrorDialog(String.Format("This problem does not support loading the instance {0}", descriptor.Name), ex); 98 } 99 } 108 100 } 109 101 }
Note: See TracChangeset
for help on using the changeset viewer.