Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/03/12 16:46:35 (12 years ago)
Author:
gkronber
Message:

#1847: merged r8084:8205 from trunk into GP move operators branch

Location:
branches/GP-MoveOperators
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/GP-MoveOperators

  • branches/GP-MoveOperators/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceProviderViewGeneric.cs

    r8031 r8206  
    2424using System.Linq;
    2525using System.Windows.Forms;
    26 using HeuristicLab.Common.Resources;
    2726using HeuristicLab.MainForm;
    2827using HeuristicLab.MainForm.WindowsForms;
     28using HeuristicLab.PluginInfrastructure;
    2929
    3030namespace HeuristicLab.Problems.Instances.Views {
     
    5151    public ProblemInstanceProviderViewGeneric() {
    5252      InitializeComponent();
    53       loadButton.Text = String.Empty;
    54       loadButton.Image = VSImageLibrary.RefreshDocument;
    55       toolTip.SetToolTip(loadButton, "Load the selected problem.");
    5653    }
    5754
     
    7370        instanceLabel.Show();
    7471        instancesComboBox.Show();
    75         loadButton.Show();
    7672      } else {
    7773        instanceLabel.Hide();
    7874        instancesComboBox.Hide();
    79         loadButton.Hide();
    8075      }
    8176    }
     
    8479      base.SetEnabledStateOfControls();
    8580      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       }
    9881    }
    9982
     
    10487    }
    10588
    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      }
    108100    }
    109101  }
Note: See TracChangeset for help on using the changeset viewer.