Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/03/12 14:21:02 (12 years ago)
Author:
sforsten
Message:

#1782:

  • removed loadButton
  • a new problem instance is loaded as soon as it is selected in the combobox
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.Instances.Views/3.3/ProblemInstanceProviderViewGeneric.cs

    r8031 r8196  
    2424using System.Linq;
    2525using System.Windows.Forms;
    26 using HeuristicLab.Common.Resources;
    2726using HeuristicLab.MainForm;
    2827using HeuristicLab.MainForm.WindowsForms;
     
    5150    public ProblemInstanceProviderViewGeneric() {
    5251      InitializeComponent();
    53       loadButton.Text = String.Empty;
    54       loadButton.Image = VSImageLibrary.RefreshDocument;
    55       toolTip.SetToolTip(loadButton, "Load the selected problem.");
    5652    }
    5753
     
    7369        instanceLabel.Show();
    7470        instancesComboBox.Show();
    75         loadButton.Show();
    7671      } else {
    7772        instanceLabel.Hide();
    7873        instancesComboBox.Hide();
    79         loadButton.Hide();
    8074      }
    8175    }
     
    8478      base.SetEnabledStateOfControls();
    8579      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       }
    9880    }
    9981
     
    10486    }
    10587
    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      }
    10899    }
    109100  }
Note: See TracChangeset for help on using the changeset viewer.